Example #1
0
    /// <summary>
    /// Gets the event description.
    /// </summary>
    /// <param name="path">The path.</param>
    /// <returns></returns>
    public FMOD.Studio.EventDescription GetEventDescription(string path)
    {
        EventDescription eventDescription;

        if (eventDescriptions.ContainsKey(path))
        {
            eventDescription = eventDescriptions[path];
        }
        else
        {
            FMOD.GUID id = new FMOD.GUID();

            if (path.StartsWith("{"))
            {
                Logger.ErrorCheck(FMOD.Studio.Util.ParseID(path, out id));
            }
            else if (path.StartsWith("event:"))
            {
                Logger.ErrorCheck(system.LookupID(path, out id));
            }
            else
            {
                Logger.LogError("Expected event path to start with 'event:/'");
            }

            Logger.ErrorCheck(system.GetEvent(id, FMOD.Studio.LoadingMode.BeginNow, out eventDescription));

            if (eventDescription != null && eventDescription.IsValid())
            {
                eventDescriptions.Add(path, eventDescription);
            }
            else
            {
                Logger.LogError("Could not get event " + id + " for " + path);
            }
        }
        return(eventDescription);
    }