≡ Menu
Declan Costello

Unity 3d Pong in a post errata

I had some fun putting together Pong using Unity but I also had some frustration.


Because Pong is a 2d game I had to be careful to keep everything in the same plane.

I am not a clever man

I ended up using the XZ plane to put all of the objects, which was fine but did mean I had to allow for it in any of the code.

I also kept putting things 6 units towards the camera without realising they were now in completely different planes. Especially annoying when I was trying to figure out why my collision detection trigger boxes were not working.

Nothing was colliding with them.


Unity 3d pong, should be more 2d


Once I found that problem and fixed it I thought I had successfully completed my tutorial but I still wasn’t seeing the desired result.

Once the ball passed the collision box ( the goal ) it was supposed to respawn in the centre to start the next game.

Even after fixing their position I still had nothing. There’s a small script to handle the respawn logic, and like the other scripts I was dragging it from the project to the scene view.

But for some reason this doesn’t work for the box collider script. I had instead to drag from the project to the OutofBounds objects in the hierarchy view.


Once I figured this out by way of profuse profanity I had a working, extremely basic, computer game.


Pong in slightly more than 1 post. Job Done :)

Comments on this entry are closed.