function UnitSpacesMovement()
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit, 1000))
{
var coordTest : Vector3 = Vector3(Mathf.Round(hit.point.x), Mathf.Round(hit.point.y), Mathf.Round(hit.point.z));
for(var i = 0; i < getSpaces.length; i++)
if(getSpaces *== coordTest)*
-
{*
-
return;*
-
}*
-
else*
-
{*
-
getSpaces.length ++;*
-
getSpaces.Add(coordTest);*
-
return;*
-
}*
-
}*
}
This function is being called in function Update() and is storing hundreds of duplicate entries while running, can someone explain to me why this isn’t working, and why it would store so many of the same variable?