Saturday 9 February 2013

Getting Technical with Unity

Personal Development 

From Corona SDK, to Adobe Flash and now onto Unity3D. Some would say that using 3 different gaming engines is a risky thing to do to create a final project prototype within 8 months. I would have to agree, although I also see a different perspective in which I have personally gained so much by trying all three engines and slowly but surely beginning to understand the other side, namely, programming/coding. I started this semester with little Unity3D experience and being an artist with no programming experience before this project, I feel I have struggled and hit many walls so far, although at the same time learnt so much.

Corona SDK used a programming language called Lua, which was very simple to use for beginners and was quite appropriate for me, Adobe Flash used actionscipt which was also quite easy to learn. Unity uses a combination of Javascipt and C# as well as Boo Script, all of which are particularly used for 3D gaming within the industry and are of a high level. Some might also say that programming a 2D game in a 3D engine is an unnecessary hassle, I would also agree with that to a certain extent, although after a lot of extensive research on games that were developed and had systemic and aesthetic value. I came to find that certain games such as Thomas was Alone was created in Unity by a single developer, and the feel and visuals that were so clean and crisp in Unity, but most importantly the support from the community sealed the deal.

Learning JavaScript within Unity 

Just like learning a new spoken language, learning a new coding language is the same, there is a steep learning curve before you can speak or in coding, before you can actually code something yourself. Luckily, there is what seems like an infinite resource of tutorials and videos online to help when you are in need of some direction or forums and helpful professional and hobbyist who are willing to lend a helping hand. 

To start with, there is a useful tutorial online called 'Introduction to scripting with Unity', which was exactly what i was needing in order to get kick started with Unity as the bottom line is with any gaming software is that it's preferable if you know how to code, or if not that, at least understand how it works. This can also be related with learning a new spoken language, when you are in a different country (gaming engine), to get around, it is good to know some of that native spoken language (coding language for software) and if not, it is always good to be able to understand even a little bit (dictionary on hand, the basics: hello, good bye, where is the toilet).
The tutorial starts off by suggesting the aim and the requirements to fulfill the tutorial, along with a table of contents. This often reminds me that the structure of academic articles or written papers are implemented in a wide range of publications including this one, books, magazines, reports of all kinds and the writing structure you learn at university is essential in many fields of life. 

The main bulk of the tutorial teaches you the basics of getting familiar with Unity, meaning  getting used to the interface, particularly with the camera and also creating game objects such as the cube above. The tutorial also goes over a simple produced script to try and click and move the object. 

It also goes through what naming conventions are within coding which are the basics that every coder needs to learn. 

Variables: are things that you can choose or edit, such as a number or adding sounds, materials or other items. 
Functions: create the system of code, you usually call a function before you write out a block of code with specific functions. 
Classes: these create a hierarchy of functions, it's basically a grouping system for functions. 

It also goes over the various names that can replace the Update() function. Each of which has their own purpose when used within coding. A commonly used one that is similar in ActionScript is the OnMouseDown() for a mouse 'click'.

Unity Best Practices

Before starting the project, as with any project, the way you manage and plan what you are going to do within the project are crucial to the success and the speed of the projects completion. After reading several reviews online about people using unity, it was clear to me that for a whole game project, I needed to know certain things about how to keep everything in order and know where things are as well as saving time by knowing the tweaks and tricks.

I then found the following article named "50 tips for working with Unity" which can be found here: http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/

The whole article has an abundance of tips and things you should know before using Unity.

The thing that saved me from a lot of hassle was discovering how prefabs should be used for basically everyting. Let me explain why this is:

Unity Prefab: A unity Prefab is basically a grouped object which can contain any combined properties of any objects and it keeps it as one single group object. For example, if you have a game object that has  a sound playing and a black material, if you create a new prefab and drag that gameobject into the empty prefab, a prefab is created that will hold those properties and can be dragged and dropped into the game without having to recreate the object by slowly add a black material and sound onto a new game object.

The best thing about this is that it can hold everything that a game object has on it, which means you can have a prefab that has all the scripts and all the textures, materials etc etc. and they will all be saved within that prefab that can be easily coped. It is a life saver, and learning how to use this and take advantage of this early on has been a great help.

Another tip from the list of 50 that I found helpful was the organisation of folder for your game as this has always been something that I get lost in and find it hard to find my assets now and then, to see how it is meant to be done, brings about a sense of order and makes you realize that although it takes time to organize  a life like this, in the long run it will be worth it, particularly if you are working with others to clarify where certain assets are. 

This has been a great beginning to venturing into Unity and although i notice that I have a long way to go, with practice I feel I can get there and will continue to grow my technical ability.  



No comments:

Post a Comment