Why is the Paddle invisible and off-center when the game starts?

When I start the game, the paddle goes invisible for some reason. I checked its Z position (-12) and it’s adequately far enough from the background and everything to be visible, and it wasn’t having this problem until I used the paddle script.

Another thing is that it’s off-center. The sprite’s pivot is set to ‘center’, so shouldn’t it be right in the middle? A lot of stuff went haywire when I set up this script.

One more thing to note is the paddle still has collision, and the X coords show that I’m moving it around and won’t go past 0.5 or 15.5, so that part seems to work.

I am experiencing this same issue. It appeared when i added Mathf.Clamp to the code. The paddle was visible before that.
Edit: I found the cause of the issue in my case. I was setting the initial z-coordinate in paddlePos as this.transform.position.y instead of position.z. Just a typo, may not be the same issue you are facing.

I tried replacing ‘y’ with ‘z’ in the paddle script. Unfortunately, it didn’t work, but thanks for helping.

I have no idea how anyone can learn programming, though. It’s the most complex and mystifying thing I’ve ever experienced - tried for years to get the hang of it and it just feels impossible.

Privacy & Terms