Example: Basic Elements of a Game
For this tutorial, we’re going to make a simple game of Pong. In this section, we’ll just go over arranging the core ele- ments – the scripting tutorial will come later.
First, let’s break down the game of Pong into its basic components. First, we need two paddles, and a ball. The ball flies offscreen, so we’ll want a mechanism to reset it. We also want text to display the current score, and, for the sake of showing you all the core elements of Unity, we’ll want a fancy particle effect when you hit the ball, and the whole game will need to be dramatically lit.
That breaks down into a ball object (a sphere), a spawner, two paddle props with particle emitters attached, a 3D-text entity, and a spot light. For this tutorial, we’ll be using the default physic material ‘bounce,’ with bounce combine set to‘multiply’. Here’s what the setup looks like, in ten screenshots:
First, create a cube prop for the paddle.
Scale it appropriately, duplicate it, and put a sphere between the paddles for the ball.
Then, create a 3DText object and scale and position it correctly, changing the ‘font size’ attribute to get a less pixelated image.