Basic


For this time, we will make an easy mechanism to switch ON / OFF at 1 second intervals.

Operating environment

This tutorial is created in the following environment.

Unity 2019.4.8f1
Arbor 3.7.0

Depending on the version, please understand that there are parts different from the explanation.

Create tutorial project

First of all, please create a project for the tutorial.

Project Name ArborTutorial01
Mode 3D
Assets to import Arbor

For information on creating projects and importing Arbor, please refer to “Preparation for using Arbor”.

Create ArborFSM object

Create a GameObject with an ArborFSM component to use the state machine.

  • Click the + button on the Hierarchy window.
  • Select “Arbor> ArborFSM” from the menu.
GIF

This ArborFSM is a component for operating the state machine.

Displaying the Arbor Editor window

To edit ArborFSM, do it in the Arbor Editor window instead of the Inspector window.

Please click on the Open Editor button in Inspector of ArborFSM to display it.

When clicked, the Arbor Editor window with ArborFSM selected is displayed.

Since you will often use the Arbor Editor window, it’s a good idea to dock it in an easy-to-use position.

Create OFF state

Since we only handle two states ON / OFF this time, we will first create two states.

  • Right-click on a blank area on the graph.
  • Select “Create State” from the menu.
  • Set the state name to “OFF”.
    *If you confirm the state name without changing it, double-click the name to switch to the input mode.
GIF

Create ON state

Continue to create an ON state.

  • Right-click on a blank area on the graph.
  • Select “Create State” from the menu.
  • Set the state name to “ON”.
GIF

About “Start state”

When you create a state from nothing, the state you created the first time becomes the “Start state”.

Start state” is the state that becomes effective at the beginning of execution.

In this case, the OFF state is set to “Start state”.

To change “Start state”

  • Click the setting icon of “Normal state”
  • Select “Set Start State”.
GIF

In this time, the OFF state is “Start state”, so there is no problem, so please change it back to the original state.

Switch state over time

Next, we will set the behavior of the state.

To add behaviors, perform “Add Behaviour” from the setting icon.

  • Click the OFF state setting icon.
  • Select “Add Behaviour”.
GIF

Here we use TimeTransition because we want to make transitions over time.

  • Select “Transition> Time Transition” from the displayed behavior selection window.
GIF

TimeTransition transitions to the state specified in “Next State” after the number of seconds specified in “Seconds” elapses.

For this time we will set the transition time to 1 second.

  • Set Seconds of TimeTransition to 1.

Then, specify “Next State” to transition to the ON state.

Transition is performed by dragging and dropping the StateLink field and connecting to the transition destination.

  • Connect the “Next State” to the ON state by dragging and dropping
GIF

Now it will transition to the ON state after 1 second has elapsed.

OFF state TimeTransition

Time Type Normal(No change)
Seconds 1
Next State Connect to ON state

For more information about TimeTransition, see TimeTransition reference.

In addition, Arbor has built-in behaviour of 100 or more beforehand, so please refer to Arbor reference for what behavior is there.

Setting the ON state

In the ON state as well, we will set it to transition over time.

Since there is a TimeTransition already set to the OFF state, copy and paste is performed.

  • Click the TimeTransition setting icon in the OFF state.
  • Select “Copy” from the menu.
GIF

Next, paste the Time Transition you copied to the ON state.

  • Click on the setting icon in the ON state.
  • Select “Paste Behaviour” from the menu.
GIF

Including each parameter of TimeTransition was copied and pasted.

I want to transition from the Time state TimeTransition to the OFF state, so reconnect the “Next State” to the OFF state.

  • Connect the “Next State” to the OFF state by dragging and dropping
GIF

This made it possible to switch ON / OFF at 1 second intervals.

ON state TimeTransition

Time Type Normal(No change)
Seconds 1
Next State Connect to OFF state

Confirm the operation so far

Let’s try once and check the operation.

  • Press “Play button” to execute.

If you look at the Arbor Editor window during execution, you can see that “Current State” switches at 1 second intervals.

GIF

However, since you can not see any change in Game View as it is, leave the Cube behind and let it look visually.

Create a Cube object

  • Click the + button on the Hierarchy window.
  • Select “3D Object> Cube” from the menu.
GIF

A Cube object was created in the scene.

Deactivate in OFF state

Use ActivateGameObject to deactivate the Cube object in the OFF state.

  • Click the OFF state setting icon.
  • Select “Add Behaviour” from the menu.
  • SSelect “GameObject > ActivateGameObject” from the behavior selection window.
GIF

When ActivateGameObject is added, make setting.

  • Press the  button of “Target” and select “Constant”.
    • “Target” uses a special type called FlexibleGameObject that allows you to select from multiple types of reference methods.
    • Since we are directly referencing the object this time, select Constant to display the object reference field.
  • Set “Target” to Cube object.
  • “Begin Active” and “End Active” are not changed and are not checked.
GIF

This makes the Cube object inactive in the OFF state.

OFF state ActivateGameObject

Target Cube object
Begin Active No check (no change)
End Active No check (no change)

For more information about ActivateGameObject, see ActivateGameObject reference.

Activate in ON state

Since we want to activate the Cube object when entering the ON state, we set it by using ActivateGameObject like the OFF state.

Again, let’s copy and paste from the ActivateGameObject in the OFF state.

  • Click on the ActivateGameObject setting icon in the OFF state.
  • Select “Copy” from the menu.
  • Click the ON state setting icon.
  • Select “Paste Behaviour” from the menu.
GIF

Copy and paste was done with the Cube object set to “Target”.

Next, set the active state in the ON state.

  • Check “Begin Active” and “End Active”.
GIF

This will activate the Cube object when entering the ON state.

ON state ActivateGameObject

Target Cube object
Begin Active Check
End Active Check

Operation check

Let’s check at the end whether the Cube object will be switched or not.

  • Press “Play button” to execute.
GIF

Now you can see that the Cube object’s activity switches at 1 second intervals.

If you also check the Arbor Editor window, you can see that the Cube object is switched normally in conjunction with the state change.

GIF

Next step

This completes the “Basic”.

“Basics” complete tweets

Next time is “Coding”.

I will explain how to create Arbor scripts.

コーディング編

Privacy Preference Center

Your Privacy

This site uses cookies to display contents and advertisements tailored to users, provide social media functions, measure advertisement impressions and clicks. We also gather information on users' site usage status and provide them to social media, advertisement distribution and data analysis partners. Each partner may use this information in combination with other information that the user provided to each partner or other information gathered when the user used the service of each partner.

Analytics, Ads