您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
35 行
1.1 KiB
35 行
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using UnityEditor.ProjectWindowCallback;
|
|
using System.IO;
|
|
|
|
public class AudioCueFactory
|
|
{
|
|
[MenuItem("Assets/Create/VFX Demo/AudioCue", priority = 301)]
|
|
private static void MenuCreateAudioCue()
|
|
{
|
|
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon");
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreateAudioCue>(), "AudioCue.asset", icon, null);
|
|
}
|
|
|
|
internal static AudioCue CreateAudioCueFactoryAtPath(string path)
|
|
{
|
|
AudioCue asset = ScriptableObject.CreateInstance<AudioCue>();
|
|
asset.name = Path.GetFileName(path);
|
|
AssetDatabase.CreateAsset(asset, path);
|
|
return asset;
|
|
}
|
|
|
|
}
|
|
|
|
internal class DoCreateAudioCue : EndNameEditAction
|
|
{
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
AudioCue asset = AudioCueFactory.CreateAudioCueFactoryAtPath(pathName);
|
|
ProjectWindowUtil.ShowCreatedAsset(asset);
|
|
}
|
|
}
|
|
|