How to make GameObject.Find(Variable i.e 1,2,3,4,5…) work?
My object’s names are same as above, that is from 1 to 27 and i want to switch between them without using switch function. For example: if i’ll get to object named “1” then change my target to object named “2”.
Every object have a function called ToString(). This often give you a user friendly string representation of the object. In the case of the float type, it’ll give you the value in text format. Beware of decimals as decimal separators are different in different cultures though.
float value = 2;
GameObject.Find(value.ToString());