Hey there, the following piece of JavaScript code requires a string for the GameObject.Find(“a string”) and I have tried to convert an integer variable to a string so it can be used, but I still get the error message saying:
Assets/Main_02.js(28,44): BCE0017: The best overload for the method ‘UnityEngine.GameObject.Find(String)’ is not compatible with the argument list ‘(int)’.
meaning its still putting in an integer, int.
Could someone please look at my code bellow and tell me whats wrong with it, its probably something realy stupid but i’d be realy grateful, Thank You.
if(Input.GetButtonDown(“Jump”)){
var Y = new Array();
var i:int = 1;
var x:int;
while(i<10){
x = i;
x.ToString();
var other = GameObject.Find(x);
Y.Add(other.transform.position.y);
i+= 1;
}
}