{
float x = transform.localScale.z;
while (mv.enabled == true)
{
x = x + 20;
Debug.Log(x);
}
}
any idea what am doing wrong here?
every time i run the script my unity freeze and i have to restart my unity again
Looks like you are in an infinite loop.
Instead of using a while loop, you could just move the part inside the Update() function of your “mv”-script.
Or you can use a coroutine and and always yield wait at the end of the while-loop.
void Update()
{
if(mv.enabled == true)
{
transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z + 10);
Debug.Log(transform.localScale.z);
}
}
it is solved now