Unity — Getting Started and Roll-A-Ball Project

Aman Kumar
5 min readNov 28, 2024

--

This blog will help anyone will little to no experience who is on their way learning Unity. Unity is a powerful cross-platform 3D Game Development Platform. It is one of the most popular technology out there.
This blog is a part of series of blogs on Game Development especially focussed on VR Games (GOOGLE CARDBOARD). This is the first blog in the series where we will get started by Installing Unity and Developing a Basic Game over it. You learn more by practising than by reading.
This guide assumes you have basic knowledge of programming as we won’t we discussing how the code works much.

Skip Installation Part if you already have Unity Hub.

Installation

Unity Hub

Download Unity Hub for your platform from https://unity.com/download

For Windows and MacOS, simple run the installation program.

For Ubuntu,
- Extract the Downloaded Pacakage
- Open Terminal in the extracted folder and run below code (NOTICE the Filename it may vary)

bash INSTALL.sh

Unity Hub will be installed open it

  1. Agree to the Terms of Services

2. Login or Create an Unity Account to Continue

3. Accept to Install Unity Editor.

4. Install Unity 2019.4.32f1 (LTS)

Roll-a-Ball Project

Roll a Ball is a simple game project demonstrated by Unity. Though there is video tutorials provided by Unity they are lengthy and often misses some important points or steps.

Create New Project

  1. Create a New Project under Projects Section of Unity Hub
  2. Select the Template Universal Render Pipeline
  3. Name your project “rollaball” or anything

4. Click on Create, a new Unity Editor will open with the project (It may take a while to open)

Create New Scene

  1. Click on File > New Scene
  2. A New Scene will appear in the window
  3. Click File > Save As to save the Scene

Create a Plane

  1. Click GameObject > 3D > Plane
  2. Change the Name of Plane from SidePane

Scaling Ground

  1. Click on Ground Plane
  2. You can directly feed scale in the side panel OR You can select scale from top menu and drag the axis on ground plane to change scale.

Player Object

  1. Click on Create (+) Button in Hierarchy
  2. Click on 3D > Sphere.
  3. Change Position to (0,0.5,0) [Set Y to 0.5 to make the sphere rest over plane]

Adjust Lighting

  1. Click on Sun or Directional Light in Hierarchy
  2. Click on Color in Inspector, a Color Panel will pop up.
  3. Change the color value to RGB (255, 255, 255)
  4. This changes the lighting of the scene.

Materials

  1. Create a new folder Materials, within it Create a Material from Hierarchy, you can assign colors and change smoothness independently.
  2. To Assign a material to any object, just drag n drop the material over the object in scene.

Moving the Player

  1. To move the Player object, click on the player or select it from hierarchy.
  2. Click on Add Component in the bottom of inspector for the Player.
  3. Search and Add RigidBody to it.

Now, Player Object behaves like a rigid body and physics can be applied to it.

Installing New Packages

You may need to use a new package for some functionality like Input Package to take inputs. Click on Window > Package Manager. Search Input and Install It.

Creating Inputs

1. In the Hierarchy, select the Player GameObject.

2. In the Inspector, select Add Component. Then search for and select Player Input.

3. In the Inspector, in the Player Input component you just created, select Create Actions.

4. Create a new folder named Input, and name your asset InputActions.

5. In the Project window, locate this new InputActions asset in the folder you just created.

6. Either drag the InputActions asset from the Project window to the Actions property of the Player Input component on the Player GameObject, or use the circle icon for the Actions property to select the InputActions asset.

Player Script

C# Scripts are supported by Unity

  1. Click on Player -> Add Component in bottom of inspector.
  2. Search and Click Add Script.
  3. Rename File to PlayerController and Click Add
  4. Move the Script File from root folder to Scripts Folder.
  5. Open the Script File to Edit. Update the Contents of the Script with the below code.

6. Set Speed of Player to Move in the Inspector at Bottom

6. Set Speed of Player to Move in the Inspector at Bottom

Set Speed to 10. Change it to Play a little bit.

Now, Click on the Play Button at Top Center and give input (Up Down Buttons in Keyboard). BOOM. The Game is ON.

Not Working?
- Check if the code is correct.
- Check if the script file is attached to Player GameObject.
- Check if InputActions Asset is Set in Player Input.
- Verify the speed of Player is more than zero.

If you have a Unity Team License, download below accelerator to boost your development pace.

Accelerator

Download Unity Accelerator Image from https://unity3d.com/get-unity/download/archive?_ga=2.55451755.1980313263.1636352622-1393087348.1636352622

Run below commands

chmod a+x unity-accelerator-app-v1.0.941+g6b39b61.AppImage
./unity-accelerator-app-v1.0.941+g6b39b61.AppImage

Accelerator Installation Wizard will open

  1. Press Next

2. Click on “I accept the agreement” and click Next

3. Choose the installation and storage directory and click Next

4 .Follow the next steps and click on Install.

After Installation you will send to Unity Accelerator dashboard inside the browser

Accelerator Dashboard

Hope the journey was helpful. Leave a reply below on what do you think about the blog. More blogs in the series are coming soon.

You can buy me a coffee here 😃 ☕️

--

--

No responses yet