“Paddle” does not appear on the game screen!
Whatever I do, it doesn’t show up on the screen in any way.
it disappears when I add this code. transform.position = paddlePos;
“Paddle” does not appear on the game screen!
Whatever I do, it doesn’t show up on the screen in any way.
it disappears when I add this code. transform.position = paddlePos;
Hi Zrw,
Welcome to our community!
Is the z-position of the background set to z = 10?
[SerializeField] float speed = 5f;
new Camera camera;
Start() {
camera = Camera.main;
}
Update(){
Vector3 paddlePos = camera.ScreenToWorldPoint(Input.mousePosition);
paddlePos.z = 10f;
paddlePos.y = transform.position.y;
transform.position = Vector3.Lerp(transform.position, paddlePos, speed* Time.deltaTime);
}
I meant the background. See its Inspector.
The paddle must be set to z = 0f.
Oh now i see whats problem. He added all game objects to canvas. Should Unparent everything exept EventSystem.
Well spotted, @111100. I completely missed that.
Only UI elements like Image, Text and Button (and other UI elements) must be parented to a Canvas. SpriteRenderer is not a UI element, thus is may/should not be parented to a Canvas.
help me?
Unparent all siblings from canvas
Did you set the z-position of your paddle to 0? Is the z-position of the camera set to z = -10, the background to z = 10, and the rest to z = 0?
Please share screenshots, so we can see what you currently have in your project.
While in play mode, pause the game and switch your scene view over to 3D mode and that will tell the tale if you paddle is hiding behind something.
This topic was automatically closed after 14 days. New replies are no longer allowed.