public static void removeSong(grumbleAMP gA) { if (gA.songs.Length > 1) { grumbleSong[] tempSongs = new grumbleSong[gA.songs.Length]; tempSongs = gA.songs; gA.songs[gA.songs.Length - 1] = null; DestroyImmediate(gA.songs[gA.songs.Length - 1]); gA.songs = new grumbleSong[gA.songs.Length - 1]; for (int i = 0; i < gA.songs.Length; i++) { gA.songs[i] = tempSongs[i]; } } }
public static void addSong(grumbleAMP gA) { grumbleSong[] tempSongs = new grumbleSong[gA.songs.Length]; tempSongs = gA.songs; gA.songs = new grumbleSong[gA.songs.Length + 1]; for (int i = 0; i < tempSongs.Length; i++) { gA.songs[i] = tempSongs[i]; } // Initializes Default Settings For A New Song gA.songs[gA.songs.Length - 1] = (grumbleSong)ScriptableObject.CreateInstance("grumbleSong"); gA.songs[gA.songs.Length - 1].textName = "SONG " + (gA.songs.Length - 1).ToString(); gA.songs[gA.songs.Length - 1].layer = new AudioClip[1]; gA.songs[gA.songs.Length - 1].layerNames = new string[1]; gA.songs[gA.songs.Length - 1].layerNames[0] = "Layer 0"; gA.songs[gA.songs.Length - 1].volumes = new float[1]; gA.songs[gA.songs.Length - 1].volumes[0] = 1f; gA.songs[gA.songs.Length - 1].layerResourceNames = new string[1]; gA.songs[gA.songs.Length - 1].layerResourceNames[0] = ""; }