What why and how? Telerik School Academy Unity 2D Game Development
1. Part 1 1.Intro to Unity 3D and 2D Game Development 2.Basic Math for 2D Game Development 3.2D Graphics and Animations 2. Part 2 1.2D Physics Engine 2.Game Scripting with C# 3.UI and Audio 3. Part 3 1.Building a 2D Game 2
1. What is Unity 3D 2. The Editor 1.Project Browser 2.Hierarchy 3.Inspector 4.Scene View 5.Game View 3
3. Building blocks of Unity games 1.Scenes 2.Cameras 3.Game Objects 4.Layers & Tags 5.Components 6.Scripts 4
The famous game engine
Unity 3D is Unity 3D Unity 3D Cross-platform game engine Web Desktop Mobile Free or Paid Supports C# and JavaScript Has own IDE (Visual Studio support) Visual Studio supportVisual Studio support Can be used for both 3D and 2D games 6
The game engine is Built on Mono Mono Has built in Physics for both 2D and 3D Has everything but the kitchen sink (“От пиле мляко“ in Bulgarian) Best games built on top of Unity Hearthstone by Blizzard Hearthstone Endless Space Endless Space Endless Space More here: 7
Its own IDE
Project Browser Project Browser Project Browser Contains the file structure of your game Contains textures/sprites Contains code scripts files Contains animations Contains other resources 9
Hierarchy Hierarchy Contains all game objects in the current scene Can contain “folders” When objects are added or destroyed they will be shown here Supports drag’n’drop Double click shows the location of the selected object 10
Toolbar Toolbar Contains functionality for transforming the game objects Contains “Play”, “Pause” and “Stop” Transform tools – moving, rotating and scaling 11
Scene View Scene View Scene View The sandbox of the game world Works in three dimensional coordinates (x, y, z) Can be set to 3D or 2D mode (z-axis is ignored) Used to position every game object Player Enemies Background Camera 12
Game View Game View Game View Shows the started game How it will look when it is built Can be used to fine-tune the game Starts in seconds Allows drawing of so called Gizmos 13
Inspector Inspector The most used part of the IDE Allows you to edit all parameters of game objects Allows you to add components to game objects Parameters can be changed runtime to test the game 14
Organizing the workspace Organizing the workspace Organizing the workspace Every window can be drag’n’dropped Every window can be made separate You can use the predefined layouts or create your own From the window menu you can add other windows Console Animation and Animator Others 15
Useful hotkeys Useful hotkeys Useful hotkeys Q - Pan W - Move E - Rotate R - Scale T - Rectangle Tool V - Vertex Snap CTRL/CMD+LMB - Snap 16
Publishing builds Publishing builds Publishing builds First go to “File” – “Build settings” Web Player PC and MAC Android iOS Consoles Then go to “File” – “Build and run” 17
What makes it tick?
Scenes Contains the current “level” world of the game Contains all the game objects in current use Scenes are also all other screens Main menu Loading screen Game over screen Other Used with cameras to show part of the world 19
GameObject GameObject “GameObject” – “Create Empty” Everything in your game is GameObject The background, the player, the enemies, the effects, the camera Consider the GameObject as an empty container of different components A single GameObject does not do anything special – it has only Transform component Different GameObjects have different components as “ingridients” 20
GameObject GameObject Empty objects have Name, Tag, Layer and Transform Transform Transform Describes the position of the object in the game world Position – Unity uses Cartesian coord. system Cartesian coord. systemCartesian coord. system Rotation – Unity uses Quaternions Quaternions Scale – scale on x, y, z – value 1 is original 21
Other Components may be Camera components Animation components Physics components Script components Other Each script is just a regular component First compiled Then attached to the object 22
Name – for the developer Tags Tags You can mark objects with tags For ex. “Player”, “Enemy”, “Collectible”, etc. Easier to filter later in the scripts Layers Gives the ordering in front of the camera One object on top of the other Static GameObject – for less calculations Static GameObject Static GameObject 23
Prefabs Prefabs Prefabs Your own prebuild objects with all the needed components Think of it as a factory for certain objects You can easily create prefabs and then use them all over the scene When you change a prefab, you change all instances at the same time You can have prefab variations 24
Prefabs Prefabs Prefabs Create folder “Prefabs” and drag an object there You can create new instances with drag’n’drop from the “Prefab” folder to the scene In the “Hierarchy” all prefabs are colored in blue You can choose an object and break its prefab connection with “GameObject” – “Break Prefab Instance” 25
Camera Camera Camera The camera shows part of the world to the player It is normal object, so it can be easily moved with the Transform component Each camera shows what is “in front” of it Two types of cameras Perspective – used mainly in 3D mode Orthographic – used mainly in 2D mode 26
Camera Camera Camera The camera height is always predefined The camera width depends on the resolution The size parameter of the orthographic camera is half the height You can set it in the inspector To get the width you need simple math with the aspect ration of the screen width = height * ScreenWidth / ScreenHeight 27
Unity is a powerful game engine Has its own IDE Project Browser, Hierarchy, Inspector Scene and Game views Building blocks of an Unity game Scenes Game Objects and Components Prefabs Camera 28
форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен SEO курс - оптимизация за търсачки уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop уроци по програмиране и уеб дизайн за ученици ASP.NET MVC курс – HTML, SQL, C#,.NET, ASP.NET MVC безплатен курс "Разработка на софтуер в cloud среда" BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране, книги – безплатно от Наков безплатен курс "Качествен програмен код" алго академия – състезателно програмиране, състезания ASP.NET курс - уеб програмиране, бази данни, C#,.NET, ASP.NET курсове и уроци по програмиране – Телерик академия курс мобилни приложения с iPhone, Android, WP7, PhoneGap free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране
C# Telerik Academy csharpfundamentals.telerik.com csharpfundamentals.telerik.com Telerik Software Academy academy.telerik.com academy.telerik.com Telerik Facebook facebook.com/TelerikAcademy facebook.com/TelerikAcademy Telerik Software Academy Forums forums.academy.telerik.com forums.academy.telerik.com