Create → GameCreator → Developer → Actionand give the text file created a suitable name.
IAction. To create a custom Action you don't need to know how they work. All you have to do is fill in the methods and you'll be good to go!
Executeis called whenever an action is executed. Let's break down its structure and explain how it works.
IEnumeratortype. This is because this method is a coroutine. A coroutine works as any other function, except that it can halt its execution waiting for a value or for an amount of time. This is perfect for Actions as it allows to halt the execution independently of the cause.
GameObject invoker: References the invoker of the Action.
IAction actions: An array containing the full set of instructions
int index: The index of the current Action in the previous parameter
ActionLookAtAndWait. What it does is to make the
objectAasset look at the
objectBand wait 0.5 seconds before resuming the execution.
NAME. This property gives the Action a name in the Action's selection dropdown list. Just change the name and you're good to go.
NODE_TITLE. This one is used in the method
GetNodeTitle()which returns a string containing the description of the Action shown in the Inspector.
OnDisableEditorChild()are called when the Inspector containing this Action is focused/unfocused. It's a good place to initialize the properties used in the
OnInspectorGUI()is where the thick code goes. It is called every refresh frame. It should always start with
serializedObject.Update()and finish with
serializedObject.ApplyModifiedProperties(). Between these two lines you should show the serialized version of the properties.