Skip to main content
Skip table of contents

Generic Action

A generic action is a special type of action that vastly improves the ability to extend the flow logic. Often during a scenario specific instances of customised functionality will arise. It is for these instances we created Generic actions. Generic actions allow you to call your own methods through the graph.

A Generic Action Node

Setup

Follow these steps to set up a new Generic Action.

  1. Create a new Script that implements your intended functionality. For this example we will be logging a message

  2. Make sure the script has what ever your functionality is, but also another method that will undo this for when a user skips back over this action

C#
using UnityEngine;

public class GenericScript : MonoBehaviour
{
    public GameObject ExampleObject;
    public void Execute()
    {
        Debug.Log("I am called on Execute!");
        ExampleObject.SetActive(true);
    }

    public void Undo()
    {
        Debug.Log("I am called on Undo!");
        ExampleObject.SetActive(false);
    }
}
  1. Attach a “Generic Action” script to a GameObject.

  2. In the Generic Action Script reference the methods you created earlier.

  3. Open a graph.

  4. Right click and Create a new grab node (Actions→ Generic Action).

  5. Reference the Generic Action script we added earlier.

That's it. Now when a the action is called the generic action will be ran and in turn the execute method of our Generic Script. On undo the Undo Method will be called too.

For more information on the other inputs and outputs found on this node see Actions

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.