Hi. If I have an object called f.e. ‘GameObject10023’ how could I get the number ‘23’ out of it as an int? Thanks!
You want the last two digits from 5 characters (never just one, never three/more, never more than 5 characters, etc.) from the name - is that right? Try gameObject.name.Substring(3,2) and convert/cast to Int (untested)
int num;
string str;
str = gameObject.transform.name;
str = str.Substring (str.Length - 2, 2);
int.TryParse (str,out num);
print (" my number is: "+num);