This is the first entry of weekly blog series about developing for early version of Oculus Rift SDK 0.25 version in Unity 4.x. It may seem like obsolete, especially because there’re never version of Unity SDK – however people who like to write everything by themselves and have full control on application behavior will found this course especially helpful – in it I’ve thrown away everything from SDK, asides from core dll and helpers for lens distorsion.

In this first entry we will get familiar with Unity platform and IDE interface. No more waiting – lets start!

Unity Environment Basics

We’ll begin our course with introduction to environment which makes creating Virtual Reality solutions quite simple, and (in author’s opinion) fun.

1 What is Unity?

Unity is cross-platform game engine developed by Unity Technologies. It enables creating 3D and 2D games with built-in IDE. It uses NVidia PhysX physics engine and various graphics engines (depending on platforms on which game will run).

1.1 Multiplatform

As mentioned earlier Unity allows us to create multiplatform games.

It supports:

  • Desktop operating systems:
  • Windows
  • Linux
  • MacOS
  • Mobile platforms
  • Windows Phone 8
  • BlackBerry 10
  • Android
  • iOS
  • Game consoles:
  • PlayStation 3
  • PlayStation Vita
  • Xbox 360
  • Wii U
  • Web:
  • Flash
  • HTML 5

During our training we will focus on Windows as our main game platform.

1.2 Licensing

Unity are available in two versions – Unity Pro and Unity Free.

Version Free Pro
Pricing 1500 USD or 75 USD/month
Commercial usage For organizations with annual gross revenues in no excess of 100 000 USD Yes
IDE Yes Yes
LOD Support No Yes
Video Playback & Streaming No Yes
Native code plugins support No Yes
Profiler No Yes

More information available on http://unity3d.com/unity/licenses

Also developers who wants to develop games for games consoles have to contact Unity Technologies and talk over custom licensing for each case. The same goes for gambling games and professional simulations.

2 Let’s start

Ok, so now when we’ve covered a little theory let’s go to Unity environment for a while

2.1 Get Unity IDE

Firstly, you should acquire the newest version of Unity IDE. It’s available on http://unity3d.com/unity/download. After installation you will be asked of your Unity Account – if you don’t have an account create new.

After installing it and signing to our account let’s upgrade it to 30-day Unity Pro Trial. To do so choose option Manage License from Help menu item (first right option from the application menu). A popup will appear:

Activate License window

Choose option Activate a free 30-day trial of Unity Pro and click OK. Now let’s move to creation of our first project.

2.2 Creating new project

From application menu choose File and then Create a new project. Creation wizard will appear – right now you can choose root folder for project and import some Unity assets. It is not necessary for now so you can leave them unchecked (you can also re-import them after creating project).New Project wizard window

At the bottom of the wizard there is also an option to change project default settings from3D game to 2D. Let’s leave it with 3D.

3 Introduction Unity Interface

With our project created let’s learn a little bit about IDE interface.

Unity IDE UI

3.1 Menu items

Default menu items consist of:

  • File – standard one J Here you can create new scenes/projects or open them. From here also you can change build settings
  • Edit – besides boring options like Cut or Paste here you can change Project Settings, Preferences and Network emulation
  • Assets – creating, importing assets and packages, also synching with MonoDevelop
  • GameObject – creating and modifying GameObjects
  • Components – managing Components added to GameObject
  • Window – managing UI layout of Unity
  • Help – licensing and stuff

Some of the options have key shortcuts visible on the right. I propose remembering some of these:

  • Ctrl+Shift+N – Creates new empty GameObject
  • Shitf+F – Focuses view on selected object (equals to double clicking on object in hierarchy)
  • Ctrl+D – Duplicates object
  • Ctrl+Shift+C – Opens debugging console

3.2 Windows

As you already noticed our workspace is consisted of several windows which may be organized using layouts (described later) or manually by dragging and dropping. We have such windows as:

  • Scene – responsible for displaying and operating on game objects in virtual world. It will be described in more detail later
  • Inspector – in this window there are displayed properties of the selected object. Here we can change its components and their properties. Here also are displayed project and renderer settings when we choose them from menu.
  • Hierarchy – hierarchy of game objects in the scene organized as tree.
  • Project – folder hierarchy organized in tree and contents of selected folder.
  • Game – here is displayed rendered scene so we can preview the game itself with no need to build it.

It’s of course not all regarding the Unity windows but we’ll look at the rest a little bit later.

3.3 Layouts

As mentioned earlier we can move freely windows and dock them as we wish in Unity. We can also use predefined layouts which are accessible in dropdown Layout at the top right corner of the Unity window. We can also save our current layout choosing Save layout… option.

While using large monitor I like 4 split layout because it shows 4 Scene windows, each one set to different orientation.

4 Project settings

Project settings allow us to change general application/reality settings. E.g. we can change gravity force, default bounciness of the material, add/remove layers and tags, set quality settings for different platforms etc.

4.1 Source control

Very important thing in developing anything is source control – in this case sending project source after changes to repository which enables going through changesets, revert committed code etc. By default some of the data files generated by Unity are kept as binary files. While it lowers overall disc size of the projects these file are impossible to track and merge in most common source control engines. To change it we should go to Project Settings and choose Editor Settings. Here we can change Assets Serialization to Force Text – from now on all assets files will be transformed to text format.

Another important thing of source control, especially when working with someone else, is to set ignore list – list of files or paths which should not be sent to repository. Ignore list for typical Unity project should contain:

  • Files with sln, userprefs, csproj, pidb, unityproj, .DS_Store extensions – these should be generated per team member working on project
  • All files under {Proj_Name}/Library/cache/ | previews/ | ScriptAssemblies/ and {Proj_Name}/obj/ | temp/ – files in these folders are temporary and are generated when project is build or opened in Unity






4.2 Input

Though we may bind some code to normal keys like ‘A’, ‘Shift’ etc. it is nice to have application with re-bindable keys. That’s why in Unity we can use custom input codes like ‘Fire1’, ‘Jump’. We can set default key bindings for them in Project Settings -> Input. Here we can also set alternative key, sensitivity and other properties.

Next part, about Scene in Unity >>>