playMaker

Author Topic: Accessing FSM-variables from C#?  (Read 2906 times)

Kizo

  • Playmaker Newbie
  • *
  • Posts: 7
Accessing FSM-variables from C#?
« on: August 28, 2013, 04:41:02 PM »
Hi,

Surely, this must have been asked before but it seems by search-skills are lacking...

Is there a way for me to access the PlayMaker generated variables (not global) via "normal" scripting in C#/JS?

If so, how?

Thanks,

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: Accessing FSM-variables from C#?[SOLVED]
« Reply #1 on: August 28, 2013, 05:06:46 PM »
First of all, you have to make a public/private FSM Object in your script.

Like this:

Code: [Select]
public PlayMakerFSM myFSM;
Let's say you have a bool there and want a bool IN the script to reference it, you can do something like this:

Code: [Select]
public bool animated;
Code: [Select]
void MyMethod()
{
   myFSM.FsmVariables.FindFsmBool("isAnimated").Value = animated;
}

As you see you want to use "FsmVariables" to get to yeah...the FSM Variables :D
« Last Edit: September 10, 2013, 03:03:05 AM by jeanfabre »

Kizo

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Accessing FSM-variables from C#?
« Reply #2 on: August 28, 2013, 06:07:05 PM »
Got ya! Will try that.

Mucho thanks!