ParameterContainer


ParameterContainer is a component used to perform data sharing etc. between graphs.

Add ParameterContainer to GameObject and set various types of parameters.

Add ParameterContainer

Create GameObject

Click Hierarchy’s Create button, or “Create” in the right-clicked menu,
If you select “Arbor > ParameterContainer”, you can create a GameObject with ParameterContainer added.

GIF

Add to GameObject

  • Select the GameObject you want to apply.
  • Select “Menu > Component > Arbor > ParameterContainer”.
  • Or choose Inspector’s “Add Component button > Arbor > ParameterContainer”.
    GIF

Edit ParameterContainer

Add Parameter

  • Click the + button at the lower right of “Parameters”.
  • Select the type you want to add.
    GIF

Edit Parameter

  • Select name, value and edit.
  • GIF

Delete Parameter

  • Select the parameter and click the – button.
  • GIF

Type of parameter

Type Inspector Description
Int Signed 32 bit integer
Float Signed 32 bit floating point number
Bool Boolean
GameObject Reference to GameObject
String String
Vector2 2 dimensional vector
Vector3 3 dimensional vector
Quaternion Quaternion
Rect 2D rectangle
Bounds An axis aligned bounding box.
Color Color
Transform Reference to Transform component
RectTransform Reference to RectTransform component
Rigidbody Reference to Rigidbody component
Rigidbody2D Reference to Rigidbody2D component
Component Referece to Component (typable)
Long Signed 64 bit integer
Variable Parameter type that can be built by you

Abount Variable

With Variable you can create your own parameters.

For details, see “Customizing parameters with Variable”.

Customizing parameters with Variable

How to reference parameters

ParameterReference

By declaring the ParameterReference association class in the field, you can refer to the parameter.

Example script

using UnityEngine;
using Arbor;

public class TestParameterReference : MonoBehaviour
{
	public IntParameterReference intParameter;

	void Start ()
	{
		if (intParameter.parameter != null)
		{
			Debug.Log(intParameter.parameter.name + " : " + intParameter.parameter.intValue);
		}	
	}
}

When you add this script to GameObject, it becomes as follows.

Container Reference ParameterContainer
Parameter Parameters to be referred to

For the getted Parameter, refer to the script reference.

Script Reference : Parameter

ParameterReference related class

FlexibleField

Using the FlexibleField association class, you can select and reference constant values, parameter reference, or data flow input.

Example script

using UnityEngine;
using Arbor;

[AddComponentMenu("")]
public class TestFlexibleFieldBehaviour : StateBehaviour
{
	public FlexibleInt flexibleInt;

	public override void OnStateBegin()
	{
		Debug.Log("flexibleInt : " + flexibleInt.value);
	}
}

When this script is added to the state of ArborFSM, it becomes as follows.

You can change the reference method by clicking the  button at the right end of the field.

By selecting “Parameter”, you can refer to it like Parameter Reference.

FlexibleField related class

Type of constraints that reference

AnyParameterReference and ComponentParameterReference can constrain referencing types by specifying attributes.

Example script

using UnityEngine;
using Arbor;

[AddComponentMenu("")]
public class TestConstraintReferenceBehaviour : StateBehaviour
{
	[ClassExtends(typeof(AudioSource))]
	public ComponentParameterReference audioSource = new ComponentParameterReference();

	[ClassExtends(typeof(AudioSourceCurveType))]
	public AnyParameterReference audioSourceCurveType = new AnyParameterReference();

	public FlexibleAnimationCurve curve = new FlexibleAnimationCurve(AnimationCurve.Linear(0, 0, 1, 1));

	// Use this for enter state
	public override void OnStateBegin()
	{
		AudioSource source_ = null;
		Parameter audioSourceParameter = audioSource.parameter;
		if (audioSourceParameter != null)
		{
			source_ = audioSourceParameter.objectReferenceValue as AudioSource;
		}

		AudioSourceCurveType curveType_ = AudioSourceCurveType.CustomRolloff;
		Parameter curveTypeParameter = audioSourceCurveType.parameter;
		if (curveTypeParameter != null)
		{
			curveTypeParameter.GetVariable<AudioSourceCurveType>(ref curveType_);
		}

		AnimationCurve curve_ = curve.value;

		if (source_ == null)
		{
			return;
		}

		source_.SetCustomCurve(curveType_, curve_);
	}
}

Example of adding a script

Example ParameterContainer

(AudioSourceCurveType created Variable and registered it)

Available Attributes

Class Attributes
AnyParameterReference
ComponentParameterReference

It is also constrained to the Component class.

FlexibleComponent

It is also constrained to the Component class.

About GlobalParameterContainer

GlobalParameterContainer is a component to use when there are parameters that you want to keep even if you change the scene.

Addition of GlobalParameterContainer

  • Choose you want to apply GameObject
    Select “menu> Component> Arbor> GlobalParameterContainer”.
  • Alternatively, select the “Add Component button> Arbor> GlobalParameterContainer” of Inspector.
    GIF
  • Also, you can create a GameObject with GlobalParameterContainer attached from Hierarchy’s Create button “Arbor> GlobalParameterContainer”.
    GIF

Setting GlobalParameterContainer

  • ParameterContainer with parameters to be shared between scenes is created in advance and Prefabized.
  • Select GameObject to which GlobalParameterContainer is added.
    Specify Prefab of ParameterContainer created in Prefab of Inspector.
    GIF

Reference parameters via GlobalParameterContainer

By specifying GlobalParameterContainer in the Container field of ParameterReference, parameters can be referred.

Associated built-in script

We will introduce some of the built-in script.

StateBehaviour

CalcParameter Calculate and change the value of Parameter.
SetBoolParameterFromUIToggle Set the value of Toggle to Parameter.
SetFloatParameterFromUISlider Set the value of Slider to Parameter.
ParameterTransition It determines the value of Parameter and makes a transition.

Decorator

ParameterCheck Check Parameter
ParameterConditionalLoop Loop by Parameter condition.

In addition, there are many built-in scripts that get values using FlexibleField, so please refer to the reference.

Arbor Reference

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