Skip to content

Instantly share code, notes, and snippets.

@ZeredaGames
Last active February 27, 2019 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeredaGames/eb204c344499851f8e9276e2c86bacbc to your computer and use it in GitHub Desktop.
Save ZeredaGames/eb204c344499851f8e9276e2c86bacbc to your computer and use it in GitHub Desktop.
Option A
#region usings
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
//using UnityEngine.UI;
//using UnityEngine.SceneManagement;
//using System;
//using System.Collections;
using System.Collections.Generic;
#endregion
#region Script
namespace ZeredaGamesEngine.Core.MusicListsExamples.Example3
{
#region Attributes
//[RequireComponent (typeof())]
[System.Serializable]
#endregion
[CreateAssetMenu(menuName = "My custom button name", fileName = "NewInstanceOf_MyScriptableObject.asset")]
public class MusicAssetList : ScriptableObject{
public List<AudioClip> PlayList = new List<AudioClip>();
/// <summary>
/// Creates the general music list asset.
/// </summary>
/// <returns>The general music list asset.</returns>
/// <param name="index">Index.</param>
[MenuItem ("Window/Editor Tools/ZeredaGames/Game Making Editor Tools/Create Playlist-General Music", false, 1)]
public static MusicAssetList CreateNewAsset ()
{
string AssetName = "Assets/Resources/Music/GeneralMusicList.asset";
MusicAssetList asset = ScriptableObject.CreateInstance<MusicAssetList> ();
AssetDatabase.CreateAsset (asset, AssetName);
AssetDatabase.SaveAssets ();
EditorUtility.FocusProjectWindow ();
Selection.activeObject = asset;
return asset;
}
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment