For Some reason the for loop works in calling the other function repeated times but the if statemenst will only run once after they become true. After that they will not run again, True or Not Ever!!!
//Main Script
//Debug.Log( k);
for (var h = 0;h >= k; h--)
{
Debug.DrawRay (tempP1, -Vector3.up, Color.green,50);
if (Physics.Raycast (tempP1, -Vector3.up, hit))
{
tempObj = hit.collider.gameObject;
RoundThis( tempP1.x, tempP1.z,tempObj );
//Debug.Log( h);
}
tempP1.x++;
}
function RoundThis( p1: float,p2 : float, tempObj : GameObject)
{
//var TempInt : int = p2;
var TempRund : int = tempObj.transform.position.z;
Debug.Log(p2+" "+TempRund);//This runs ever time function is called
if(p2>TempRund)// This runs Once no matter how many times the function is called
{
Debug.Log("High");
}
if(p2<TempRund)// This runs Once no matter how many times the function is called
{
Debug.Log("Low");
}
}