Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: iiparra on August 28, 2012, 04:37:07 AM

Title: ActiveStateName doesn't seem to work in Playmaker 1.3.2[SOLVED]
Post by: iiparra on August 28, 2012, 04:37:07 AM
Hello!

I am trying to use a PlaymakerFSM in a script. I have some FSMs in a GameObject and in one of them some states, fully functional.

My question is: Can I use PlaymakerFSM.ActiveStateName to capture the active state name string?

It doesn't seem to work, because in debugger it appears as "", and the activestate as "null". The state is active because is green in play mode. I don't know why. Am I doing something wrong?

Thank you very much!

My Playmaker vesion is 1.3.2.


Title: Re: ActiveStateName doesn't seem to work in Playmaker 1.3.2
Post by: jeanfabre on August 29, 2012, 02:53:12 AM
Hi,

 it works. I think it's simply that you don't get the right reference.

Code: [Select]
using UnityEngine;
using System.Collections;
using HutongGames;

public class test : MonoBehaviour {

public PlayMakerFSM fsm;

public string activeStateName;



// Update is called once per frame
void Update () {
if (fsm!=null)
{
  activeStateName = fsm.ActiveStateName;
}

}
}

create that script ( c# script ), and drag the fsm you want to watch in the public property "fsm" and you'll then get the activestate in "activeStateName".

bye,

 Jean
Title: Re: ActiveStateName doesn't seem to work in Playmaker 1.3.2
Post by: iiparra on September 10, 2012, 07:04:58 AM
Hi Jean Fabre!

Thank you for your reply. Yes, it was a reference problem, solved!