What is Unity?w3.impa.br/~vitorgr/livecode2019/slides/unity-4-music.key.pdf · Authoring...

Preview:

Citation preview

Unity for Music Lovers

Luiz VelhoIMPA

1

What is Unity?

• Game Engine

• Media Platform

• Authoring Tool

2

Media Engines

3

Engine System Architecture

4

Media Platform

+

5

Features

• XR (Extended Reality)

• UI (Interactive User Interface)

• Lighting / Real-Time Rendering

• Spatial Audio

• Physics

• Animation

6

Authoring

• Development Environment (IDE)

- Unity Editor

• Programmable

- Unity Scripting

• Extensible

- Unity Packages and Plug-Ins

7

Workflow

1. Create a Project

2. Import Assets

3. Develop the Game

4. Test / Refine

5. Build / Deploy

8

Unity Project

9

Unity Editor

10

Assets

11

The Asset Store• Free / Commercial Assets

12

Asset Packages

• Importing

13

Asset Browsing

• Asset Window

14

Assets and Scenes

Standard Assets Scenes

15

Concepts

• Scenes

• Game Objects

• Components

16

Unity Scenes

17

Game Objects

18

Component• Component Adds Functionality to Game Object

• Unity Components

19

Game Development

• Build Scene

- Create Game Objects

• Test / Debug

- Play and Interact

20

Building Scenes

21

Test / Debug

22

Unity Programming

23

The Script Component

24

Scripting

• C#

• Developed by Microsoft (.NET)

• Object Oriented

• Component Based

25

Language Elements

• Variables

• Control Structures

• Functions

• Classes

26

VariablesVariables● Various Data Types

○ bool, char, byte, float, double, int, string, …● Public vs Private keyword● Pass by reference: use ref instead of &

Example:public int playerHealth=5;

27

Control Structures

• Execution Flow

- if then else

• Loops

- for

If Statementsif (m > 10){ //do something}else{ //do something}

For Loop

for (int i = 1; i <= 5; i++){ Debug.Log(“hello”);}

28

Functions

• Called Methods in C#Functions (called methods in C#)

● allows us to compartmentalize and reuse code effeciently

public int SquareANumber(int number){ return number * number;}

29

Basic Unity Functions

• Awake()

• Start()

• Update()

• FixedUpdate()

• LateUpdate()

30

Start / Update• Run Automatically during PlayBasic Functions

void Start(){ //called once. do any initialization here}void Update(){ //called every frame. move objects here}

31

Adding Animation Behaviour

32

33

Questions?

34

Recommended