InAudio Documentation

Advanced Audio Plugin for Unity

User Tools

Site Tools


dataaccess

Data Access

If you for whatever reason want to have access to all parts of the InAudio data, the CommonDataManager is the solution. It can be accessed via the static property DataManager in theInAudioInstanceFinder class. The data manager contains a Load() function that loads all data. It works in both the editor and runtime.

This is not the prefered way of working with InAudio! Using the way described in the examples is the prefered way as that cannot change anything unintentionally.

Though if you still want to access the data directly, you can do it like this.

InAudioNode rootNode = InAudioInstanceFinder.DataManager.AudioTree;
Debug.Log(rootNode.GetName);

//If you want to find something by a specific name or another parameter.
//TreeWalker is the prefered way to traverse the hiearchy.
InAudioNode foundNode = TreeWalker.FindFirst(InAudioInstanceFinder.DataManager.AudioTree, node => node.GetName == "example name");

Be careful As the data is placed in prefabs, any change to the data will change it permanently. Even if you are in playmode.

The properties in the CommonDataManager is as follows

  • AudioTree - Audio data
  • EventTree - Event data
  • BusTree - Bus data
  • BankLinkTree - Bank data

Each of these all implement the ITreeNode interface which contains these members.

public interface ITreeNode<T> where T : UnityEngine.Object, ITreeNode<T>
{
    T GetParent { get; set; }
    List<T> GetChildren { get; }
    bool IsRoot { get; }
    string GetName { get; }
    int ID { get; set; }
}

dataaccess.txt · Last modified: 2015/07/11 13:15 by peterolsted