Visual programming environment for all programming languages.

Create a new state-machine and execute the sample.

Create a new state machine and execute the sample.

 

Introduction.

 

This page introduces how to execute the sample when you create a new state machine for Unity.

 

This sample uses Loop and Gosub features, so it's a little difficult to use StateGo for the first time.
If so, please use this only for environment maintenance and confirmation.

 

Create a new Unity project

 

First, please create a new Unity Project.

 



 

"Assets" folder will be created just under the Unity project folder.
You will create files relating StateGo in "Assets" folder.

 

Create a new state machine.

 

1. Launch StateGo and push "Create a new state machine" button to open "new state machine creation dialog".

 

2. Select C# Unity Starter kit on the starter kit list.

 

3. Type "TestControl" as a tutorial state machine name.

 

4. Specify "Assets" folder for creating folder path.

 

5. Push "Create" button.

 




It causes StateGo Editor window. You will a sample flow.



See Assets folder on the project panel, then you will find "TestControl.cs" and "TestControl.psgg" that is StateGo data file.


 

Convert the initial sample flow.

 

Let's convert it once to see how it works.

 

Push "Save and Convert" at the bottom left on Utility panel.
Output the conversion result to "TestControl.cs".


 

Add "TestControl" Component.

 

Select "Create Empty" on Unity Hierarchy panel context menu.
It causes an empty gameobject created.

 

Name "test" the gameobject.

 

Add "TestControl.cs" to the gameobject by drag and drop.

 

Now, the preparation before execution is done.


 

Execute the sample.

 

Push "Play" button on Unity Window.
The sample just outputs logs on the console.


 

Explanation of the sample flow.

 

1. S_GOSUB : Calling "This is A Subroutine" output function.

 

2. S_LOOP : Iterate 10 times through a subroutine that examines the variables for loops and displays the even or odd number on the console.

 

What you learned.

 

You learned the followings.

 

1. How to create a new state machie for Unity.
2. How to add StateGo file to gameobject.

 

That's all.

 

 

 

 

Next tutorial

GO TOP