- Home /
GameObject.name to array:String[]
Hi All, I a newbie - be warned and Im getting thwarted over here in my attempts to do something quite simple. Im taking a variable with the contents -"GameObject.name" which Im assuming is a string (but maybe its a sequence of characters??) and trying to strip out the words to an array using space " " as a divider for determining elements. Im having no luck.
Ive come up with the code below which throw the following error:
No appropriate version of 'String.Split' for the argument list '(String)' was found.
I know the 'offericon.name' is a 3 word value. and I want to access the second word to call another set of gameObjects which match the originals.
here is the code snippet:
if (cursorName == offeringIcon.name) {
//split the contents into a temporary array
var readString.String[]=cursorName.Split(" ");
print (readString.lenght);
print (readString[0]);
print (readString[1]);
print (readString[2]);
ProcessOffering();
response = 2; // player has correct offering
}
Your answer
Follow this Question
Related Questions
StringSplitOptions.RemoveEmptyEntries - Unknown identifier 2 Answers
issues splitting strings 1 Answer
Extract number from string? 3 Answers
how can i split a word to individual letters..?? 2 Answers
How to split a string into array? 2 Answers