Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Horror on January 31, 2013, 12:37:00 AM
-
Hi guys,
I'm trying to work out how I can access a global variable from playMaker in one of my scripts. I'm trying out the Geosophic leaderboards plugin but it has no playMaker support.
So basically, I have an int variable called ScoreCombineAll and I need the int score variable from my script to use that value. How would I manage this?
My expertise with this kind of scripting is... not good.
Cheers!
using UnityEngine;
using System.Collections;
public class GeosophicPostScores : MonoBehaviour {
int score = 0;
int leaderBoardSchema = 401;
void Start ()
{
GeosophicSDK.PostScore (score, leaderBoardSchema);
}
}
-
Hi,
Basically, you do the following:
using HutongGames;
...
...
...
int score = PlayMakerGlobals.Instance.Variables.GetFsmInt("ScoreCombineAll").Value;
yes?
bye,
Jean
-
Hi Jean
I'm getting this error:
Assets/Scripts/GeosophicPostScores.cs(12,21): error CS0029: Cannot implicitly convert type `HutongGames.PlayMaker.FsmInt' to `int'
Also, could you get an int variable from an FSM which is sharing the same object as the script?
Thanks!
-
D'oh, that's what you get with copy paste :)
add .Value to get to the int. like so:
int score = PlayMakerGlobals.Instance.Variables.GetFsmInt("ScoreCombineAll").Value;
bye,
Jean
-
Thanks Jean, it looks like you may have saved my arse yet again!
-
:)