- Home /
UI button change variables in another script
I have a UI button, and I want:
A script with multiple strings Multiple buttons I can press to change the strings in the first script. Using a single void/ function for every button.
Thats it. How do I do it? I searched for so long, and I can't find it! Its not just regularly accessing another script, because I have multiple variables I want to change with just the one function I can reuse for the button.
Please help.
I have, but I haven't gotten an answer. And none is replying if I say the answer was not what I was looking for.
Answer by Mmmpies · Mar 08, 2015 at 02:07 PM
For one thing a void isn't the equivalent of a JS function, it's the return type. Also didn't I already tell you how to cheat this with Split ?
public void BeenClicked(string MyString)
{
string[] stringArray = MyString.Split(':');
You just need to send a string then split out the elements with a delimiter (in this example I used a colon), as long as you know what order the string comes in you can set multiple values and convert back from string to other values e.g.
myInt = int.parse(string[2]);
Assumes you have an int in the third part of the array.
PS not getting notifications at the moment, no idea why but may well miss any comments.
I think you did say something about splitting, but that was for another question. And that is not what i'm looking for. I need to know how to find a variable in another script, by "searching".