Invoke Member

Describes how to invoke a member of any type.

Here, as an example, explanation is given assuming the use with ArborFSM.

InvokeMethod

Invokes methods and sets values for fields and properties.

Reference : InvokeMethod

Add InvokeMethod

  • Click the state gear icon and select “Add Behaviour”.
  • Select “Events / InvokeMethod”.

InvokeMethod settings

  • Click the “Add New Event Type” button and select the timing you want to invoke.
  • Click the “+” icon of the event to add invoke member data.
  • Set type and member.
  • Set <Target>.
    • If it is a Unity object, it can be set with FlexibleField.
    • For other types, it is accepted by input from the data flow.
    • No setting items for static members.
  • Set the argument value.

GetValue calculator node

Gets the value of the field or property and outputs it to the data flow.

Reference : GetValue

Add GetValue

  • Right-click on the graph and select “Create Calculator”.
  • Select “Events / GetValue”.

GetValue settings

  • Set type and member.
  • Set <Target>.
    • If it is a Unity object, it can be set with FlexibleField.
    • For other types, it is accepted by input from the data flow.
    • No setting items for static members.
  • Connect the value output slot.

Refactoring

If you want to change the name of the type or member you are calling, you can use the RenamedFrom attribute to associate the new name with the old name to avoid broken references.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
using UnityEngine;
using Arbor;

[RenamedFrom("Player")]
public class Character : MonoBehaviour
{
	[RenamedFrom("TakeDamage")]
	public void InflictDamage(int damage)
	{
		// ...
	}
}

The old name must include the namespace.
It is not necessary when defining in the global namespace such as the above example.

Managed code stripping

Because member calls are made using Reflection, managed code stripping settings may cause the called member to be removed as unused code.

Please set the Preserve attribute and link.xml file so that the callee code is not deleted.

For more information, see Managed code stripping in the Unity Manual.