playMaker

Author Topic: ActiveStateName doesn't seem to work in Playmaker 1.3.2[SOLVED]  (Read 2137 times)

iiparra

  • Playmaker Newbie
  • *
  • Posts: 2
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.


« Last Edit: September 10, 2012, 07:57:04 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ActiveStateName doesn't seem to work in Playmaker 1.3.2
« Reply #1 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

iiparra

  • Playmaker Newbie
  • *
  • Posts: 2
Re: ActiveStateName doesn't seem to work in Playmaker 1.3.2
« Reply #2 on: September 10, 2012, 07:04:58 AM »
Hi Jean Fabre!

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