Professional Documents
Culture Documents
Autumn 2016
3. Game architecture case
Unity game engine
Juha Vihavainen
University of Helsinki
Outline
Basic concepts and architecture of Unity
On origins/developments of Unity
Unity as an integrated development environment (IDE):
Unity world/level editor and its major user interfaces
. . .
Unity basics
Unity is a multi
multi--platform development tool
platforms include:
include: desktops,
desktops, mobile devices,
devices, web pages,
pages, consoles
Unitys visual editor has several sections that work together
build/edit scenes/levels,
scenes/levels, editing of a selected game object (in
inspector pane)
scripts are attached to objects as special kinds of components
components,, and
executed by a hidden game loop
a Unity project is represented by a folder
C# scripts are edited and processed by a separate programming
environment (MonoDevelop
(MonoDevelop/Visual
/Visual Studio); UnityScript by a
suitable text editor
interactions/processing between different sections (views) is
mostly automatic, e.g., updating settings change visuals
6.12.2016 Juha Vihavainen / University of Helsinki 6
On history/developments (2005 -> )
Started 2005 as a Mac
Mac--based tool developing for Mac and Windows
Windows--based version available 2009 (Unity 2.5)
Windows
Unity 3.5 (Feb 2012), new Shuriken particle system, HDR, etc.
Unity 4 (June 2012): Mecanim animation system (bought
(bought),
), Direct
DirectX11
X11
support, Ubuntu platform, etc.
Unity 4.2 (July 2013): Android, iOS, Windows Phone 8, etc. were
included with the free license; dyn. shadows w/ one-
one-directional light
Unity 4.3 (2013) added complete native 2D tools (instead of 3rd-
3rd-party
2D tools), blendshape facial animation, among others
In July 2013, reached over 2 million registered Unity users
(downloads)
In March 3, 2015, the release of Unity 5.0 had improvements in
shading techniques, lighting, audio, animation, WebGL (soon), etc.
6.12.2016 Juha Vihavainen / University of Helsinki 7
Applies Composite
Composite,, Component
Component,, Prototype
Prototype,, Game Loop, Update
Method plus other design patterns in its design and implementation
to make a "persistent
"persistent"" object: call DontDestroyOnLoad (object)
A game object is a essentially a container for components
A component is something to be attached to a game entity, describing
some property, capability, behaviour, or relationship
created independently but always attached to some game object
can be separately removed and destroyed
A script is a special kind of component that defines the behaviour of a
game object; the same script class can be "attached" to multiple
gameobjects, and multiple scripts can be attached to the same object
6.12.2016 Juha Vihavainen / University of Helsinki 11
6.12.2016 14
Editor screenshot: Toolbar
Toolbar,, Scene
Scene,, and Game
Hierarchy Project
Inspector
Running game
6.12.2016 Juha Vihavainen / University of Helsinki 17
Hierarchy view:
the initial
contents of the
scene
6.12.2016 19
AddComponent (type)
GetComponent (type) : Component
Can be enabled/disabled
Object.Destroy (obj)
childCount Light
parent
GetChild (index):Transform;
AudioListener
materials
AudioSource
(shaders)
Note. Not
identical.
Initialization in the
Inspector overrides
initialization in the
script code
6.12.2016 Juha Vihavainen / University of Helsinki 23