Scripts. Navigate into the newly created folder and create a new C# script. As for the name, I go with
UseGameCreatorComponents. Open the script, and delete
void Update(), we won't use them. You also need to the following
Game Creator -> Characters -> Player. Now, open the script with your chosen IDE. The script should look like the following:
<yourVariable>.GetComponent<ComponentType>()inside a method. The second one is to already specify the type you want to have for the public variable. Let's take a look:
player.IsControllable()is a method with a return value of type bool. This returns the current value of the IsControllable checkbox. You can set the value of IsControllable if you access the
characterLocomotionfield of the PlayerCharacter. There are also the fields for
faceDirectionand many more.
healthand the stat
levelfrom the Stats examples and set it to something new. For this, you need the methods
SetStatBase(). There are also many more methods to use.
Actionscomponent, but if you are curious enough, you can even get the title of the current executing action. For this tutorial, I'll only cover the topic on how to execute an action.
Actionscomponent. Then you simply do
<variable>.Execute()is also applicable on buttons , where a
OnClickevent executes certain things, and the
Call Methodsaction. You reference the actions object and select