c# script
private GameObject GameObjSeen = new GameObject[50];
void Update()
{
foreach(GameObject Obj in GameObjSeen)
{
if(Vector3.Distance(Obj.transform.position,transform.position) > 60)
{
int i3;
i3 = System.Array.FindIndex(GameObjSeen,Obj);
GameObjSeen[i3] = null;
}
}
}
unity told me that:
Argument #2' cannot convert UnityEngine.GameObject’ expression to type `System.Predicate< UnityEngine.GameObject >’
and that:
The best overloaded method match for `System.Array.FindIndex(UnityEngine.GameObject, System.Predicate)’ has some invalid arguments
what should i try?
replace i3 = System.Array.FindIndex(GameObjSeen,Obj as GameObject); with i3 = GameObjSeen.indexOf(Obj);
– JChilton