How to access Action’s data¶
It is possible to access the data of all actions in the current session.
Note
Make sure you to use the MAGES namespace;
Basic Data Example¶
- This function prints the name, state, and ID of every single action in the scenegraph. 
private void PrintActionData(ActionState targetState)
{
    // Access the SceneGraphModule through the MAGES Hub
    SceneGraphModule sceneGraphModule = Hub.Instance.Get<SceneGraphModule>();
    List<BaseActionData> relevantActions = new List<BaseActionData>();
    sceneGraphModule.ForEachAction(action =>
    {
        Debug.Log(action.name);
        Debug.Log(action.State);
        Debug.Log(action.ID);
    });
}
Advanced Data Example¶
- This function prints the name, state, and ID of every single action in the scenegraph. 
- Clears effects of every single action. 
- Then, for every action that is currently running, it accesses the first game object of its actions and prints their name. 
- Then, for every action that is currently running, it accesses the next immediate actions and prints the name of the first one. 
- The same applies to previous actions. 
private void PrintActionDataAdvanced()
{
    // Access the SceneGraphModule through the MAGES Hub
    SceneGraphModule sceneGraphModule = Hub.Instance.Get<SceneGraphModule>();
    List<BaseActionData> relevantActions = new List<BaseActionData>();
    sceneGraphModule.ForEachAction(action =>
    {
        Debug.Log(action.name);
        Debug.Log(action.State);
        Debug.Log(action.ID);
        action.Effects.Effects.Clear();
        if (action.State == ActionState.Running)
        {
            // Get the count of the Game Objects this Action Uses and print the name of the first one.
            Debug.Log("Actions Game Objects Count: " + action.ActionGameObjects.Length);
            if (action.ActionGameObjects.Length > 0) Debug.Log(action.ActionGameObjects[0].gameObject.name);
            // Get the count of the next immediate actions and print the name of the first one.
            Debug.Log("Next Actions Count: " + action.NextActions.Count);
            if (action.NextActions.Count > 0) Debug.Log(action.NextActions[0].name);
            // Get the count of the previous immediate actions and print the name of the first one.
            Debug.Log("Previous Actions Count: " + action.PrevActions.Count);
            if (action.PrevActions.Count > 0) Debug.Log(action.PrevActions[0].name);
        }
    });
}