Question by
theTrueJellyfish · Nov 05, 2019 at 06:15 PM ·
c#scripting problemscaledissapear
My GameObject disappears when running this script.
I am scaling the object and the editor says the object is scaled at either -2 or 2 but the object disappears. Could someone tell me what i did wrong.
{ public GameObject playerBody; void Start() {
}
void Update()
{
transform.position = playerBody.transform.position;
if (Camera.main.ScreenToWorldPoint(Input.mousePosition).x > playerBody.transform.position.x)
{
transform.localScale = new Vector2(0, 2);
}
else if (Camera.main.ScreenToWorldPoint(Input.mousePosition).x < playerBody.transform.position.x)
{
transform.localScale = new Vector2(0, -2);
Debug.Log("else");
//dissapearing
}
}
}
Comment
Your answer
Follow this Question
Related Questions
why did the script change 0 Answers
How to use structs in queues in C#? 1 Answer
why the Timer isn't working 0 Answers
C# suddenly no longer building on Linux 0 Answers