Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: dt1000 on October 12, 2014, 08:17:32 AM

Title: How do I get the current FSM and its state in script? [SOLVED]
Post by: dt1000 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
Title: Re: How do I get the current FSM and its state in script?
Post by: dt1000 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 (http://www.nerdmeritbadges.com/products/rubberduck)

(http://cdn.shopify.com/s/files/1/0031/3912/products/nmb-rubberduck_medium.jpg?v=1289503831)

 8)