playMaker

Author Topic: How do I get the current FSM and its state in script? [SOLVED]  (Read 4566 times)

dt1000

  • Playmaker Newbie
  • *
  • Posts: 37
How do I get the current FSM and its state in script? [SOLVED]
« on: October 12, 2014, 08:17:32 AM »
Hi there.
I am currently trying to debug a particularly elusive error.

The debug messages tell me is that it happens when I use an specific PlayMaker action... but this action is used all across my project, so I thought I'd add a bit more info to the messages to help track it down.

Question:
In C#, how do I get the names of the state machine and the state that are calling an action?

If I can do that then I can generate a debug message that will send me straight to my bug!!!

Cheers,
Dan
« Last Edit: October 12, 2014, 08:30:52 AM by dt1000 »

dt1000

  • Playmaker Newbie
  • *
  • Posts: 37
Re: How do I get the current FSM and its state in script?
« Reply #1 on: October 12, 2014, 08:30:20 AM »
Solved it!

Code: [Select]
Debug.Log ("Game Object: " + Fsm.GameObjectName +"\nFsm: " + Fsm.Name + "\nState: " + Fsm.ActiveStateName);
Thanks evrybody - you've just earned a Rubber Duck Merit Badge!
http://www.nerdmeritbadges.com/products/rubberduck



 8)