playMaker

Author Topic: replacing a script string with a playmaker global string[SOLVED]  (Read 3551 times)

rollingdjs

  • Playmaker Newbie
  • *
  • Posts: 8
I've been a little stumped on this. Trying to plug a Playmaker Global String into a C# script with not as much luck as I hoped. Currently the script has a string variable "targetAnimation", which is an public string that I can change in the Unity Editor. Now I just want it to be the same as a Playmaker global string "AnimName2" - I set it up so it would be in it's own class, and I can just send message to the script to invoke that particular method.

Unfortunately I get the error in unity "Cannot implicitly convert type `HutongGames.PlayMaker.FsmString' to `string'"

public override void Start()

   {

      base.Start();

      targetAnimation  = PlayMakerGlobals.Instance.Variables.GetFsmString("AnimName2")

   }


Is there something I'm missing here? Is the playmaker string an object maybe? I'm not quite adept at scripting enough to recognize that I might be approaching this all wrong
« Last Edit: October 17, 2012, 02:42:01 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: replacing a script string with a playmaker global string
« Reply #1 on: October 10, 2012, 01:38:56 AM »
Hi,

 yes, Fsm variables have to be accessed trhought xxx.Value

simply check out the actions shipped with PlayMaker to see its usage.

You need this:

Code: [Select]
targetAnimation  = PlayMakerGlobals.Instance.Variables.GetFsmString("AnimName2").Value
bye,

 Jean

rollingdjs

  • Playmaker Newbie
  • *
  • Posts: 8
Re: replacing a script string with a playmaker global string
« Reply #2 on: October 16, 2012, 10:54:10 PM »
got it going just now. Thanks very much!