Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: rollingdjs on October 09, 2012, 04:41:31 PM

Title: replacing a script string with a playmaker global string[SOLVED]
Post by: rollingdjs on October 09, 2012, 04:41:31 PM
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
Title: Re: replacing a script string with a playmaker global string
Post by: jeanfabre 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
Title: Re: replacing a script string with a playmaker global string
Post by: rollingdjs on October 16, 2012, 10:54:10 PM
got it going just now. Thanks very much!