Anda di halaman 1dari 28

Unity

Geraldo Nascimento
Plumbee 2014

Introduction
Unity is a Game Engine
In constant development, multitude of
plugins available on the Asset Store
Before official 2D support, alternative was a
mix of frameworks and workarounds

Unity
Built with Mono
UnityEditor is built with (mostly) the same C#
API used to make games in Unity
Output to Web (plugin), iOS, Android
and soon WebGL

Unity
IL2CPP: an AOT compiler and VM
Their own implementation of the CLI
Claim 2x, 3x performance uptick over their
usage of Mono
Not about recreating .NET or Mono
toolchain, will still use Mono C# compiler

Entity Component System


Entities

GameObject

Ex: Soldiers, Bingo Cards, Card Numbers

Components
RigidBody
(Physics)

Properties

Transform
(Position, Size, etc)

MonoBehaviour
(Scripts)

Movement

x, y, z
scaleX, scaleY, scaleZ

Stored collection of Components and Properties

Daub

isDaubed

Prefab

ExampleMonoBehaviour.cs
void Start()
void Update()
void OnDisable()

Basic Workflow
Drag and Drop assets into
Scene, creating GameObjects
Specialize GameObjects with
Components
Set properties on Components
Problematic for teams larger
than 2

Basic Workflow - Problems


Scenes are problematic for version control, since they
are basically binaries
Solutions and workarounds: heavy use of prefabs,
view scenes as prefabs interacting (have a prefab for a
whole UI, for example)
Lack of visibility for engineers

Design Patterns
MVVM
Model - C# class
View Model - MonoBehaviour
View - GameObject

Design Patterns
Dependency Injection
To avoid using GameObject.Find or static classes
Already a number of frameworks:
StrangeIoC
Zenject

Zenject Context example


public class Context : MonoBehaviour
{
public Root root;
public void RegisterBindings(DiContainer container)
{
container.Bind<Root>().AsSingle(root);
container.Bind<IDependencyRoot>().AsSingle<GameRoot>();
container.Bind<GameModel>().AsSingle();
container.Bind<SceneModel>().AsSingle();
container.Bind<CluesModel>().AsSingle();
container.Bind<PlayerGenerator>().AsSingle();
}
}

Art Integration
High artist input is encouraged
Artists can work with Unity on a daily basis, design the
UI and tinker
They dont need an engineer to build the game, so they
can test their changes themselves

UI System
Official Unity UI recently released
Visual design driven
Artists and designers can implement their
designs directly

Animations

Unit Tests
Compatible with any C# unit testing frameworks
UnityUnitTesting: open source package to visualize unit test
results within the Unity Editor
MonoBehaviours are impossible to test (they cant be
instantiated) - Solution: separate logic from MBs
UnityTestTools allows testing GameObjects within live
scenes

Dependency Management & CI


Maven plugin
Create C# libs for general purpose functionality (server
comms, etc)
Automated builds for iOS, Android, etc
AssetBundles: dynamically load new content

Facebook
Facebook worked together with Unity to
solve security concerns of logging into
Facebook through Unity
Facebook officially branded WebPlayer
installation flow

Native Plugins
Similar flow to AIRs native extensions:
build native functionality in Objective-C, Java
Prime31: one of the top Unity native plugins
suppliers, theyve made Purchases,
Facebook and others

Case Study: Samurai Siege

Case Study: Samurai Siege

Case Study: Samurai Siege


6 month development time
Feb - July 2013, soft launch Australia & New Zealand
3 months polish, global launch October 2013
Team had no previous experience with Unity

Conclusion
Impetus to use Unity is speeding up our game
development process
Speed up asset integration by allowing artists to work
directly on the project
Speed up game prototyping and testing of ideas (ex:
prototype a new feature in a day, then spend a couple of
weeks implementing)

Conclusion
Although heavily oriented by visual design, there are
solutions to allow higher degree of visibility and control
of the project to engineers
Posit: faster art integration, more time for engineers to
work on new features, optimization
Viability for Mobile is proven, Web is still to be seen

License
Unity Pro

iOS Pro

Android Pro

Total

One-off per
version (4.x, 5x)

1500$
per developer

1500$
per developer

1500$
per developer

4500$
per developer

Subscription

75$
per month
per developer

75$
per month
per developer

75$
per month
per developer

225$
per month
per developer

Reference
IL2CPP: http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-in-unity/
Design Patterns for Unity:
https://docs.google.com/document/d/
1Kja6ZSBaG0Fl4WyBklPSUDLmjCo8jilDGkhW3dOxF2c/pub
Samurai Siege:
http://www.pocketgamer.biz/asia/feature/59222/clash-of-alliances-the-makingof-samurai-siege/
http://www.gamasutra.com/view/pressreleases/217015/
SAMURAI_SIEGE_SURPASSES_12_MILLION_REVENUE_IN_FIRST_SIXMO
NTHS.php

Reference
Unit & Integration Testing
https://github.com/catburton/UnityUnitTesting
http://blogs.unity3d.com/2013/12/18/unity-test-tools-released/
http://blogs.unity3d.com/2014/06/03/unit-testing-part-2-unit-testingmonobehaviours/
New UI System
http://blogs.unity3d.com/2014/05/28/overview-of-the-new-ui-system/
Jenkins plugin: https://github.com/jenkinsci/unity3d-plugin

Anda mungkin juga menyukai