Game Development with Unity and C#

52
By Shahed Chowdhuri Senior Technical Evangelist Game Development with Unity and C# Windows Web Xbox Mobile @shahedC WakeUpAndCode.com

description

Game Development with Unity and C#. Windows  Web  Xbox  Mobile. By Shahed Chowdhuri Senior Technical Evangelist. WakeUpAndCode.com. @shahedC. Agenda. My Background. Online: http://facebook.com/OnekSoftGames. My Background (continued). Video: http://youtu.be/lRjrQPvVOpo. - PowerPoint PPT Presentation

Transcript of Game Development with Unity and C#

Page 1: Game Development with Unity and C#

By Shahed ChowdhuriSenior Technical Evangelist

Game Development with Unity and C#Windows Web Xbox Mobile

@shahedC

WakeUpAndCode.com

Page 2: Game Development with Unity and C#

AgendaBackground + Intro

> UI Basics & Assets> Moving Around> Scripts & Animations> Transitions, Colliders & Triggers

Graphics & Audio, Wrap-Up

Page 3: Game Development with Unity and C#

My BackgroundPeriod Background/Experience1997 – present

Microsoft web/software development

2011 XNA games on XBLIG• 2D Math Panic• Angry Zombie Ninja Cats

2012 Tools for XNA developers• XBLIG Sales Data Analyzer (OnekSoftLabs.com)• XNA Basic Starter Kit (CodePlex)

Online: http://facebook.com/OnekSoftGames

Page 4: Game Development with Unity and C#

My Background (continued)Period Background/Experience2013 • Ninja Cat Runner on Win8, WP8, Web (Construct2)

• Video Q&A with MS Tech Evangelist Frank La Vigne• Founder/Admin of FB groups: Construct2, Xbox One & Unity Indie

Devs• Attended ID@Seattle, Microsoft’s first ID@Xbox summit

2014 • Public Speaking on Indie Game Development• Joined Microsoft as a Technical Evangelist• Attended ID@Chicago• Working with Kinect v2

Video: http://youtu.be/lRjrQPvVOpo

Page 5: Game Development with Unity and C#

Official Xbox Magazine

Source: Official Xbox Magazine, March 2014, Page 65

`

Page 6: Game Development with Unity and C#

Tools & Technologies

Page 7: Game Development with Unity and C#

Unity: Things to Know

• Learning curve• Create/Import models• Download/purchase models• Asset Store• Publish virtually anywhere!

Page 8: Game Development with Unity and C#

Agenda

Background + Intro

> UI Basics & Assets> Moving Around> Scripts & Animations> Transitions, Colliders & Triggers

Graphics & Audio, Wrap-Up

Page 9: Game Development with Unity and C#

UI Basics & Assets

Page 10: Game Development with Unity and C#

Creating a New 2D Project• Click File New Project • Select an empty folder

• Select 2D in the dropdown• Click the Create button

Page 11: Game Development with Unity and C#

Editor Settings for 2D

• Click Edit Project Settings Editor

• Verify 2D Mode is the default

Page 12: Game Development with Unity and C#

Unity UI: Scene, Hierarchy & Project Assets

Page 13: Game Development with Unity and C#

Unity UI: Animation and Game Panels

Page 14: Game Development with Unity and C#

2D Overview

• Collider 2D & Physics 2D (instead of Collider & Physics)• Sprite Renderer, Sorting Layers• Game Objects and Scripting!• Mecanim for sprite sheets

• 2D is just 3D in orthographic view

Page 15: Game Development with Unity and C#

Customizing Your Editor UI• Hierarchy• Project• Scene

View• Game

View• Console• Animator• Animatio

n• Inspector• Layers

Page 16: Game Development with Unity and C#

Importing a SpriteDrag into the scene

Note: Create Prefabs to reuse instances of an object in your scene.http://docs.unity3d.com/Manual/Prefabs.html

Page 17: Game Development with Unity and C#

Textures and Sprites• Each texture can have sprites

• Set the position/rotation/scale in the Inspector

Page 18: Game Development with Unity and C#

Background Import Settings

Page 19: Game Development with Unity and C#

Sorting Layers

• Lock Layers• Add Layers via Sprite Renderer

Page 20: Game Development with Unity and C#

Moving Around

Page 21: Game Development with Unity and C#

Sprite Editor

Page 22: Game Development with Unity and C#

Adding Components

Page 23: Game Development with Unity and C#

Adding a Sprite Renderer

Page 24: Game Development with Unity and C#

Adding a New Script (C#/JS/Boo)

Page 25: Game Development with Unity and C#

Start() and Update() in your Script

Page 26: Game Development with Unity and C#

Built-in Input Controls

Page 27: Game Development with Unity and C#

Updating Objects via transform.position

Page 28: Game Development with Unity and C#

Running Your Game

Page 29: Game Development with Unity and C#

Scripts & Animations

Page 30: Game Development with Unity and C#

Animation Clips• Create New Clip, Curves, Keyframes

Page 31: Game Development with Unity and C#

Adding Sprites From a Sprite Sheet• Drag sprites as a group or individually

Page 32: Game Development with Unity and C#

Adding Curves Manually• Change values manually for each

keyframe

• Create multiple animations, view one at a time

Page 33: Game Development with Unity and C#

Loop Time for Animations

Page 34: Game Development with Unity and C#

Transitions, Colliders & Triggers

Page 35: Game Development with Unity and C#

Animator Tab• Create transition from between

animations

• Right-click a state to Make Transition• Add parameters and set values

Page 36: Game Development with Unity and C#

Conditions• Click a transition to edit in Inspector

• Set Conditions for selected Transition

Page 37: Game Development with Unity and C#

Linking Events to Keyframes• Right-click a keyframe to add animation

event• Or select keyframe, and click []+ icon

• Select function from your code, set parameters

`

Page 38: Game Development with Unity and C#

Custom Colliders

Page 39: Game Development with Unity and C#

• Use OnTriggerEnter2D and OnTriggerExit2D in code

Enabling Triggers in 2D Colliders

Page 40: Game Development with Unity and C#

Swapping Colliders at Runtime

Called from Keyframe events

Page 41: Game Development with Unity and C#

• Use a script to control positioning behaviorUsing Empty Objects as Spawn Points

Page 42: Game Development with Unity and C#

Updating Gravity Settings

• Set Y to 0 (zero) for top-down 2D games

Page 43: Game Development with Unity and C#

Agenda

Background + Intro

> UI Basics & Assets> Moving Around> Scripts & Animations> Transitions, Colliders & Triggers

Graphics & Audio, Wrap-Up

Page 44: Game Development with Unity and C#

Graphics For Your Game

Commercial• Adobe Illustrator• Adobe Photoshop

FREE!• Gimp• Paint.net

Page 45: Game Development with Unity and C#

Audio Tools

• FL Studio: http://www.image-line.com/flstudio/ • Free demo, buy to access all features

• Audacity: http://audacity.sourceforge.net/ • Free, open-source

Page 46: Game Development with Unity and C#

Useful Links• This presentationhttp://WakeUpAndCode.com/downloads

• Zombie Conga Tutorial, by Chris LaPollohttp://www.raywenderlich.com/61532/unity-2d-tutorial-getting-started

• Unity Tutorials: http://unity3d.com/learn

• Free Assets: http://codefoster.com/media

Page 47: Game Development with Unity and C#

For More Info:• Xbox One Indie Devs:

• http://facebook.com/groups/XboxOneIndieDevs• http://WakeUpAndCode.com/xb1

• Unity Indie Devs:• http://facebook.com/groups/UnityIndieDevs • http://WakeUpAndCode.com/unity

Page 50: Game Development with Unity and C#

Official Unity 5 Feature Preview Trailer (jump to 2:10 for 2D)https://www.youtube.com/watch?v=dk8gpz0o5TU

Unity 5 Preview

Page 51: Game Development with Unity and C#

AgendaBackground + Intro

> UI Basics & Assets> Moving Around> Scripts & Animations> Transitions, Colliders & Triggers

Graphics & Audio, Wrap-Up