Day 2- Making 2D Space Shooter Game
The GameObject is the most important thing in the Unity Editor. Every object in your game is a GameObject. A GameObject is also a container; we have to add pieces to the GameObject container to make it into a character, a tree, a light, a sound, or whatever else you would like it to be. Each piece is called a component.
Since it is so important while working with unity, you need to know to know how to work with it.
You can add a new GameObject through the GameObject tab. Let’s say you created a cube as your GameObject and it is going to show inside your scene view and your Hierarchy.
So how are you going to manipulate your GameObject to match the properties or shapes you wanted, its easy
Here, if you select the hand tool on the top, you can move around your scene view and its shortcut key is ‘q’
If you select the second tool which is a move tool, you can now move the GameObject in all three axes. It can be handy when you are creating your game design to move around your GameObjects. Its shortcut key is ‘w’.
If you want to rotate your GameObject then you can use the rotate tool the third from the left. This will allow you to rotate your GameObjects in all three axes. Its shortcut key is ‘e’.
You can also scale your GameObject using scale tool which allows you to scale your GameObject in all three axes by dragging while left clicking on each axes individually or you can left click on the central box and scale all three axes at the same time. Its shortcut key is ‘r’.
You can also scale your GameObject using Rect tool. This tool is used to scale your UI elements or a 2D GameObject. Its shortcut key is ‘t’.
Finally, there is a combination of all three move, rotate and scale tool all as one tool. It is best not to use this tool if your are a complete beginner to unity. Its shortcut key is ‘y’.
We now know how to scale, rotate and move the GameObject but what if we want to make it look good. To make our gameobject look good, we can add what we call a material which basically defines how gameobject looks in your game. We can go to project at the bottom, right click, got to create and select Material to add to the GameObject.
You should name the material with a professional naming convention for easier search in the future by adding _mat after your material name just like ‘cube_mat’ in the image above. You can edit the material as you like from the inspector and you can add the material in your GameObject by dragging the material directly into your GameObject in the scene view or you can drag it in the gameobject in the Hierarchy. You can use whichever feels easier to you.
All of the changes you made to the GameObject are being updated in the Inspector so be sure to check that out while you make changes as well.