Beispiel #1
0
        /// <summary>
        /// Runs the Init setup for the manager if needed....
        /// </summary>
        private void FirstSetup()
        {
            // Makes the audio directoy if it doesn't exist in your project
            // * This will not create a new folder if you already have an audio folder *
            // * As of V2 it will also create a new Audio Manager audioManagerFile if there isn't one in the audio folder *
            if (!Directory.Exists(Application.dataPath + "/Audio"))
            {
                AssetDatabase.CreateFolder("Assets", "Audio");

                if (!Directory.Exists(Application.dataPath + "/Audio"))
                {
                    AssetDatabase.CreateFolder("Assets/Audio", "Files");
                }

                AssetDatabase.CreateFolder("Assets/Audio", "Files");

                AudioManagerFile _newAMF = ScriptableObject.CreateInstance <AudioManagerFile>();
                AssetDatabase.CreateAsset(_newAMF, "Assets/Audio/Files/Audio Manager File.asset");
                audioManagerScript.audioManagerFile           = (AudioManagerFile)AssetDatabase.LoadAssetAtPath("Assets/Audio/Files/Audio Manager File.asset", typeof(AudioManagerFile));
                audioManagerScript.audioManagerFile.directory = new List <string>();
            }
            else if (((Directory.Exists(Application.dataPath + "/Audio")) && (!Directory.Exists(Application.dataPath + "/Audio/Files"))))
            {
                AssetDatabase.CreateFolder("Assets/Audio", "Files");
                AudioManagerFile _newAMF = ScriptableObject.CreateInstance <AudioManagerFile>();
                AssetDatabase.CreateAsset(_newAMF, "Assets/Audio/Files/Audio Manager File.asset");
                audioManagerScript.audioManagerFile           = (AudioManagerFile)AssetDatabase.LoadAssetAtPath("Assets/Audio/Files/Audio Manager File.asset", typeof(AudioManagerFile));
                audioManagerScript.audioManagerFile.directory = new List <string>();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Runs the Init setup for the manager if needed....
        /// </summary>
        private void FirstSetup()
        {
            // Adds an Audio Source to the gameobject this script is on if its not already there (used for previewing audio only)
            // * Hide flags hides it from the inspector so you don't notice it there *
            if (audioManagerScript.gameObject.GetComponent <AudioSource>())
            {
                audioManagerScript.gameObject.GetComponent <AudioSource>().hideFlags = HideFlags.HideInInspector;
                audioManagerScript.GetComponent <AudioSource>().playOnAwake          = false;
            }
            else
            {
                audioManagerScript.gameObject.AddComponent <AudioSource>();
                audioManagerScript.gameObject.GetComponent <AudioSource>().hideFlags = HideFlags.HideInInspector;
                audioManagerScript.GetComponent <AudioSource>().playOnAwake          = false;
            }

            // Makes the audio directoy if it doesn't exist in your project
            // * This will not create a new folder if you already have an audio folder *
            // * As of V2 it will also create a new Audio Manager audioManagerFile if there isn't one in the audio folder *
            if (!Directory.Exists(Application.dataPath + "/Audio"))
            {
                AssetDatabase.CreateFolder("Assets", "Audio");

                if (!Directory.Exists(Application.dataPath + "/Audio"))
                {
                    AssetDatabase.CreateFolder("Assets/Audio", "Files");
                }

                AssetDatabase.CreateFolder("Assets/Audio", "Files");

                AudioManagerFile _newAMF = ScriptableObject.CreateInstance <AudioManagerFile>();
                AssetDatabase.CreateAsset(_newAMF, "Assets/Audio/Files/Audio Manager File.asset");
                audioManagerScript.audioManagerFile           = (AudioManagerFile)AssetDatabase.LoadAssetAtPath("Assets/Audio/Files/Audio Manager File.asset", typeof(AudioManagerFile));
                audioManagerScript.audioManagerFile.directory = new List <string>();
            }
            else if (((Directory.Exists(Application.dataPath + "/Audio")) && (!Directory.Exists(Application.dataPath + "/Audio/Files"))))
            {
                AssetDatabase.CreateFolder("Assets/Audio", "Files");
                AudioManagerFile _newAMF = ScriptableObject.CreateInstance <AudioManagerFile>();
                AssetDatabase.CreateAsset(_newAMF, "Assets/Audio/Files/Audio Manager File.asset");
                audioManagerScript.audioManagerFile           = (AudioManagerFile)AssetDatabase.LoadAssetAtPath("Assets/Audio/Files/Audio Manager File.asset", typeof(AudioManagerFile));
                audioManagerScript.audioManagerFile.directory = new List <string>();
            }
        }
 // Changes the Audio Manager File to what is inputted
 public void ChangeAudioManagerFile(AudioManagerFile newFile)
 {
     audioManagerFile = newFile;
     UpdateLibrary();
 }