playMaker

Author Topic: Nubie help - accessing a FSM variable from an external script  (Read 1506 times)

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Hi

Help for a nubie.

What am I missing?  I am trying to learn how to access FSM variables from unity scripts.

I am setting the variable "URL" with a value of "www.google.com" in an FSM called "FSM1".

The next FSM called "FSM2" calls a script/method to print its value in the console.

Here is the scripts code I am trying to get to work:

Code: [Select]
#pragma strict
var currentURL : String;

function Start () {

}

function Update () {

}

//called from FSM inside
function SetUrl(URL:String)
{
currentURL=URL;
print(gameObject.name+" url is set to "+currentURL);

}

I have tried setting URL to a global variable (no joy) and as a private variable (again no joy). 

I am pretty sure that I am not referencing properly but am at a loss as to how to access and manipulate FSM variables by scripts.

Cheers

Lost.