void Awake() { Bank = (AudioEventBank)target; if (Bank.AudioEvents == null) { Bank.AudioEvents = new List <AudioEvent>(); } }
void OnWizardCreate() { string path = "Assets"; foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets)) { path = AssetDatabase.GetAssetPath(obj); if (File.Exists(path)) { path = Path.GetDirectoryName(path); } break; } AudioEventBank asset = ScriptableObject.CreateInstance <AudioEventBank>(); asset.AudioEvents = new List <AudioEvent>(); AssetDatabase.CreateAsset(asset, AssetDatabase.GenerateUniqueAssetPath(Path.Combine(path, BankName + ".asset"))); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }