Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: playsteven on July 30, 2016, 09:08:06 AM
-
Hey,
I've got an array and I want to get a string value from it. What's the easiest way?
I can get the array value in to a variable, but can't work out how to convert the var to a string.
So, I've got ...
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmArray achievementAwardsScreenTextArray;
[Tooltip("The award number.")]
public FsmInt awardNumber;
[UIHint(UIHint.Variable)]
private FsmVar storeValue;
[UIHint(UIHint.Variable)]
private FsmString theString;
public override void OnEnter()
{
storeValue.SetValue (achievementAwardsScreenTextArray.Get(awardNumber.Value));
... and I need to get storeValue (which should hold a string by that point?) to theString so I can use it to set some text.
How would I do this?
Thanks in advance,
Steven
-
Just in case anybody else wonders how to get a value out of an array...
string theString = (string)(achievementAwardsScreenTextArray.Get (awardNumber.Value) );
worked for me - after 2 days of failed attempts ::)
-
Thanks for posting your solution- just saved me some time :)