Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rebooter on August 23, 2019, 06:13:35 AM

Title: How to Determine if an FsmVariable is assigned
Post by: Rebooter 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?
Title: Re: How to Determine if an FsmVariable is assigned
Post by: djaydino 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 };