Trying Out Unity For Game Development

Michael Chen
4 min readOct 25, 2020

Backstory

For the past month, I started to dabble into game development and it’s been more satisfying building the game than playing games itself. As a lifelong gamer, being able to learn what goes into developing a game has been eye opening. I remember the first time I played Donkey Kong Country as a kid, I was immediately hooked - the movements, sounds, animations, controls, levels, graphics, and challenges had me chasing high scores and speed running levels. 20 something years later, games have gotten so much more advance and my passion for software engineering has got me very interested in game development.

I started my game development journey with Phaser 3 because it was a JavaScript framework and that was one of the languages I’m most comfortable with. It was great for creating low level HTML5 games on the browser and mobile, but it was lacking in power. That’s where Unity comes in — a very powerful 3D game engine with a huge community and a ton of free resources to get started. I think another huge benefit for learning Unity was learning c# along with it. What’s a better way to learn a new language than to have fun building games?

Setting up

Unity is free for personal use.

After selecting a plan, it prompts you to create a Unity Id (account). Download the Unity Hub then download a version of Unity.

2019.4.14f1 is the long term support version

Unity does have a lot of features so expect a huge download file. All the added components came out well over a few gigs of storage.

A lot of the tutorials and courses for Unity recommends using Visual Studio as the ide but I found Visual Studio Code with Unity and c# extensions to be just as viable.

The Unity workflow:

Create Scene > Add GameObjects > Create Scripts (.cs files) > Edit Script with text editor > Attach script to GameObject

In a basic game, we have scenes that are used as a container for the game environment, menus, game objects, obstacles, and decorations (and pretty much anything that you see on the game screen). You can think of scenes like individual levels of a game where each scene has different environments and objects, or it could be main menu screens, game over screens, etc.

The GameObject in unity is the most important concept to learn. Every single object in the game is a GameObject, from characters, NPCs, weapons, trees, cameras, and audio sources. The GameObject itself doesn’t do much yet, you have to add components or scripts to it.

A script is a c# file that looks like this:

There are two functions that got generated in the script boilerplate: Start() and Update().

  • Start() is used to initialize the GameObject, an example would be giving a Car object the behavior of engine noises and lights turning on.
  • The Update() function is where you can handle frame updates for the GameObject. An example would be giving the Car object the ability to steer left, right, gas, break, trigger actions, respond to user input, etc.
The car game object has a script attached to it.

Final Thoughts

So far, my overall impression with Unity has been a positive one. The difference in power between a JavaScript game framework like Phaser and a fully featured 3D game engine like Unity is huge (I linked a comparison below). I do think there is a slight learning curve with this platform, but the same can be said about any game framework. Also, Unity can be used to build games on multiple platforms like console, pc and mobile. It can even build virtual reality and augmented reality games. Thanks for reading my early impressions blog about Unity, I can’t wait to explore this engine more and share the things I learn.

Resources

--

--