playMaker

Author Topic: How to Determine if an FsmVariable is assigned  (Read 997 times)

Rebooter

  • Playmaker Newbie
  • *
  • Posts: 21
How to Determine if an FsmVariable is assigned
« on: August 23, 2019, 06:13:35 AM »
In the script for an action, how do you determine if a variable has been assigned by the user?

Example:

[UIHint(UIHint.Variable)]
public FsmFloat remainingDistance;

I need to know if the user has assigned a variable to the above, or if they have selected 'None'.

Is it 'remainingDistance.IsNone'?

I'm also seeing 'useVariable' and 'usesVariable'. What are these?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How to Determine if an FsmVariable is assigned
« Reply #1 on: August 23, 2019, 08:13:05 AM »
Hi.
IsNone is the one to use.

if the variable is required you can also place [RequiredField] above it.

Then it is not necessary to check IsNone.

Code: [Select]
{ UseVariable = true };is used when you want to set default value to none.
for example :
Code: [Select]
float1 = new FsmFloat { UseVariable = true };