예제 #1
0
        private void CreateAudioPrefab(int levelSize)
        {
            GameObject go = new GameObject();

            Manager.AudioTree = AudioNodeWorker.CreateTree(go, levelSize);
            SaveAndLoad.CreateAudioNodeRootPrefab(go);
        }
예제 #2
0
 private void CreateFolderInNewPrefab(InAudioNode parent)
 {
     InAudioWindowOpener.ShowNewDataWindow((gameObject =>
     {
         var node = AudioNodeWorker.CreateChild(gameObject, parent, AudioNodeType.Folder);
         node.Name += " (External)";
         (node._nodeData as InFolderData).ExternalPlacement = true;
     }));
 }
예제 #3
0
        public static void StartFromScratch(InCommonDataManager Manager)
        {
            SystemFolderHelper.CreateIfMissing(FolderSettings.BankCreateFolder);
            try
            {
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);
            }
            catch (Exception)
            {
                //Do nothing as something is seriously wrong
            }


            int        levelSize = 3;
            GameObject audioGO   = new GameObject();
            GameObject eventGO   = new GameObject();
            GameObject busGO     = new GameObject();
            GameObject bankGO    = new GameObject();

            Manager.BusTree      = AudioBusWorker.CreateTree(busGO);
            Manager.BankLinkTree = AudioBankWorker.CreateTree(bankGO);
            Manager.AudioTree    = AudioNodeWorker.CreateTree(audioGO, levelSize, Manager.BusTree);

            Manager.EventTree = AudioEventWorker.CreateTree(eventGO, levelSize);

            SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.EventTree.gameObject, Manager.BusTree.gameObject,
                                          Manager.BankLinkTree.gameObject);

            Manager.Load(true);

            if (Manager.BankLinkTree != null)
            {
                var bankLink = Manager.BankLinkTree.Children[0];
                bankLink.Name     = "Default - Auto loaded";
                bankLink.AutoLoad = true;

                NodeWorker.AssignToNodes(Manager.AudioTree, node =>
                {
                    var data = (node.NodeData as InFolderData);
                    if (data != null)
                    {
                        data.BankLink = Manager.BankLinkTree.GetChildren[0];
                    }
                });

                NodeWorker.AssignToNodes(Manager.AudioTree, node => node.Bus = Manager.BusTree);

                AssetDatabase.Refresh();
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);
                EditorApplication.SaveCurrentSceneIfUserWantsTo();
            }
            else
            {
                Debug.LogError("There was a problem creating the data.");
            }
        }
예제 #4
0
        private void CreateChild(InAudioNode parent, AudioNodeType type)
        {
            UndoHelper.RecordObjectFull(new UnityEngine.Object[] { parent, parent.GetBank().LazyBankFetch },
                                        "Create Audio Node");
            var newNode = AudioNodeWorker.CreateChild(parent, type);

            if (type == AudioNodeType.Audio)
            {
                AudioBankWorker.AddNodeToBank(newNode, null);
            }
        }
예제 #5
0
        public static void StartFromScratch(InCommonDataManager Manager)
        {
            try
            {
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);
            }
            catch (Exception)
            {
                Debug.LogError("InAudio: Problem cleaning data before creating project.\nPlease report bug to [email protected] or via the feedback window.");
            }

            CreateAll(Manager);
            Manager.ForceLoad();

            try
            {
                var firstAudioFolder = Manager.AudioTree._children[0];

                AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Audio, "Empty Example Audio Node");

                var random = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Random);
                random.Name = "Random Node Example";
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");

                var multi = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Multi, "Multi-Sound Example");
                AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously");
                AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously");

                var sequence = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Sequence, "Sequence-Sound Example");
                AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played first");
                AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played secondly");

                var firstMusicFolder = Manager.MusicTree._children[0];
                var musicGroup       = MusicWorker.CreateMusicGroup(firstMusicFolder, "Example Music Group");
                firstMusicFolder.EditorSettings.IsFoldedOut = true;
                MusicWorker.CreateMusicGroup(musicGroup, "Example Music Group - Layer 1");
                MusicWorker.CreateMusicGroup(musicGroup, "Example Music Group - Layer 2");
                musicGroup.EditorSettings.IsFoldedOut = true;



                var firstEventFolder = Manager.EventTree._children[0];
                firstEventFolder.EditorSettings.IsFoldedOut = true;

                var audioEvent = AudioEventWorker.CreateNode(firstEventFolder, EventNodeType.Event);
                audioEvent.Name = "Playing Music & Random Audio Event";
                var musicAction = AudioEventWorker.AddEventAction <InEventMusicControl>(audioEvent, EventActionTypes.PlayMusic);
                audioEvent.EditorSettings.IsFoldedOut = true;
                musicAction.MusicGroup = musicGroup;
                var action = AudioEventWorker.AddEventAction <InEventAudioAction>(audioEvent, EventActionTypes.Play);
                audioEvent.EditorSettings.IsFoldedOut = true;
                action.Node = random;

                AssetDatabase.Refresh();
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);

#if !UNITY_5_2
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
#else
                EditorApplication.MarkSceneDirty();
                EditorApplication.SaveCurrentSceneIfUserWantsTo();
#endif
            }
            catch (Exception)
            {
                Debug.LogError("InAudio: There was a problem creating the data.\nPlease report this bug to [email protected] or via the feedback window.");
            }
        }
예제 #6
0
        private void DrawTypeControls(InAudioNode node)
        {
            try
            {
                var type = node.Type;
                if (node.NodeData != null)
                {
                    switch (type)
                    {
                    case AudioNodeType.Audio:
                        AudioDataDrawer.Draw(node);
                        break;

                    case AudioNodeType.Sequence:
                        SequenceDataDrawer.Draw(node);
                        break;

                    case AudioNodeType.Random:
                        RandomDataDrawer.Draw(node);
                        break;

                    case AudioNodeType.Multi:
                        MultiDataDrawer.Draw(node);
                        break;

                    case AudioNodeType.Folder:
                        FolderDrawer.Draw(node);
                        break;

                    case AudioNodeType.Track:
                        TrackDataDrawer.Draw(node);
                        break;

                    case AudioNodeType.Root:
                        FolderDrawer.Draw(node);
                        break;
                    }
                }
                else if (SelectedNode.Type == AudioNodeType.Folder || SelectedNode.Type == AudioNodeType.Root)
                {
                    FolderDrawer.Draw(node);
                }
                else
                {
                    EditorGUILayout.HelpBox("Corrupt data. The data for this node does either not exist or is corrupt.",
                                            MessageType.Error, true);
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Create new element", GUILayout.Width(150)))
                    {
                        AudioNodeWorker.AddDataClass(node);
                    }


                    EditorGUILayout.EndHorizontal();
                }
            }
            catch (ExitGUIException e)
            {
                throw e;
            }
            catch (ArgumentException e)
            {
                throw e;
            }

            /*catch (Exception e)
             * {
             *  //While this catch was made to catch persistent errors,  like a missing null check, it can also catch other errors
             *  EditorGUILayout.BeginVertical();
             *  EditorGUILayout.HelpBox("An exception is getting caught while trying to draw node. ", MessageType.Error,
             *      true);
             *  if (GUILayout.Button("Create new element", GUILayout.Width(150)))
             *  {
             *      AudioNodeWorker.AddDataClass(node);
             *  }
             *  EditorGUILayout.TextArea(e.ToString());
             *  EditorGUILayout.EndVertical();
             * }*/
        }
예제 #7
0
        protected override void OnContext(InAudioNode node)
        {
            var menu = new GenericMenu();

            #region Duplicate

#if !UNITY_4_1 && !UNITY_4_2
            if (!node.IsRoot)
            {
                menu.AddItem(new GUIContent("Duplicate"), false, data => AudioNodeWorker.Duplicate(node), node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Duplicate"));
            }
            menu.AddSeparator("");
#endif

            #endregion
            #region Create child

            if (node.Type == AudioNodeType.Audio || node.Type == AudioNodeType.Voice)
            //If it is a an audio source, it cannot have any children
            {
                menu.AddDisabledItem(new GUIContent(@"Create Child/Folder"));
                menu.AddDisabledItem(new GUIContent(@"Create Child/Audio"));
                menu.AddDisabledItem(new GUIContent(@"Create Child/Random"));
                menu.AddDisabledItem(new GUIContent(@"Create Child/Sequence"));
                menu.AddDisabledItem(new GUIContent(@"Create Child/Multi"));
#if UNITY_TRACK
                //menu.AddDisabledItem(new GUIContent(@"Create Child/Track"));
#endif
                //menu.AddDisabledItem(new GUIContent(@"Create Child/Track"));
                //menu.AddDisabledItem(new GUIContent(@"Create Child/Voice"));
            }
            else
            {
                if (node.Type == AudioNodeType.Root || node.Type == AudioNodeType.Folder)
                {
                    menu.AddItem(new GUIContent(@"Create Child/Folder"), false,
                                 (obj) => CreateChild(node, AudioNodeType.Folder), node);
                }
                else
                {
                    menu.AddDisabledItem(new GUIContent(@"Create Child/Folder"));
                }
                menu.AddItem(new GUIContent(@"Create Child/Audio"), false,
                             (obj) => CreateChild(node, AudioNodeType.Audio), node);
                menu.AddItem(new GUIContent(@"Create Child/Random"), false,
                             (obj) => CreateChild(node, AudioNodeType.Random), node);
                menu.AddItem(new GUIContent(@"Create Child/Sequence"), false,
                             (obj) => CreateChild(node, AudioNodeType.Sequence), node);
                menu.AddItem(new GUIContent(@"Create Child/Multi"), false,
                             (obj) => CreateChild(node, AudioNodeType.Multi), node);
#if UNITY_TRACK
                menu.AddItem(new GUIContent(@"Create Child/Track"), false,
                             (obj) => CreateChild(node, AudioNodeType.Track), node);
#endif
                //menu.AddItem(new GUIContent(@"Create Child/Track"), false,      (obj) => CreateChild(node, AudioNodeType.Track), node);
                //menu.AddItem(new GUIContent(@"Create Child/Voice"), false,      (obj) => CreateChild(node, AudioNodeType.Voice), node);
            }

            #endregion

            menu.AddSeparator("");

            #region Add new parent

            if (node.Parent != null &&
                (node.Parent.Type == AudioNodeType.Folder || node.Parent.Type == AudioNodeType.Root))
            {
                menu.AddItem(new GUIContent(@"Add Parent/Folder"), false,
                             (obj) => AudioNodeWorker.AddNewParent(node, AudioNodeType.Folder), node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent(@"Add Parent/Folder"));
            }
            menu.AddDisabledItem(new GUIContent(@"Add Parent/Audio"));
            if (node.Parent != null && node.Type != AudioNodeType.Folder)
            {
                menu.AddItem(new GUIContent(@"Add Parent/Random"), false,
                             (obj) => AudioNodeWorker.AddNewParent(node, AudioNodeType.Random), node);
                menu.AddItem(new GUIContent(@"Add Parent/Sequence"), false,
                             (obj) => AudioNodeWorker.AddNewParent(node, AudioNodeType.Sequence), node);
                menu.AddItem(new GUIContent(@"Add Parent/Multi"), false,
                             (obj) => AudioNodeWorker.AddNewParent(node, AudioNodeType.Multi), node);
                //menu.AddItem(new GUIContent(@"Add Parent/Track"), false, (obj) =>       AudioNodeWorker.AddNewParent(node, AudioNodeType.Track), node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent(@"Add Parent/Random"));
                menu.AddDisabledItem(new GUIContent(@"Add Parent/Sequence"));
                menu.AddDisabledItem(new GUIContent(@"Add Parent/Multi"));
                //menu.AddDisabledItem(new GUIContent(@"Add Parent/Track"));
            }
            //menu.AddDisabledItem(new GUIContent(@"Add Parent/Voice"));

            #endregion

            menu.AddSeparator("");

            #region Convert to

            if (node.Children.Count == 0 && !node.IsRootOrFolder)
            {
                menu.AddItem(new GUIContent(@"Convert To/Audio"), false,
                             (obj) => AudioNodeWorker.ConvertNodeType(node, AudioNodeType.Audio), node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent(@"Convert To/Audio"));
            }
            if (!node.IsRootOrFolder)
            {
                menu.AddItem(new GUIContent(@"Convert To/Random"), false,
                             (obj) => AudioNodeWorker.ConvertNodeType(node, AudioNodeType.Random), node);
                menu.AddItem(new GUIContent(@"Convert To/Sequence"), false,
                             (obj) => AudioNodeWorker.ConvertNodeType(node, AudioNodeType.Sequence), node);
                menu.AddItem(new GUIContent(@"Convert To/Multi"), false,
                             (obj) => AudioNodeWorker.ConvertNodeType(node, AudioNodeType.Multi), node);
                //menu.AddItem(new GUIContent(@"Convert To/Track"), false, (obj) =>       AudioNodeWorker.ConvertNodeType(node, AudioNodeType.Track), node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent(@"Convert To/Random"));
                menu.AddDisabledItem(new GUIContent(@"Convert To/Sequence"));
                menu.AddDisabledItem(new GUIContent(@"Convert To/Multi"));
                //menu.AddDisabledItem(new GUIContent(@"Add Parent/Track"));
            }

            #endregion

            menu.AddSeparator("");

            #region Delete

            if (node.Type != AudioNodeType.Root)
            {
                menu.AddItem(new GUIContent("Delete"), false, obj =>
                {
                    treeDrawer.SelectedNode = TreeWalker.GetPreviousVisibleNode(treeDrawer.SelectedNode);
                    AudioNodeWorker.DeleteNode(node);
                }, node);
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Delete"));
            }

            #endregion

            menu.ShowAsContext();
        }
예제 #8
0
        protected override void OnDrop(InAudioNode node, UnityEngine.Object[] objects)
        {
            if (objects[0] as InAudioNode != null) //Drag N Drop internally in the tree, change the parent
            {
                node.IsFoldedOut = true;
                var nodeToMove = objects[0] as InAudioNode;

                UndoHelper.RecordObject(
                    new UnityEngine.Object[] { node, node.NodeData, nodeToMove.Parent.NodeData, nodeToMove, nodeToMove.Parent }.AddObj(
                        TreeWalker.FindAll(InAudioInstanceFinder.DataManager.BankLinkTree,
                                           link => link.Type == AudioBankTypes.Link ? link.LazyBankFetch : null).ToArray()),
                    "Audio Node Move");

                NodeWorker.ReasignNodeParent(nodeToMove, node);
                AudioBankWorker.RebuildBanks(InAudioInstanceFinder.DataManager.BankLinkTree,
                                             InAudioInstanceFinder.DataManager.AudioTree);
            }
            else if (node.Type != AudioNodeType.Audio) //Create new audio nodes when we drop clips
            {
                UndoHelper.RecordObject(UndoHelper.NodeUndo(node), "Adding Nodes to " + node.Name);

                AudioClip[] clips = objects.Convert(o => o as AudioClip);

                Array.Sort(clips, (clip, audioClip) => StringLogicalComparer.Compare(clip.name, audioClip.name));

                for (int i = 0; i < clips.Length; ++i)
                {
                    var clip  = clips[i];
                    var child = AudioNodeWorker.CreateChild(node, AudioNodeType.Audio);
                    var path  = AssetDatabase.GetAssetPath(clip);
                    try
                    {
                        //Try and get the name of the clip. Gets the name and removes the end. Assets/IntroSound.mp3 -> IntroSound
                        int lastIndex = path.LastIndexOf('/') + 1;
                        child.Name = path.Substring(lastIndex, path.LastIndexOf('.') - lastIndex);
                    }
                    catch (Exception)
                    //If it happens to be a mutant path. Not even sure if this is possible, but better safe than sorry
                    {
                        child.Name = node.Name + " Child";
                    }

                    (child.NodeData as InAudioData).EditorClip  = clip;
                    (child.NodeData as InAudioData).RuntimeClip = clip;

                    AudioBankWorker.AddNodeToBank(child, clip);
                    Event.current.Use();
                }
            }
            else //Then it must be an audio clip dropped on an audio node, so assign the clip to that node
            {
                var nodeData = (node.NodeData as InAudioData);
                if (nodeData != null)
                {
                    UndoHelper.RecordObject(UndoHelper.NodeUndo(node), "Change Audio Clip In " + node.Name);
                    nodeData.EditorClip = objects[0] as AudioClip;
                    if (Application.isPlaying)
                    {
                        if (node.GetBank().IsLoaded)
                        {
                            nodeData.RuntimeClip = objects[0] as AudioClip;
                        }
                    }
                    AudioBankWorker.SwapClipInBank(node, objects[0] as AudioClip);
                }
            }
        }
예제 #9
0
        protected override void OnDrop(InAudioNode node, UnityEngine.Object[] objects)
        {
            if (objects[0] as InAudioNode != null) //Drag N Drop internally in the tree, change the parent
            {
                InUndoHelper.DoInGroup(() =>
                {
                    node.IsFoldedOut = true;
                    var nodeToMove   = objects[0] as InAudioNode;

                    if (node.gameObject != nodeToMove.gameObject)
                    {
                        if (EditorUtility.DisplayDialog("Move?",
                                                        "Warning, this will break all external references to this and all child nodes!\n" +
                                                        "Move node from\"" + nodeToMove.gameObject.name +
                                                        "\" to \"" + node.gameObject.name + "\"?", "Ok", "Cancel"))
                        {
                            treeDrawer.SelectedNode = treeDrawer.SelectedNode._getParent;
                            isDirty = false;
                            AudioNodeWorker.CopyTo(nodeToMove, node);
                            AudioNodeWorker.DeleteNodeNoGroup(nodeToMove);
                        }
                    }
                    else
                    {
                        MoveNode(node, nodeToMove);
                    }
                });
            }
            else if (node._type != AudioNodeType.Audio) //Create new audio nodes when we drop clips
            {
                InUndoHelper.DoInGroup(() =>
                {
                    InUndoHelper.RecordObject(InUndoHelper.NodeUndo(node), "Adding Nodes to " + node.Name);

                    AudioClip[] clips = objects.Convert(o => o as AudioClip);

                    Array.Sort(clips, (clip, audioClip) => StringLogicalComparer.Compare(clip.name, audioClip.name));

                    for (int i = 0; i < clips.Length; ++i)
                    {
                        var clip  = clips[i];
                        var child = AudioNodeWorker.CreateChild(node, AudioNodeType.Audio);
                        var path  = AssetDatabase.GetAssetPath(clip);
                        try
                        {
                            //Try and get the name of the clip. Gets the name and removes the end. Assets/IntroSound.mp3 -> IntroSound
                            int lastIndex = path.LastIndexOf('/') + 1;
                            child.Name    = path.Substring(lastIndex, path.LastIndexOf('.') - lastIndex);
                        }
                        catch (Exception)
                        //If it happens to be a mutant path. Not even sure if this is possible, but better safe than sorry
                        {
                            child.Name = node.Name + " Child";
                        }

                        var audioData   = (child._nodeData as InAudioData);
                        audioData._clip = clip;

                        AudioBankWorker.AddNodeToBank(child);
                        Event.current.UseEvent();
                    }
                });
            }
            else //Then it must be an audio clip dropped on an audio node, so assign the clip to that node
            {
                InUndoHelper.DoInGroup(() =>
                {
                    var nodeData = (node._nodeData as InAudioData);
                    if (nodeData != null)
                    {
                        InUndoHelper.RecordObject(InUndoHelper.NodeUndo(node), "Change Audio Clip In " + node.Name);
                        nodeData._clip = objects[0] as AudioClip;
                    }
                });
                Event.current.UseEvent();
            }
        }
예제 #10
0
 private void CreateChild(InAudioNode parent, AudioNodeType type)
 {
     InUndoHelper.RecordObjectFull(new UnityEngine.Object[] { parent },
                                   "Create Audio Node");
     AudioNodeWorker.CreateChild(parent, type);
 }
예제 #11
0
        public static void StartFromScratch(InCommonDataManager Manager)
        {
            try
            {
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);
            }
            catch (Exception)
            {
                Debug.LogError("InAudio: Problem cleaning data before creating project.\nPlease report bug to [email protected] or via the feedback window.");
            }

            int        levelSize = 3;
            GameObject audioGO   = new GameObject();
            GameObject eventGO   = new GameObject();
            GameObject bankGO    = new GameObject();
            GameObject musicGO   = new GameObject();

            Manager.BankLinkTree = AudioBankWorker.CreateTree(bankGO);
            Manager.AudioTree    = AudioNodeWorker.CreateTree(audioGO, levelSize);
            Manager.MusicTree    = MusicWorker.CreateTree(musicGO, levelSize);
            Manager.EventTree    = AudioEventWorker.CreateTree(eventGO, levelSize);



            SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.MusicTree.gameObject, Manager.EventTree.gameObject, Manager.BankLinkTree.gameObject);

            Manager.Load(true);

            if (Manager.BankLinkTree != null)
            {
                var bankLink = Manager.BankLinkTree._children[0];
                bankLink._name     = "Default - Auto loaded";
                bankLink._autoLoad = true;

                NodeWorker.AssignToNodes(Manager.AudioTree, node =>
                {
                    var data = (node._nodeData as InFolderData);
                    if (data != null)
                    {
                        data.BankLink = Manager.BankLinkTree._getChildren[0];
                    }
                });

                NodeWorker.AssignToNodes(Manager.MusicTree, musicNode =>
                {
                    var folder = musicNode as InMusicFolder;
                    if (folder != null)
                    {
                        folder._bankLink = Manager.BankLinkTree._getChildren[0];
                    }
                });


                var firstAudioFolder = Manager.AudioTree._children[0];

                AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Audio, "Empty Example Audio Node");

                var random = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Random);
                random.Name = "Random Node Example";
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");
                AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node");

                var multi = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Multi, "Multi-Sound Example");
                AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously");
                AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously");

                var sequence = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Sequence, "Sequence-Sound Example");
                AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played first");
                AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played secondly");


                var firstEventFolder = Manager.EventTree._children[0];
                firstEventFolder.FoldedOut = true;
                var audioEvent = AudioEventWorker.CreateNode(firstEventFolder, EventNodeType.Event);
                audioEvent.Name = "Playing Random Audio Event";
                var action = AudioEventWorker.AddEventAction <InEventAudioAction>(audioEvent, EventActionTypes.Play);
                audioEvent.FoldedOut = true;
                action.Node          = random;

                var firstMusicFolder = Manager.MusicTree._children[0];
                var musicGroup       = MusicWorker.CreateMusicGroup(firstMusicFolder, "Empty Music Group");
                firstMusicFolder.FoldedOut = true;
                MusicWorker.CreateMusicGroup(musicGroup, "Empty Music Group - Child 1");
                MusicWorker.CreateMusicGroup(musicGroup, "Empty Music Group - Child 2");
                musicGroup.FoldedOut = true;


                AssetDatabase.Refresh();
                DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent);

#if !UNITY_5_2
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
                EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
#else
                EditorApplication.MarkSceneDirty();
                EditorApplication.SaveCurrentSceneIfUserWantsTo();
#endif
            }
            else
            {
                Debug.LogError("InAudio: There was a problem creating the data.\nPlease report this bug to [email protected] or via the feedback window.");
            }
        }