Unity Development – “It tastes like chicken”

That’s what we say when we try a new protein. We compare it all to chicken, something we are used to. This is the power of metaphors to bridge the gap between what we know and are familiar with and the next piece of information we encounter.

Take learning math for instance, as children we are taught to think about math concepts visually by comparing the concepts of addition and subtraction to our own experiences of having and not having. Abstractions allow us to build mental models to understand complex concepts and as students of computer science we are no strangers to abstraction.

As a web developer by training and trade I began to see the parallel abstractions between how a web developer builds a site on a browser and how a game developer builds an experience in Unity.

In web development there are three main pieces one must understand to build a basic website or application: HTML, CSS, and JavaScript.

HTML are the building blocks of UI. In HTML there are semantic tags that describe the architecture of a page, like headers, p (paragraphs), sections, etc. Conversely, in Unity we have objects that we can drag into the scene.

View of Unity UI

Observe, the screenshot above. The Altar object is something I defined myself from an “empty object”, the equivalent of that is using divs, which is like a catch all in web development, the opposite of semantic in the web is semantic organization in Unity. In Unity we can label the empty objects to create a semblance of organization.

Types of GameObjects that can be added to a scene

Now that we have objects in the scene, how do we alter them to fit our aesthetic and desired experience? In the web we would use CSS or Cascading Style Sheets. A style sheet language used to define how a piece of UI should look and then rendered by the power of the browser, this is why in different browsers the default styles may appear different. Each browser understands some style rules differently. Like regional dialects, per se.

In Unity, the styles are appended to the object in the Inspector panel (on the right side).

The Inspector Panel
Using the Inspector Panel on a Particle System GameObject to make FIRE

In CSS we can define the height/width of our 2D website objects, in Unity, we can define our objects by the 3 axes when building 3D experiences. We can add physical properties like collision, animation, textures/materials and our JavaScript equivalent… Scripts!

Finally, Scripts. Scripts are what make a visual experience into an interactive one. Scripts allow us to move a camera and call it a player. Scripts allow us to play sounds when a certain event takes place. Scripts allow us to add or remove objects from the scene when we create an inventory.

Scripts powering the menu screen
Inventory System instance with script attached
Sample code for InventorySystem

Unity has an additional level of configurability that we might not find on the web. Whereas the Unity application is akin to our web browser environment, we can’t quite alter the browser, that is up to the Firefox, Google, or Apple devs in the world. However, in Unity, we can add scripts to extend the Editor itself which is powerful and interesting, see example:

Inventory Item Data is a type of asset I defined

Ultimately, developing in Unity is a natural extension for those who have worked in other visual development be it on desktop, web or mobile. It is challenging and has nuances that might feel new but that are built upon abstractions we have come to know and understand over time. If you’re interested in Unity/Game Development, I hope you give it a try and that eventually it starts to taste like chicken (or an equivalent protein alternative for my vegan friends), too.

PS: This is a repost from a blog I am keeping for my capstone course at OSU online.

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s