- Home /
gameobject is flashing each time it moves
i have wrote below code in Update() method to move up my game object. But its flashing(moving back and front) each time it moves. how can I fix it?
transform.Translate(Vector3.up * Time.deltaTime * speed);
Your code works as expected. I need to see the rest of the script to find out what's going on.
there is no any code in update method except that I wrote in question. I am working on 2d screen and also I tried to Vector2.up but nothing changed. Do you have any idea? @Ossi101
thats not causing that behaviour, share the full script or make sure no other scripts are making that behaviour
Answer by xxmariofer · Jul 28, 2019 at 08:48 PM
it is printing fine but with some lag spikes, i bet you have a camera script that maybe movetowards or lerps towards the player, following him, and gives that effect
ah yes! in camera script update method I do
transform.position = new Vector3(0f, car.gameObject.transform.position.y, -10f);
this code. how can I fix it? when I clear this code block then it works. @xxmariofer
its working now. if you send it as answer I will be accept it. thank you so much!
Your answer
Follow this Question
Related Questions
Touch and move in any axis 0 Answers
Why is this Raycast not working ? 3 Answers
Don't move unless in BoxCollider2D (C#) 1 Answer
HOW stop object rotation when a another is not moving 0 Answers