Scenegraph Scripts

With Scenegraph Scripts you can write a custom script that calls custom methods during the initialize(), Perform() and the Undo() of an Action.

Note

An example can be the play of a custom sound through an audio controller when a certain Action Performs.

How to open

To open the scripts panel, click on the “script” icon on the top right side of an Action node.

../../../_images/manual_scripts_open.png

Main panel

This is the main panel of the Scenegraph Scripts.

../../../_images/manual_scripts_window.png

Here you can attach custom scripts and implement the needed functions to make them run when you want to

Each attached script should have the following format

public class PatientBreathing : MonoBehaviour
{
    public void ActionInitialized(BaseActionData data)
    {
        Debug.Log("Action init");
    }

    public void ActionPerformed(BaseActionData data)
    {
        Debug.Log("Action performed");
    }

    public void ActionUndone(BaseActionData data)
    {
        Debug.Log("Action undone");
    }
}

Warning

It is important to keep the same method names, otherwise they will not be invoked.

  1. The ActionInitialized() method will run after the action initialization.

  2. The ActionPerformed() will invoke after performing the Action (completion).

  3. ActionUndone() invokes when you are currently in this Action and navigate to the previous one.

Hint

With scripts you can add custom behavior to your Actions without writing additional code.