Wprowadzenie do unity

24

Transcript of Wprowadzenie do unity

Page 1: Wprowadzenie do unity
Page 2: Wprowadzenie do unity

Unity3D - What is this ?● 3D game engine (recently also 2D)● Graphics, physics, sounds, ● Works for any type of game.● Scripts written in C#, JavaScript, Boo (? :D )● Desktop, mobile platforms, consoles,

webplayer

Page 3: Wprowadzenie do unity

Advantages of Unity3D● Indie version is free● Supports DirectX9, DirectX11, PhysX● Easy to learn● Enormous support of community

(UnityAnswers, Asset Store)

Page 4: Wprowadzenie do unity

Briefly about Unity3DEditor window

Page 5: Wprowadzenie do unity

Editor window

Page 6: Wprowadzenie do unity

Scene Hierarchy Scene 1 Scene 3Scene 2

GameObject1 GameObject2

GameObject4

GameObject3

Component 1

Component 2

Component 3

Component 4

Component 1

Page 7: Wprowadzenie do unity

Briefly about Unity3DComponents

Page 8: Wprowadzenie do unity

Transform

● Position, rotation, scale● Part of every gameobject, info about hierarchy ● All sorts of translations, rotations etc. in scripts

Page 9: Wprowadzenie do unity

Mesh renderer, mesh filter● Information about this

model and shader used to draw it.

● Mesh Filter just stores info about mesh

● Mesh Renderer draws the model

Page 10: Wprowadzenie do unity

Material, Shader

Page 11: Wprowadzenie do unity

Rigidbody● Basic physics● Mass, gravity, forces● Collision handling

Page 12: Wprowadzenie do unity

Collider

● Collision detection● Types: box, plane, sphere, mesh, capsule● Triggers

Page 13: Wprowadzenie do unity

Light

Page 14: Wprowadzenie do unity

Types of lights in Unity Point light Area lightSpotlightDirectional light

Page 15: Wprowadzenie do unity

Particle engine

Page 16: Wprowadzenie do unity

Scripting in Unity3DWhere the fun begins… :D

Page 17: Wprowadzenie do unity

Using C# in Unity● Scripts are builded by Mono● Most of .NET functionality is available.● Delegates, properties, extended methods, LINQ, ...● You can use MonoDevelop or Visual Studio

Page 18: Wprowadzenie do unity

About scripts in overall● Scripts are components● Each script is a class● Public fields are seen (and changeable) from

the inspector.

Page 19: Wprowadzenie do unity

MonoBehaviour Class● Awake(), Start(), Update()● GetComponent<T>()● Instantiate()● Invoke()● Coroutines and “yield”● GameObject.Find()● OnGUI()

Page 20: Wprowadzenie do unity
Page 21: Wprowadzenie do unity

GUI● Current ways of creating GUI:

○ GuiTexture, GuiText, GuiLabel components○ OnGUI scripting○ … or buy a plugin :D

● New (way better) GUI system is announced. When ? Soon...

Page 22: Wprowadzenie do unity

Some of Unity plugins● Touchscript - touch gestures● GoKit - “tweening” (moving objects)● NGUI - GUI creation● Marmoset - Image-based lighting● Photon integration - networking

Page 23: Wprowadzenie do unity

ExamplesLet’s dive into scripts ;)

Page 24: Wprowadzenie do unity

Q/Aflame wars ? :D