- Home /
am trying to scaling my ground size in z direction until my player is moving,
{
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
Comment
Answer by BBIT-SOLUTIONS · Apr 03, 2020 at 01:22 PM
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.
Answer by zhburr94 · Apr 03, 2020 at 03:38 PM
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
Your answer
Follow this Question
Related Questions
Unity Skew A Game Object 0 Answers
Play MovieTexture Backwards 1 Answer
Animation not working correctly 0 Answers
Unity 5.0.0f4 freezes at "Building assets for scene 0" 0 Answers