Download presentation
Presentation is loading. Please wait.
1
Unity Game Development
Creating an Interactive Character
2
Class overview Unity User Interface Lighting C# Variables Functions
Code grouping Creating & adding scripts to GameObjects Time.deltaTime Rigidbody CharacterController Input Prefabs Audio & Importing Assets
3
Unity User Interface Creating 3D Objects Move, Rotate, Scale
Inspector Window & Scene Hierarchy Adding components Creating Materials
4
2. Scene View 1. Scene Hierarchy 3. Inspector Window 5. Game View 4. Project Window
5
1. Tools 3. Application Actions 4. Active Axis 2. Selected Object Axis
6
Lighting Using lighting to create atmosphere (Omni light, Directional Light, ...)
7
C# Programming language developed by Microsoft
Used for AI, Game logics, … Code in Microsoft Visual Studio Used in Unity3D
8
Variables name “John Doe” name
string Variable: Something that stores information playerName health <variabletype> <variablename> = <variablevalue> Modifying a variable: “John Doe” name string
9
Functions Function / Method: A group of code that can run
SaveGame DoDamage Functions execute code once each time the function is called Function body: Calling a function:
10
doubles <value>
Functions void OnHit() void OnHit(int damage) Function just executes Function executes AND Needs Input int GetEnemyCount() int DoubleValue(int value) Function executes AND Function executes AND returns value needs input Code inside the function reduces health by <damage> Code inside the function reduces health int int Searches the map for enemies and returns the # Code inside the function doubles <value> and returns it int int
11
Code Grouping In C#, all code is grouped, and sub-grouped.
For this we use curly brackets. { = opening curly bracket } = closing curly bracket MyGame Program MyFunction MyOtherFunction
12
Creating & adding scripts to Game Objects
Start, Update (+ Awake, FixedUpdate, ...) OnTriggerEnter, OnTriggerExit Instantiating & Destroying GameObjects from scripts Accessing variables from the Editor (public, private, serializable)
13
Time.deltaTime Time.deltaTime = time between updates
Update() has a variableTime.deltaTime FixedUpdate() has a fixed Time.deltaTime 5 FPS = 5 Frames per Second 60 FPS = 60 Frames per Second
14
Rigidbody Collisions & Triggers Physics using Rigidbody & AddForce
OnTriggerEnter and OnTriggerExit
15
Character Controller Using a Character Controller to control and move a character
16
Input Detecting PlayerInput (Mouse movement and Key presses)
17
Jumping logics Applying gravity constantly vs. Applying gravity at a variable intensity
18
Prefabs Creating assets for instancing and updating scene
19
Audio & importing custom assets
Playing sounds / Music using AudioSource and AudioClips
20
Q&A Do you have any questions related to the topics mentioned?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.