I am using following update function
bool Xpositive=false;
float XAxiscurrentXpos;
float izvalue;
Vector3 XAxisposition;
void Update()
{
if (Xpositive == true)
{
while (XAxiscurrentXpos <= -izvalue)
{
XAxis.transform.localPosition += Vector3.right * 0.01f * Time.deltaTime;
}
}
else
{
if (XAxiscurrentXpos > -izvalue)
{
while (XAxiscurrentXpos >= -izvalue)
{
XAxis.transform.localPosition -= Vector3.right * 0.01f * Time.deltaTime;
}
}
}} }`
Now, the Xpositive is changed in following code
public void ObjSupport_PositionArrived(string Coordinate, double Value)
{
switch (Coordinate)
{
case "X-":
{ //X-code }
break;
case "X+":
{ Xpositive = true; }
break;
case "Z-":
{ //code for Z } break;
}
}}
Problem is that when Bool Xpositive is set to true ,the IF in Update still is not executed.