playMaker

Author Topic: Get FSM variable problem  (Read 1632 times)

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Get FSM variable problem
« on: April 25, 2020, 04:24:42 PM »
As per title: I have set a GET SCENE NAME state and a GET SCENE BUILD INDEX.
The variables are set obviously on STRING and INT.
 
In two other FSMs I have set a GET FSM VARIABLE, and I selected ADD VARIABLE to get it working.

In both the FSMs, this doesn't work: they both feature a FLOAT value, and if I try to change it, it will lose the connection to the GET FSM VARIABLE action.

Also: I can't understand why all those lines pop up in the menus. Is that ok?



And this is the console error when I launch the game:

InvalidCastException: Specified cast is not valid.
HutongGames.PlayMaker.FsmVar.GetValueFrom (HutongGames.PlayMaker.INamedVariable variable) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmVariables/FsmVar.cs:595)
HutongGames.PlayMaker.Actions.GetFsmVariable.DoGetFsmVariable () (at Assets/PlayMaker/Actions/StateMachine/GetFsmVariable.cs:92)
HutongGames.PlayMaker.Actions.GetFsmVariable.OnEnter () (at Assets/PlayMaker/Actions/StateMachine/GetFsmVariable.cs:46)
HutongGames.PlayMaker.FsmState.ActivateActions (System.Int32 startIndex) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2771)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2718)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2643)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2787)
HutongGames.PlayMaker.Fsm.Update () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1995)
PlayMakerFSM.Update () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:594)


From the error, it seems that the get scene data actions are not working correctly.
In fact, when I launch the game, the state shows them with default values: 0 and empty string. The actions don't fill the variables.
Is it possible? This doesn't seem possible... I am sure these actions have been used over and over...

I am on Unity 2019.3.11f1.
« Last Edit: April 25, 2020, 04:45:56 PM by megmaltese »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Get FSM variable problem
« Reply #1 on: April 26, 2020, 09:28:04 AM »
Up!  ::)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get FSM variable problem
« Reply #2 on: April 26, 2020, 09:45:58 AM »
Hi.
What unity / playmaker version are you on?
Also did you upgrade from older unity / playmaker versions.
if so can you remember the oldest version you started with.


The lines issue i got as well and i know now how they occur

When you expose a variable in the inspector (checkbox) and then remove the action it creates a line.(local, not sure for global)
if you remove the inspectors 'check' before you remove the action it does not happen.

Maybe better to use Get Fsm String / Float?

With variable i think it works similar to array, if you set a type it wont change, you probably need to remove the action and place a new one.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Get FSM variable problem
« Reply #3 on: April 26, 2020, 10:19:12 AM »
Thank you for the answer.
This project started on Unity 2019.2.
I recently moved it to 2019.3.11.

I tried to delete and remake all the FSMs of this system.

I didn't see that there are GET FSM STRING and other variables straight away... guess I'll try with that and it will work.

Still confused on what's the scope of GET FSM VARIABLE then...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get FSM variable problem
« Reply #4 on: April 26, 2020, 03:05:31 PM »
Hi.
Custom variables for exampe :)