Developing 2D & 3D Games with Unity
for Windows
Meet Adam Tuliper | @AdamTuliper
• Technical Evangelist, Microsoft
– Focused on Gaming, Cloud, and Web Technologies
– Emphasis on secure development practices
• 20 years of industry experience as software architect
– Enterprise, startups, public sector, defense, healthcare, financial, gaming
– channel9.msdn.com/Blogs/AdamTuliper
• Video content
– adamtuliper.com
Meet Dave Voyles | @DaveVoyles
• Technical Evangelist, Microsoft
– Focused on Gaming, Cloud, and Web Technologies
– Based out of Philadelphia & Baltimore
• 4+ years of gaming industry experience
– Author: Unrealscript Gameplay Programming Cookbook
– Worked on Xbox 360 & One at Comcast
– davevoyles.azurewebsites.net
Course Topics
Developing 2D & 3D Games with Unity for Windows
01 | Intro & Unity Overview 06 | Optimizing your games
07 | Application Lifecycle Management
02 | 2D Game Development
(ALM) in Unity
03 | 2D & 3D Asset Creation 08 | Marketing and Monetization
09 | Using prime[31] to connect your Unity
04 | 3D Game Development
game to Azure
05 | Building for the Windows Platform 10 | Adding the finishing touches
Setting Expectations
• Target Audience
– Beginner & Intermediate Unity Developers
– C# Programmers
• Suggested Prerequisites/Supporting Material
– C# Fundamentals for Absolute Beginners
• http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-
absolute-beginners
– Digital-tutors.com (great Unity content)
Join the MVA Community!
• Microsoft Virtual Academy
– Free online learning tailored for IT Pros and Developers
– Over 1M registered users
– Up-to-date, relevant training on variety of Microsoft products
• “Earn while you learn!”
– Get 50 MVA Points for this event!
– Visit http://aka.ms/MVA-Voucher
– Enter this code: 2D3Dunity (expires 10/10/2014)
Microsoft’s investment for indie game devs
• One year free Prime31.com plugins for Microsoft
• Acquired SyntaxTree (UnityVS.com) and released for free
• BizSpark – program for startups in over 100 countries
– Bizspark.com or contact your local evangelist
– Free Visual Studio, Windows, $150 a month to Azure for VMs, web
sites, and cloud services, and lots more. Over $30K more.
• Unity Offers
– Unity3d.com/pages/windows/offer Check often!
– Bring a cool game to windows, get cool stuff
Click to edit Master
subtitle style
01 | Intro and Architecture
Adam Tuliper | Technical Evangelist, Microsoft
Dave Voyles | Technical Evangelist, Microsoft
Module Overview
• Intro & Interface
• Game Objects and Components
• Prefabs and Packages
• Architecture
Click to edit Master
subtitle style
Intro & Interface
What is Unity
• Unity is
– A game engine and ecosystem
– Supports more platforms than any other publically available tool
– Used by hobbyists & students, up to major studios
• Unity is not
– A 2D image or vector graphic creation tool (photoshop, gimp)
– A 3D modelling environment*
• It does have a built in terrain system
• Also supports third party plugins that enable some 3D modelling (ProBuilder)
Features/Capabilities
• AAA Game Quality
• Editor for scene (level) assembly & in-editor game play
• Physics
• Programming with C#, JavaScript, Boo
• 2D & 3D Support
• Audio
• Particle Effects
• Animation Systems
Asset Store
• Near everything you need for a game
Its all about the scene
• Think of a scene as a level
• Game is a collection of 1->many scenes
• Scenes are included in build
• Can have many test scenes not in final build
• Remember this icon
DEMO
Exploring Unity’s Interface
Click to edit Master
subtitle style
GameObjects & Components
GameObjects are everything
• Near everything in a scene is a GameObject
• The System.Object of Unity Lights
• Simply name, tag, transform
• Transform is very important
Particle
3D Models
Systems
GameObject
HUDs Sprites
Components make things happen
• GameObjects come to life via Components
• Includes
– MeshRenderers
– SpriteRenderers
– Audio
– Cameras
– Physics behavior
– Particle systems
– Scripts (your code)
DEMO
GameObjects & Components
Click to edit Master
subtitle style
Prefabs and Packages
Prefabs and Unity packages
• Prefabs allow reuse across (and within) scenes
– Objects will turn blue in hierarchy
• Update .prefab = update every instance in project scenes
• Unity packages allow reuse across projects
– Asset store downloads are actually .unitypackage files
– Can be imported just by double clicking
DEMO
Prefabs and Packages
Click to edit Master
subtitle style
Architecture
Unity’s Architecture
• Major Components
– Editor
– MonoDevelop
– Game Engine
• Editor
– Can play test game (play mode)
– Can extend easily
Project Structure
• Assets
– Always top level folder shown in Unity Editor
– Every file you bring into your project, prefabs, art, audio, and more.
• Library
– Local cache for imported assets & metadata for assets.
• ProjectSettings
– Stores settings from Edit->Project Settings
• Temp/Obj
– Used for temporary files during the build process from Mono and Unity
Compilation
• In the Editor
– Mono is always used to compile scripts
– Compilation in editor may be different than final build
– What works in game may be different in end build
• Your exported Visual Studio Project
– Assemblies generated by Mono or .NET
• Your game
– Compilation varies per platform. Different APIs supported.
Multiple levels of compilation
Platform Editor Assemblies Game Assemblies Final compilation performed by
Windows Phone 8 Mono Mono Visual Studio/.NET
Windows Store Mono .NET Visual Studio/.NET (WinRT)
Windows Standalone Mono Mono Unity - Generates .exe + libs
(.exe)
Windows Phone 8.1 Mono .NET Visual Studio/.NET (WinRT)
Programming Model
• Game Loops are per GameObject
• Most major c# constructs, features, types valid
– Lambdas, events, LINQ, anonymous methods, classes, etc
• Do I have to code?
– No – check out PlayMaker, Behave, RainAI
Physics Engine
• 3D physics engine NVIDIA® PhysX® Physics
– Is it any good?
• Licensed by Unity, Unreal Engine 4, Gamebryo, Vision, Instinct, and more
• 2D physics via Box2D
– 2D physics generally much faster
– Is it any good?
• Used by Unity, GameMaker, Construct2, and more
The generated projects & compilation passes
Project Path Used Description
in
Pass
Assembly-CSharp.csproj 3 All other scripts not inside folder
called Editor
Assembly-CSharp- 1 Scripts in folders under /Assets
firstpass.csproj called Standard Assets, Pro
Standard Assets and Plugins
Assembly-CSharp-Editor- 2 Scripts in folders called Standard
firstpass.csproj Assets/Editor, Pro Standard
Assets/Editor and Plugins/Editor
*-.vs projects n/a Can be added to Visual Studio for
editing code and debugging*
Assembly-CSharp- 4 All other scripts inside a folder call
DEMO
Coding, Physics, and Particles
©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.