playMaker

Author Topic: Run FSM: InvalidCastException: Specified cast is not valid.  (Read 133 times)

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 123
    • View Profile
I have a FSM Template with an exposed string variable (like hostVariableName). I use 'Run FSM' with the template and use a variable (like float) with the convert option in the variable pulldown menu.

It gives "InvalidCastException: Specified cast is not valid." when I ran.

It's obviously easy to avoid, but it does come as a surprise and it's not super easy to find the problem unless you know that's the only thing you changed.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3618
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Run FSM: InvalidCastException: Specified cast is not valid.
« Reply #1 on: June 04, 2019, 10:09:48 PM »
Thanks for the report, I’ll see if I can repro here.
Can you copy/paste the full error.
Also what versions of Playmaker and Unity?

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 123
    • View Profile
Re: Run FSM: InvalidCastException: Specified cast is not valid.
« Reply #2 on: June 05, 2019, 05:09:07 AM »
Ah yes, sorry.
Unity 2018.3.12f1, Playmaker 1.9.0.p15 (and p7).
I was able to repro it in a new project.
Error is:
Code: [Select]
InvalidCastException: Specified cast is not valid.
HutongGames.PlayMaker.FsmVar.ApplyValueTo (HutongGames.PlayMaker.INamedVariable targetVariable) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmVariables/FsmVar.cs:671)
HutongGames.PlayMaker.FsmVarOverride.Apply (HutongGames.PlayMaker.FsmVariables variables) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmVarOverride.cs:33)
HutongGames.PlayMaker.FsmTemplateControl.ApplyOverrides (HutongGames.PlayMaker.Fsm overrideFsm) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:133)
HutongGames.PlayMaker.FsmTemplateControl.InstantiateFsm () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/CustomActionTypes/FsmTemplateControl.cs:73)
HutongGames.PlayMaker.Fsm.CreateSubFsm (HutongGames.PlayMaker.FsmTemplateControl templateControl) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1460)
HutongGames.PlayMaker.Actions.RunFSM.Awake () (at Assets/PlayMaker/Actions/StateMachine/RunFSM.cs:33)
HutongGames.PlayMaker.Fsm.Awake () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1650)
HutongGames.PlayMaker.Fsm.Init (UnityEngine.MonoBehaviour component) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1677)
PlayMakerFSM.Init () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:248)
PlayMakerFSM.Awake () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:210)