Starting 2d Game Development
with Unity 4.3 Native 2d tools
Who Am I?
-
Father (Always Father first)
-
Professional Software Developer (Since 2008 or so)
- All around IT Guy (Since 2003 or so)
-
Aspiring Game Developer
- Gamer
Outline
- What Is Unity?
-
Why Unity?
-
Concepts
-
Coding
-
Neat Stuff
Foolish Assumptions
You know something about programming language
WHAT IS UNITY
Unity is a cross-platform game engine with a built-in IDE developed by Unity Technologies. It is used to develop video games for web plugins, desktop platforms,consoles and mobile devices.
Made With Unity
Concepts
-
Component
- GameObject
-
Prefab
- Scene
- Asset
- Sprite
-
Scene
- Mecanim Animation
Components
A single unit of functionality often bound to a single domain.
GameObjects
Container for components
Prefab
A reusable GameObject
Asset
Any content that is in your project
-
Images
-
Scripts
-
Models
-
Audio
-
Video
- Prefab
- Scene
- Animation
- Font
Mike Bithell: The Asset Store is a path to more ambitious indie games
Sprite
Which Is A Sprite?
Pixel Art
Scene
Container for the objects in your game
Animation
Mecanim - Visual programming based animation system
Coding Concepts
- MonoBehavior
- Getting Input
- Collision Detection
- Coroutines
- Update Loop "Execution Order"
MonoBehavior
-
MonoBehavoir - The base class from which scripts are derived from
-
Contains functions that hook into the majority of Unity's "Events" including object lifecycle, Gui, Collision, User Input, Networking etc...
- Contans functions for query of gameobjects and components based on tag, layer, type, relationship etc...
Getting Input
Code Example
Collision Detection
Code Example
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Enemy")
coll.gameObject.SendMessage("ApplyDamage", 10);
}
}
Coroutines
-
Coroutine-A function that can suspend execution "yield" until a given time
-
Used for time and frame specific actions that require deferred execution
- Used a lot internally in Unity to implement the "Game Loop"
Execution Order
-
Awake Calls
-
Start Calls
- Fixed Updates (Can be called multiple times)
- Physics
- Triggers
- Collision
- Updates
- Animations
- Rendering