PlayerStart is used to instantiate a player character and a game GUI into a game level only when the level starts. This means that you don't need to insert player or GUI prefabs into the scene for every level of your game, all player and GUI data isn't stored into the game level data but into the project data.
PlayerStart has no parameters, simply insert it into every level of your game.
Since
PlayerStart instantiates the player and GUI only when the level starts to run, testing player or gui
gameMachines or connecting other objects of the scene to the player or the GUI is a bit different than using the traditional way.
CONNECT PLAYER AND GUI WITH OTHER LEVEL OBJECTS
When you set the player and/or the GUI prefabs into the
project configuration, the systrem automatically recognizes the name of the player character and the name of the gui object if you follow some simple rules described
here.
Once the system recognized the player and gui names you are able to connect every object (
triggers,
switches,
timers, etc...) of the level, for example by sending a message to the player or the gui, using these recognized names in the following way:
When you click, for example, on a "
receivers" parameter of an
eventTimer you will be able to select the objects of the scene that will receive the event fired by the timer, by using the following dialog box:
On the right panel there are all the objects in the scene, to pick an object select a name on the right and click on the left arrow to move the name into the left panel.
The Player Character and the GUI names (those recognised by the project configurator) are in yellow on top of the list.
TESTING PLAYER AND GUI GAMEMACHINE
Since using playerStart player and GUI object aren't into the scene their
gameMachines cannot be tested as in the usual way.
To make the player
gameMachine debug to work during in-editor
game level running you have to click on
edit->Bind Player in the
FSMGraph viewport toolbar as showed into the following image:
Once you Bind Player the player name will appear in yellow below the GameMachine green name just as if you select an object from the scene:
To Bind GUI follow the same steps but selecting the Bind GUI option from the edit dropdown menu.
| The name binding is lost if you select an object from the scene or after running a game simulation.
|