Unity Course Notes

From Wikicliki
Jump to: navigation, search

Debbie's own notes on a Unity course I am taking towards the Unity Certification.

Contents

Lesson 1 - Welcome to Unity Certified Developer Courseware

Conducted by Koh Siang Leng, 5 Sept 2020, 10am

Unityhublts.png

Note how some versions in unity hub have LTS and some do not.

Are you irritated cos unity updated and everything BROKE? Use version of unity LTS "Long term support" - a version which does not accept any new features but will be supported for about 2 years.

Also remember to have a 3 button mouse.

Economics of Games

Unityunity.png

Unity has its own ad platform which makes it easier for a developer to integrate advertising for monetisation. Analytics is used extensively in mobile gaming too. Should be integrated in from the very start... (How?)

Monetise in the form of...

  • Physical Purchase
  • Download
  • Subscription
  • Freemium
  • In game purchase
  • Advertising

Game Genres to think about...

  • Action
  • Adventure
  • Arcade
  • Fighting
  • Non-Game (<-- probably me)
  • Platformer
  • Puzzle
  • Racing
  • RPG
  • Shooter
  • Simulation
  • Sports
  • Strategy
  • Survival
  • Open world etc

Game Design Document and Technical Design Document

  • For small company - the document is nice to read but in practice sometimes along the way people do not update along the way as they are building and playtesting the game.
  • For big company - there is probably a dedicated team doing this all day, that's their job to make the roadmap updated all the time!

Game Production Pipeline

Step 1 Pre-production

  • Create the game design document and technical design document

Step 2 Production

  • Implementing assets and creating game play
  • building the game for release

Step 3 Maintenance

  • Fixing bugs and releasing patches
  • Incremental functionality improvements

Step 4 Upgrade

  • Building and releasing new content
  • Major additions and mods, such as new levels, seasonal content, special release (like upsize of your happy meal - it is easy to upsell when they are always interested in your product)

Job Roles

Unityjobroles.png

THEY WILL TEST THIS IN THE EXAM. take note on art director vs concept artist in particular.

  • Concept art = provides unifying point for art direction (hence commonly confused with art director role)

Getting Started / User Interface

Install the IDE

Set up the interface in an ergonomic way

Unityinterfaceorgsuggested.png

Can even put inspector on its own on a 3rd col on the right.

Creating Game Object

Creategameobject.png

Child & Parent Objects

Creategameobjectchild.png

Tagging

Tagginggameobject.png

  • What is the purpose of tagging? (common question in unity exam) - We say its used to find gameobjects (not grouping). It doesn't matter to Unity what is the gameobject tag. Its for the developer to find items with same tags.

Importing from Asset Store

Importzombie.png

GameObject Settings

Linkspritesheet.png

Transform (moving)

You can be precise about the position you move in Inspector

Transformunity.png

Importing Packages the right way

Importcustom.png

  • Often there are clashes with basic assets like main camera, you can overwrite them all usually and ignore the warning.

Arranging Prefabs

  • (Mac) Command-D to copy, Command drag to drag with snapping (Ctrl-D for windows)
  • Command-delete to delete the prefab
  • Common rookie mistakes by students - trying to drag into the game instead of scene editor, or double clicking into editing the prefab itself instead of the scene
  • Create empty gameobject, put all the blocks inside it so this container holds all your blocks

Navigation

  • Window > AI > Navigation > Clear & Bake
  • Change Agent size and other values to tune your pathfinding

Createsceneandbakenavigation.png

  • Created an empty and put the maincamera as a child of the hero and its like a fps (3rd person view)! It works! (trainer approved)

Basicgamenityplatform.gif

Game Level Design

  • A game could be composed of several different levels.
  • With level design, you can progressively teach the player new skills in the game (hidden tutorials)

Examples of Game Level Design:

  • Basketball shooter game: a level design would occupy a finite space, be bounded to a basketball size with walls, have a basket on either end, and floor markings to indictate the play area.
  • 2D platformer games: consists of one continguous continuous background. level design elements are to facilitate game mechanic, placement of elements don't correspond to real world placement as much as game mechanic.
  • 3D shooter: level design dictated by mechanics of the game - cover mechanism allows player to duck behind objects, placement of objects and lighting allows game to be played effectively.
  • Endless Runner: obstacles test the player's reflexes, bounding or side wall conditions, overhead and underfoot tracks/wires elements.
  • Zombie Toys: cover for player, enemies in form of props, concealment point
  • Trainer shared an example of a game level design map drawn by his children. boss levels and all. :-D

Difficulty of game level

  • must not be too hard
  • must allow user to gain mastery progressively
  • after user has mastery, they will find it harder to stop playing your game

Lesson 2 - Managing Project, assets, game level

Additional Box Collider

  • Let's say you have many elements, what if your player decides to do a weird wall hug and squeeze thru your buildings and perhaps fall off the game map entirely?
  • In Inspector > Add additional box collider > Extend your collider
  • Remember to set your collidable items as "static"

Rigidbody

Rigidbodyunity.png

Raycast

Project Management

  • Naming convention
  • can be simple (human readable) or have a system (requires a legend for universal understanding amongst team members
  • eg in animation, dope sheet

Shaders

Shaderunity.png

  • Albedo map - flat colour without light
  • Normal map - makes detail on surface
  • Occlusion - shadow map
  • Emission - emit light

Cutout

Unitycutout.png

  • Shader > Cutout For alpha channel artwork - adds complexity quickly

Cookie

Cookieandcutoutps.png Cookieandcutout.png

quiz qn examples

  • The breadcrumb in project window shows: FILE PATH OF SELECTED ASSET (you must select it first)
  • Acceptable formats for audio are: AIFF, MP3, WAV, and OGG. (Unacceptable -> MIDI, RCA, IFF, QuickTime, Egg, wav, avi)
  • Project Window toolbar allows searching assets by: Label and Type
  • Modifying organisation of assets is done in PROJECT WINDOW (assets is just your files on the computer)
  • The 2 script types supported are C# and UnityScript
  • specular property controls COLOUR and STRENGTH of reflection
  • the material property controls spreading of light on microsurface details: SMOOTHNESS
  • material rendering mode uses black in an alpha channel to define where material is exactly NOT appearing - CUTOUT
  • The albedo of a material is defined as: colour of the material without lighting data

debbie tries... to make it a mobile app

Myfirstmobilegame1.png Myfirstmobilegame2.png

  • result: had to reinstall OpenJDK. must add open scene. build is fine. but colours look washed out. why?

answer from trainer: mobile must use mobile shader, AR must use AR shader.

  • what i have learnt: cannot anyhowly just compile your desktop version as mobile version, have to redo all the shaders and interface and everything

Skybox

Window > Rendering > Lighting Setting > can set different skybox environment and other overall lighting settings

Lightingunityskybox.png

Reflective / Metallic Shader

  • Can use reflection probe to calculate it.
  • A Reflection Probe is rather like a camera that captures a spherical view of its surroundings in all directions. The captured image is then stored as a Cubemap that can be used by objects with reflective materials.
  • Several reflection probes can be used in a given scene and objects can be set to use the cubemap produced by the nearest probe. The result is that the reflections on the object can change convincingly according to its environment.

Lesson 3 - Lighting and animation

Introduction to Game Lighting

  • The scene can look very different by just changing the light (number, placement, rotation, type of light) - use to create different feeling in the game

Examplelightinggames.png Examplelightinggames2.png

  • Using lighting to highlight elements to place certain things in focus and get dynamic effects
  • Using normal maps to create more surface detail for an object

Debbie's digression: how to create photoshop normal map

  • Open texture in Photoshop as you would normally any image. Image must be set to RGB.
  • Choose Filter > 3D > Generate Normal Map

Photoshopgeneratenormals1.png


Games vs film

  • Games lighting - baked (pre-enabled) and calculated real time, performance and number of lights depend on platform, ray-traced shadow may cause performance lag, but realtime global illumination is possible depending on platform used, all rendering is on one platform
  • Film lighting - completely rendered before showing, no platform dependent performance, ray-traced shadows used extensively, pre-calculated global illumination is widely used (even more realistic), rendering power can be distributed to renderfarm
  • Debbie wonders: why doesnt everyone just go and use realtime game lighting? It is because it has to be done on one platform, cannot be distributed to speed up the production.


Types of Lights in Unity

  • Spot Light
  • Directional Light
  • Point Light
  • Area Light - rectangular light used for baking only (WILL NOT SHOW IF NOT BAKED, unlike the rest of the lights) - governed by width and height, you probably won't use this unless lighting an interior design or something pretty fixed. Is used to fake certain glows.
  • Skybox

Objects in scene with overlapping UV

Overlappinguvalert.png Please see this webpage for more information about objects with overlapping UVs: https://docs.unity3d.com/Manual/ProgressiveLightmapper-UVOverlap.html

  • it happens when the overlap is WITHIN the same object - is 3d modelling issue not because you overlap 2 objects in a scene (if they are seperate object, they will not trigger)

Lightmap and Lighting

Hands-on: we added a spotlight and added it as a child to the hero player like a torch.

  • Lightmap format - EXR (Extended Dynamic Range) [OpenEXR]

Settingsforlight.png Lightmap1.png Lightmap3.png

This blue map is the baked light map which you can see under the lighting table > baked light map. On the right, it also breaks down all the cubes in the scene and shows the lighting map for that too.

How to solve: where to find the light gizmo and fixing light baking

Lightgizmo.png Lightbake.png

Two things to note:

  • if you cannot see the light ray, click on the "gizmo" so you have the handles to edit
  • if your light doesn't seem to move altho the gizmo is properly parented, you may have set the light to BAKED instead of realtime, it has to be realtime otherwise it is fake baked into the scene

How to solve: cut out light / cookie

Cookielightunity.png

How to solve: navigation issue lock and unlock rotation

Lockview.png

  • Did your scene orbit view stop working? Check that this tiny padlock is not locked.

How to solve: shader transparency

Transparencyobjectunity.png

  • Shader: You can make an object transparent using the alpha for the albedo. There is a value for A under RGB.


Recap of lighting

  • Changing the intensity of a light adjusts the BRIGHTNESS

Directionallightexample.png

  • Parallel light - will not be cast by skybox or point light or area light, only directional light - for more info read this: https://docs.unity3d.com/Manual/Lighting.html
  • SOFT shadow type casts shadows that approximate the natural fuzziness of real shadows due to emission area size and the bouncing of light. (As opposed to HARD shadow - hard shadow uses less cpu, but today soft shadow is most commonly used because NO MORE LIMITS)

Extra: Light Probe Group

  • Light Probe Group - what if I have a scene which is really realistic with a big red wall and I want the red colour light to bounce onto my user’s face? Baking all the information into a light probe group. If you put too many, it will impact on cpu. But if you put too little, there can be unintended lighting effects in realtime lighting.

Lightprobe1.png Lightprobe2.png Lightprobe3.png Lightprobe4.png

  • for a outdoor scene like PUBG you will not need so many, but for things like horror games where lighting is important and there are high contrast between lighting areas and objects, you need more light probe groups
  • Ideas: using theatre gobo (cutouts) [Hmm where does the word gobo come from anyway? Wikipedia says it is cited by some lighting professionals as "goes before optics" or, less often, "goes between optics". An alternative explanation is "graphical optical black out.]
  • If in blender i can use video for the light cutout within cycles nodes, what about in unity? (maybe is cpu heavy and not best practice tho)

Common lighting-related questions in Unity Cert Exam

  • selecting generate light map Uvs in the import setting of a model > will CREATE an additional set of UX coordinates for the light map data [it doesn’t generate] > see the occlusion
  • Occlusion is like a light map, generated by your 3d software > NEXT Question: how do I bake ambient occlusion (AO texture) for a model in blender?
  • to darken the ambient occlusion in baked lighting > increase the ambient occlusion amount (ambient occlusion is what you see in the corner of the room)
  • light probes are used to > SAMPLE baked lighting at specific points in the scene

Question: Light map or AO map?

Why do some things use lightmap and some use occlusion map?

  • Check out unity attic scene - 2019 is the light they really moved 2d lights forward
  • From poly count - https://polycount.com/discussion/79561/light-maps-and-ambient-occlusion-maps (this description helped me)
    • “Ambient Occlusion represents shadowing that comes from the environment itself, not from any particular lightsource. I like to think of it as the shadows being cast by bounced light, as opposed to the shadows being cast directly by a light.
    • A light map is baking any lighting information into a map. You could set up a bunch of lights, and then bake that into a texture to then use for whatever purposes.
    • A shadow map is when you bake only the shadows being cast. This is one way to get an Ambient Occlusion map, by baking a shadow from a light that simulates bounce light, like 3dsmax's Skylight. But you don't necessarily need a light to bake an AO. There are AO shaders, like Mental Ray's, which generate those shadows based on the objects in the scene.
    • At any case, the reason AO is so popular, is because it adds quite a bit of volume and depth to an object, without hinging on a lightsource. This is great for video-games, as stuff tends to move around, and the light direction can change. So if you bake really strong shadows that look like they're coming from above, and then in-game the light moves to the side of an object, or below it, it will look real weird. AO doesn't have that problem.
    • Baking a lightmap though, is something I never quite got the hang of. You basically set up a scene with some cool lighting, then bake that to use as an addition or a base in your texture.”
  • DD: Lightmaps seem so advanced today! Why not use all lightmap??? (unless cpu performance is impacted)

UI improvement

  • add playmode tint to unity

Playmodetintunity.png


Animation 101

  • Animation is vital in game dev - can animate different things - characters / environment objects
  • Import animation from external software like maya, 3ds max, blender, etc

Howtoselect.png

Animating Object

  • hands on in the class: Prefab folder > Knightsgame > item_gift01 > drag to scene
  • put the box collider on the parent object
  • DO NOT PUT THE ANIMATOR ON THE PARENT OBJECT > Add component to the child object inside (in this case, mod_gift_red)
  • So you add animator component to the child
  • Window > Animation > Opens up the animation tab
  • Click on tiny 3 dot button on right and "show samples
  • Change samples to 30fps
  • Click on the red record button
  • Keyframing (similar to blender)
  • Can adjust curves for easing

Unityanimationpanel.png

Unityanimationpanel2.png

Unityapplyanimationtoallprefabs.png

Unitycurves.png

Curves are automatically applied in unity. If you want to make linear - Rotating objects - set BOTH TANGENTS to linear

Unitycurveslinear.png

  • Animator Window > see the different states

Unityanimator 1.png Unityanimator 2.png

  • eg: upon entry > go to idle > from any state it can go to the forward animation or the skill animation

Animation: Transition Parameters

  • float -
  • integer -
  • boolean - true or false
  • trigger - fire and forget (if you touch something, triggered) - rather than a boolean that stays true and false until reset back by a script, a trigger happens, is consumed, and then is reset
  • create "Die" Parameter (be careful about casing must be Die)
  • Example file - knights_skill spinning > highlight the skill arrow > under conditions in inspector, set to Die

Unityanimator parameters1.png

Lesson 4 - Intro Scripting in Game Dev

Scripting 101

  • To build custom behaviour for custom game assets - applied as components to gameobjects
  • They can have behaviours, properties and variables which we can manipulate to make them behave the way that we want

Basic Structure

  • MonoBehaviour is the base class from which every Unity script derives
  • Example of default script (C#) in Unity:
using UnityEngine;
using System.Collections; // namespace

public class MyAwesomeScript : MonoBehaviour { // classname must be same as file name
	// use this for initialisation
	//run once at the start of the method
	void Start () {

	}

	//update is called once per frame (60 times in one sec)
	//used commonly for detecting input by the player like collisions etc
	void Update () {

	}
}

these are pre-created in unity as a basic structure

Settingideeditorunity.png


EnemyToPlayer.cs - works

  • Let's say you are going to write a script for your Player - go to prefab folder > look for monster black cube > drag him into scene
  • Right-Click on Scripts folder > Create new C# script > create one called EnemyToPlayer
//using System.Collections;
//using System.Collections.Generic;
using UnityEngine; //namespace
using UnityEngine.AI;


public class EnemyToPlayer : MonoBehaviour
{
	// reference player position so that enemy can follow player
	private Transform goal;//data can be private or public if you want other script to access it


	// reference to enemy's navmesh agent
	private NavMeshAgent enemy;

    // Start is called before the first frame update
    void Start()
    {
     	// find the navmeshagent component on enemy's gameobject
     	enemy = GetComponent<NavMeshAgent>();

     	// find the player gameobject and define player's transofmr as enemy's goal/destination   
     	goal = GameObject.Find("Hero_01_Knight").transform;

     	// tell enemy to go to goal transform position x y z 
     	enemy.destination = goal.position;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
  • Add navmeshagent component to the enemy. if you do not add it in, it will have error saying you must add navmeshagent
  • change the angular speed to 2000 and acceleration to 20
  • make sure the correct script has no errors (fix compiler error)
  • Now your enemy will follow your player!

How to solve: global namespace error

  • if you get the error "The namespace `global::' already contains a definition for xxx" - you may want to check that you haven't got a doubled file somewhere in your project. Check the project files for duplicates!

Duplicateerrornamespace.png

Common error: class name

User fails to name the class correctly - it is class NewBehaviourScript instead of the name of your actual class. WHen you create a script in unity, the first name you assign it will be named as the class. If you press ENTER too early and just rename the file, the class will not be autonamed for you.

PlayerHit.cs - works

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerHit : MonoBehaviour
{

	// reference to Animator component
	private Animator KnightModelAnimator;


    // Start is called before the first frame update
    void Start()
    {
        //find the gameObject Mod_Knight_New and get component
        KnightModelAnimator = GameObject.Find("Hero_01_Knight/Mod_Knight_New").GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
	
	// if player collides with object
    void OnTriggerEnter (Collider other) 
    {
    	// if the other object is tagged as "Enemy"
    	if (other.gameObject.tag == "Enemy")
    	{
    	// then player will play the "Die" animation via Animator Component
    		KnightModelAnimator.SetTrigger("Die");
    	}
    }
}
  • Make sure box collider for monster has "Is Trigger"
  • Note how the box collider is smaller than the monster itself (a light green box)
  • Increase size of box collider to 1 x 1 x 1 (bigger)

Boxcolliderenemy.png Boxcolliderenemy2.png

  • Create tags Enemy, Boss, GiftPet, GiftShield

Addtagsunity.png

  • Add tag to monster "Enemy"
  • Add tag to giftbox
  • must add rigidbody to enemy for collider to work - untick use gravity, tick is kinematic
  • Top tip: don't make the collider too exact - another student noted that "0.7 0.8 0.7 fits the monster just nice
" but what if the player gets real close but just not overlaps? so best to set a bit bigger to trigger slightly outside of the monster.
  • Common errors in the class - excess curly brackets which are not under any method

Methods: what does 'void' mean?

  • void - it does not return / it goes into the void
  • return - it returns a value at the end
public void getName(){
 return name;
}

so for example: this is WRONG - a void method does not return

PlayerHit.cs updated with shield - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerHit : MonoBehaviour
{

	// reference to Animator component
	private Animator KnightModelAnimator;

	//shield is turned on or off
	private bool shield = false;

	//shield count down in seconds
	private float CountDown = 5;


    // Start is called before the first frame update
    void Start()
    {
        //find the gameObject Mod_Knight_New and get component
        KnightModelAnimator = GameObject.Find("Hero_01_Knight/Mod_Knight_New").GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
	
	// if player collides with object
    void OnTriggerEnter (Collider other) 
    {
    	// if the other object is tagged as "Enemy" and shield is turned on
    	if (other.gameObject.tag == "Enemy" && shield == true)
    	{
    	// then destroy the enemy
    		Destroy(other.gameObject);
    	}
    	// if the other object is tagged as "Enemy"
    	else if (other.gameObject.tag == "Enemy")
    	{
    	// then player will play the "Die" animation via Animator Component
    		KnightModelAnimator.SetTrigger("Die");
    	}

    	if(other.gameObject.tag == "GiftShield")
    	{
    		//remove the giftshield from scene
    		Destroy(other.gameObject);

    		//turn on the shield
    		shield = true;

    		// countdown to turn off shield - usually using call routine or invoke
    		// can invoke after a delay - here it is 5sec
    		Invoke("ShieldCountDown",CountDown);
    		print("collect gift shield");

    	}

    	if(other.gameObject.tag == "GiftPet")
    	{
    		//remove the giftpet from scene
    		Destroy(other.gameObject);

    	}
    }

    void ShieldCountDown()
    {
    	shield = false;
    	print("shield ended");

    }

}


  • create a sphere as child of the hero player
  • create a material called Shield to be applied to the sphere
  • material should be fade or transparent
  • add alpha to material
  • update code to have a public game object shieldEffect value you want to be a able to make something active (visible) later
  • position the shield over the hero object but make it invisible (uncheck the box in inspect)
  • check the script component of playerhit, there's a new box, drag the shield in.
  • Shield becomes visible when you get the gift shield.
  • Bonus: I added in a public text (Component > ui > text object) Called it MyText and with just a simple line it updates the Gui text when the shield is collected.

PlayerHit.cs updated with shieldeffect and text - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerHit : MonoBehaviour
{

	// reference to Animator component
	private Animator KnightModelAnimator;

	//shield is turned on or off
	private bool shield = false;

	//shield count down in seconds
	private float CountDown = 5;

	public Text MyText;

	public GameObject shieldEffects;

    // Start is called before the first frame update
    void Start()
    {
        //find the gameObject Mod_Knight_New and get component
        KnightModelAnimator = GameObject.Find("Hero_01_Knight/Mod_Knight_New").GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
	
	// if player collides with object
    void OnTriggerEnter (Collider other) 
    {
    	// if the other object is tagged as "Enemy" and shield is turned on
    	if (other.gameObject.tag == "Enemy" && shield == true)
    	{
    	// then destroy the enemy
    		Destroy(other.gameObject);
    	}
    	// if the other object is tagged as "Enemy"
    	else if (other.gameObject.tag == "Enemy")
    	{
    	// then player will play the "Die" animation via Animator Component
    		KnightModelAnimator.SetTrigger("Die");
    	}

    	if(other.gameObject.tag == "GiftShield")
    	{
    		//remove the giftshield from scene
    		Destroy(other.gameObject);

    		//turn on the shield
    		shield = true;

    		// turn on the shieldgame object
    		shieldEffects.SetActive(true);

    		// countdown to turn off shield - usually using call routine or invoke
    		// can invoke after a delay - here it is 5sec
    		Invoke("ShieldCountDown",CountDown);
    		print("collected gift shield");
    		MyText.text = "shield collected";

    	}

    	if(other.gameObject.tag == "GiftPet")
    	{
    		//remove the giftpet from scene
    		Destroy(other.gameObject);

    	}
    }

    void ShieldCountDown()
    {
    	shield = false;
    	shieldEffects.SetActive(false);
    	print("shield ended");
    	MyText.text = "shield ended";

    }

}

Shieldcollected.png Shieldended.png

  • Here's another idea suggested: at the start of the script (PlayerHit.cs) you can simply set all the settings (eg: shieldEffects.SetActive(false);), you can get the various component and set the values for them using the script instead of manually setting your project by clicking various things to be active (visible) or not visible

Lesson 5 - navigation / pathfinding / player allies enemies

Navigation System 101

Unity has an in-built navigation system - provides robust and intelligent pathfinding behaviour right out of the box: here are 3 components to it

  • NavMesh (blue colour mesh on the ground / walkable surfaces)
  • NavMesh agent (agent)
  • Navmesh Obstacles

Animated Door / Carving Nav Mesh

Navmeshdoor.png

  • check that the size of the nav mesh obstacle is correct / a bit bigger than the object
  • possible fix: if "stuck" can try to check and uncheck static to make sure that it (and all its children) are not static
  • If you do not mark it as static, the navmesh will not generate for the additional mesh
  • Obstacle avoidance: Pathfinding best to keep as Low quality if it passes
  • carve only stationery

Common Test questions

  • Navmesh - defines the walkable surfaces for nav mesh agents (KEYWORD is walkable surfaces)
  • obstacle avoidance is how nav mesh agents AVOID COLLISIONS with other nav mesh agents and geometry
  • the process of creating nav mesh from level geometry marked as Navigation Static is called “baking”
  • the word baking is used for lighting and nav mesh
  • what does max slope do in navigation - defines the steepest angle that the nav mesh agent can walk up
  • general tip: don't open more than one unity project, in case it opens the scripts too and there is conflict

Adding a pet that follows your player

  • go to prefabs folder > look for animal chicken > drag it in
  • go to scripts folder > create “PetToPlayer” script in C#
  • add navmesh agent to chicken
  • change chicken speed to 7, angular speed to 2000, acceleration to 8, stopping distance 2
  • drag the script to the object
  • copy contents of EnemyToPlayer into PetToPlayer (be careful not to change the class name. class name and file name must be the same)
  • if there is compile error (class name not changed, it will not let you drag the script in)

Pettoplayer.png

Add shadow

Is the chicken floating with no shadow? Go into the child inside (mod chicken) and check that it is cast shadow in the Mesh Renderer

Chickenshadow.png

Animalchicken.gif

Spot the error

Screenshotted from a classmate: Errorscriptname.png can you spot the error? a very common one...

PetRotateToEnemy.cs - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PetRotateToEnemy : MonoBehaviour
{
	// define who to look at
	private Transform petTarget;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        // rotate to look at the target on every frame
        // transform applies to the chicken, tells it to look at petTarget
    	transform.LookAt(petTarget);
    }

	// when we collide with another gameobject
	// if the other object is tagged as "Enemy"
	// then tell chicken that this enemy is the target
    void onTriggerStay (Collider other)
    {
    	if(other.tag == "Enemy")
    	{
    		// tell chicken that this enemy is the target
    		petTarget = other.transform;
    	}
    }

}

  • add a sphere collider on the chicken
  • uncheck gravity
  • Check is kinematic
  • add sphere. Rename as egg. Best way is to move position to x y z 0 0 0 first for starters.
  • put the egg bullet near the enemy.
  • scale down to 0.5 on all axis
  • Make the egg a prefab variant, drag game objects on it.
  • create Bullet.cs
  • add rigid body to the egg prefab, remove use gravity, add kinematics
  • BONUS: i added some text objects (unity UI) to print the values on screen in game

Bullet.cs - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Bullet : MonoBehaviour
{
	// define damage
	public int damage = 1;

	// define speed
	public float speed = 15.5f;

 	//public GameObject Canvas;

	public Text BulletText;
    

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    // when the bullet collides with other objects...
    void OnTriggerEnter (Collider other)
    {
    	// if the other object is tagged as "Enemy"

    	if(other.gameObject.tag == "Enemy")
    	{
    		
    		
    		BulletText.text = "bullet hit the enemy!";
    		print("bullet hit the enemy");

    		// get the Enemy script component in the other game object

    		// and pass my damage in this script to the other gameObject

    		// minus the enemy HP using the other gameobject's script

            other.GetComponent<EnemyHP>().MinusHealth(damage);

    		// remove the bullet from the entire scene
    		Destroy(this.gameObject);
    		// you'll want to put the destroy bullet last of all
    		// because once it DESTROY the script below the destroy point will not run
    	}
    }
}

EnemyHP.cs - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class EnemyHP : MonoBehaviour
{

	// define the health of enemy
	public int health = 5;
	
    public Text HealthText;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }


    public void MinusHealth(int damageReceived){
        health = health - damageReceived;

        print ("Enemy health is " +health);
        HealthText.text = "Enemy health is " +health;

        // health -= damageReceived;
        // check whether HP is zero
        CheckHealth();

    }
    // use this whenever the enemy takes damage from bullet
    void CheckHealth(){
        // check whether enemy's health is less than or equal to zero
        if (health <= 0){
            // if yes then destroy enemy object
            Destroy (this.gameObject);
        }
    } 

}
  • don't forget to check all the "linkages" - after you script it all you may have to drag and drop the script (eg: enemyHP) onto the enemy itself, dragging the text ui object onto the right field if its blank in unity.

Myunitychickengamedraft.png

Updating the bullet so it flies!

Add this to the update function:

   void Update()
    {
        // let's move the bullet 
        // once you add this line your bullet will fly forward
        transform.Translate(Vector3.forward * speed * Time.deltaTime);

    }

What is time.deltaTime? It is just to help us balance fast computer and slow computer with animation.

Next, apply overrides to the egg.

Applyoverrides.png

The Open button opens the Prefab Asset that the instance is from in Prefab Mode, allowing you to edit the Prefab Asset and thereby change all of its instances. If you do not apply, then the bullet script may not apply to ALL instances of the egg when you call it up by script later.

PetShoot.cs - working

we use invokerepeating so that we can control the timing with which we call up bullets instead of BY EVERY FRAME (too. many)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PetShoot : MonoBehaviour
{
	// reference to bullet gameobject
	public GameObject bullet;

	private float bulletInterval = 0.3f;

    // Start is called before the first frame update
    void Start()
    {
    	InvokeRepeating("ShootBullet", 0, bulletInterval);
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void ShootBullet(){
    	// spawn bullet gameobject reference at chicken position, and chicken rotation
    	Instantiate(bullet, transform.position, transform.rotation);
    }
}

Reducing the build file size

  • Trainer shared that they were shocked by size of unreal engine game they built - 6GB+. Unity is smaller
  • Can check whether
  • Check Materials / Textures - can set different values for mobile or desktop
  • Compression ASTC

Compressionmaterials.png

400px

DestroySelf.cs - working

Did you generate a lot of egg clones and they are never leaving the hierarchy? we should delete them after a set time

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroySelf : MonoBehaviour
{
	// define the duration before destroying current gameObject
	public float countDown = 0.5f;

    // Start is called before the first frame update
    void Start()
    {
    	// delete
        Destroy (this.gameObject, countDown);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}


Updated bullet.cs minus the text ui stuff - working

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Bullet : MonoBehaviour
{
	// define damage
	public int damage = 1;

	// define speed
	public float speed = 15.5f;

 	//public GameObject Canvas;

	//public Text BulletText;


    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        // let's move the bullet 
        // once you add this line your bullet will fly forward
        transform.Translate(Vector3.forward * speed * Time.deltaTime);

    }

    // when the bullet collides with other objects...
    void OnTriggerEnter (Collider other)
    {
    	// if the other object is tagged as "Enemy"

    	if(other.gameObject.tag == "Enemy")
    	{
    		
    		//BulletText.text = "bullet hit the enemy!";
    		//    print("bullet hit the enemy");

    		// get the Enemy script component in the other game object

    		// and pass my damage in this script to the other gameObject

    		// minus the enemy HP using the other gameobject's script

            other.GetComponent<EnemyHP>().MinusHealth(damage);

    		// remove the bullet from the entire scene
    		Destroy(this.gameObject);
    		// you'll want to put the destroy bullet last of all
    		// because once it DESTROY the script below the destroy point will not run
    	}
    }
}

Chicken prefab

under playerhit.cs we want to edit the lines:


    	if(other.gameObject.tag == "GiftPet")
    	{

            Instantiate(pet, transform.position, transform.rotation);

    		//remove the giftpet from scene
    		Destroy(other.gameObject);

    	}

here is the overall script for playerhit.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerHit : MonoBehaviour
{

	// reference to Animator component
	private Animator KnightModelAnimator;

	//shield is turned on or off
	private bool shield = false;

	//shield count down in seconds
	private float CountDown = 5;

	public Text MyText;

	public GameObject shieldEffects;

    public GameObject pet;



    // Start is called before the first frame update
    void Start()
    {
        //find the gameObject Mod_Knight_New and get component
        KnightModelAnimator = GameObject.Find("Hero_01_Knight/Mod_Knight_New").GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
	
	// if player collides with object
    void OnTriggerEnter (Collider other) 
    {
    	// if the other object is tagged as "Enemy" and shield is turned on
    	if (other.gameObject.tag == "Enemy" && shield == true)
    	{
    	// then destroy the enemy
    		Destroy(other.gameObject);
    	}
    	// if the other object is tagged as "Enemy"
    	else if (other.gameObject.tag == "Enemy")
    	{
    	// then player will play the "Die" animation via Animator Component
    		KnightModelAnimator.SetTrigger("Die");
    	}

    	if(other.gameObject.tag == "GiftShield")
    	{
    		//remove the giftshield from scene
    		Destroy(other.gameObject);

    		//turn on the shield
    		shield = true;

    		// turn on the shieldgame object
    		shieldEffects.SetActive(true);

    		// countdown to turn off shield - usually using call routine or invoke
    		// can invoke after a delay - here it is 5sec
    		Invoke("ShieldCountDown",CountDown);
    		print("collected gift shield");
    		MyText.text = "shield collected";

    	}

    	if(other.gameObject.tag == "GiftPet")
    	{

            Instantiate(pet, transform.position, transform.rotation);

    		//remove the giftpet from scene
    		Destroy(other.gameObject);

    	}
    }

    void ShieldCountDown()
    {
    	shield = false;
    	shieldEffects.SetActive(false);
    	print("shield ended");
    	MyText.text = "shield ended";



    }

}

remove animal chicken from hierarchy. now when player hits the red gift the pet will spawn and start shooting bullets.

SpawnManager and SpawnManagerScript.cs

  • A manager is a method to do something. it is not built in, it is simply a method that developers design and use.
  • We create an empty gameobject and name it as manager.
  • Create empty called "SpawnManager" be careful about casing and spelling
  • Create a new script "SpawnManagerScript" (so we won't get confused later on, but you could technically name it SpawnManager as well if you aren't easily confused.
  • Drag your script in
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnManagerScript : MonoBehaviour
{

	private float enemySpawn = 3.1f;
	private float giftSpawn = 5.4f;
	public GameObject enemy, giftShield, giftPet;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void SpawnEnemy()
    {
    	Instantiate (enemy, new Vector3(9,0,5.6f), Quaternion.identity);
    }

    void SpawnGift()
    {
    	int randomGift = Random.Range(0, 2); // get random number 0 or 1
    	if (randomGift == 0){
    		
    		Instantiate (giftPet, new Vector3(3.2f,0,5.6f), Quaternion.identity);

    	} else {

    		Instantiate (giftShield, new Vector3(3.2f,0,5.6f), Quaternion.identity);

    	}
    	
    }
}


Random position

come i answer my own qn, found on internet a working script for GENERATING ANY POSITION on navmesh to spawn your gifts:

    //generate random vector3 navmesh position (from unity answers)
    public Vector3 RandomNavmeshLocation(float radius) {
         Vector3 randomDirection = Random.insideUnitSphere * radius;
         randomDirection += transform.position;
         UnityEngine.AI.NavMeshHit hit;
         Vector3 finalPosition = Vector3.zero;
         if (UnityEngine.AI.NavMesh.SamplePosition(randomDirection, out hit, radius, 1)) {
             finalPosition = hit.position;            
         }
         return finalPosition;
     }

then instantiate this way

    	Instantiate (giftPet, RandomNavmeshLocation(4f), Quaternion.identity);

have to remove all the text ui things i added which are now inside the prefab. doesn't work the same way the references. have to fix another time.

Lesson 6 - Particle Systems

Unityparticleinterface.png

  • top tips: BUY YOUR OWN PARTICLE SYSTEM
  • play with size over lifetime
  • Subemitter - a secondary particle emitted after the main particle is over, eg commonly used in fireworks and raindrop splash back on the ground


Let’s add particle effects

  • add hitparticle to bullet script
  • add dieparticle to enemyhp script

How to add particle effects properly

  • in the enemyHP script add:
    public GameObject dieParticle;
  • check health when the enemy has been hit too many times start the dying
     void CheckHealth(){
        // check whether enemy's health is less than or equal to zero
        if (health <= 0){
            // call up the dieparticle on the spot
            Instantiate(dieParticle, transform.position, Quaternion.identity);
            // if yes then destroy enemy object
            Destroy (this.gameObject);
        }
    } 
  • don’t forget to set it to self destroy to remove from scene. Set about 0.5
  • quaternion.identity - This quaternion corresponds to "no rotation" - the object is perfectly aligned with the world or parent axes.

Add a Player Attack Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAttack : MonoBehaviour
{
	// reference the xplosion particle

	public GameObject explosion;
	// cool down  to use skill (like a countdown
	// every 5 sec the player can use the skill 1 time
	private int coolDown = 5;

	// whether player can use skill
	private bool canUseSkill = true;


    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
        	// canUseSkill == true is same as canUseSkill
        	// canUseSKill == false is the same as !canUseSkill
        	if (canUseSkill)
        	{
        		Attack();
        	}
        }
    }

    void Attack(){
    	Instantiate(explosion, transform.position, Quaternion.identity);
    	// prevent the player frm attacking
    	canUseSkill = false;

    	// start cool down before player can attack again
    	Invoke("AttackCoolDown", coolDown);

    }

    void AttackCoolDown()
    {
    	canUseSkill = true;
    }

}

  • don't forget to drop your explosion into the player
  • drop a destroyself component into the explosion so it will not continuously stay in hierarchy

Add an Explosion.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Explosion : MonoBehaviour
{
	//define the damage
	private int damage = 25;

	void OnTriggerEnter (Collider other){
		if (other.tag == "Enemy")
		{
			other.GetComponent<EnemyHP>().MinusHealth(damage);

			print("EXPLODED THE ENEMY");
		}
	}

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
  • drop this script component into the player
  • now when you press the spacebar, it explodes with the particles and if the enemy is in range, it explodes the enemy too
  • common issues - your sphere collider must be there, it must be rigidbody untick gravity select is kinematic

ADDRESSABLE ASSET

Top tip: read up on this:

https://docs.unity3d.com/Packages/com.unity.addressables@0.4/manual/index.html

  • eg: if you want the car to move forward, one car is fine, but what if you have 100 cars? do you need 100 car scripts?
  • addressable asset allow u to apply the SAME one script to apply to all the cars

add in player glow in playerhit.cs

  • edit the script to reference a gameobject called playerglow which you will later need to connect up in unity
  • to use a line like "SetActive(true);" you will need to have it in the hierarchy
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAttack : MonoBehaviour
{
	// reference the xplosion particle
	public GameObject explosion;

    // reference the glowing particle inside playerobject
    public GameObject playerGlow;

	// cool down  to use skill (like a countdown
	// every 5 sec the player can use the skill 1 time
	private int coolDown = 5;

	// whether player can use skill
	private bool canUseSkill = true;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
        	// canUseSkill == true is same as canUseSkill
        	// canUseSKill == false is the same as !canUseSkill
        	if (canUseSkill)
        	{
        		Attack();
        	}
        }
    }

    void Attack(){
    	Instantiate(explosion, transform.position, Quaternion.identity);
    	// prevent the player frm attacking
    	canUseSkill = false;

        //disable playerGlow
        playerGlow.SetActive(false);

    	// start cool down before player can attack again
    	Invoke("AttackCoolDown", coolDown);

    }

    void AttackCoolDown()
    {
    	canUseSkill = true;

        playerGlow.SetActive(true);
    }

}

Lesson 7 - audio, camera, player selection, system, user interface

secret dev interfaces: debug menu? god mode?

Cheatbuttondev1.png Cheatbuttondev2.png

  • analytics buttons / continue button off screen. when the ad finish playing, then invoke the button. if need to test for debug / and need a cheat, move the button on screen.
  • cheat buttons allow the developer to test things out, such as achievements
  • I love the story of adding a temp cheat button interface for the developer to test things more easily. It makes sense.

Unity Collaborate and Cloud Build

Cloudbuildunity.png

More about cloud build: https://unity3d.com/how-to/happier-faster-teamwork

Audio

Audio clips / Audio sources / Audio mixers / Audio Effects

  • Audio adds impact and flavour, gives feedback, and background music enhances the overall mood and experience of the game.
  • Audio clip formats: mp3, ogg, wav, aiff/aif, mod, it, s3m, xm <— common exam question
  • Audio Source is a component that sits in the GameObject
  • It plays the audio clips assigned
  • controls the volume, 2d or 3D and effects such as doppler or fall off
  • which component has zero property - its the audio source component, it is only used to detect audio
  • 2D audio plays at same volume regardless of distance from listener to source. You can only pan left and right.
  • 3D audio will change in volume and even pitch distorsion as audio listener moves around relative to the audio source. The further away, the audio source volume will be lower.
  • Go to Egg prefab (our bullet) > add “audio source” > add in sounds and put to the right mixer source because you want the music and sounds to be mixed different levels

Forcetomono.png

  • If you check force to mono, what will happen? At first you had left and right channel. Force to mono means you merge the channels into 1 mono channel. ANSWER FOR UNITY EXAM: The volume becomes softer. (not quality become lower. to them it is same quality)
  • why would i force to mono? it may reduce file size and use less memory slot. for very very low end devices maybe makes a difference eg mobile devices.
  • Compression format: PCM is commonly linked to wav file, pretty lossless compression. so file is relatively big. Vorbis is a lot of compression.
  • Preload your background music. Selecting Preload Audio Data means the scene will not start until all sounds with this setting are loaded into memory. This is most important for audio content that is needed right away in the scene, such as footsteps, UI, or anything synced to visual content that plays immediately upon the scene’s activation.
  • Exposed parameters for scripting

Exposedaudioparameters.png

  • Effects for audios

Audioeffectsunity.png

  • you can edit the audio in play mode

Editinplaymode.png

  • edit the interface to your liking - Search for unity Space Attribute [(space(10)]

Space40unity.png Space40unity2.png

  • how to link the audio

Audiolinksunity1.png

UI Design

  • UI for game - since unity outputs to Multiple platforms, it affects how the game works.
  • My questions: do I have to build different versions for different devices or how do I make a responsive unity game?
  • cultural differences for UI preferences - china mobile games used to having a lot of options and info (horror vacui?)

Setting up the UI

  • create canvas
  • must make sure you add scene to build settings
  • anchor preset —> blue one can stretch
  • canvas scaler —> reference resolution can be set —> scale with screen size
  • trainer’s recommended 1920x1024 (Ideal) - tell client that safest is to use black colour bar
  • match width or height
  • add UI text
  • option click the anchor to make it align forever to the top or bottom of side or left or bottom or right > must choose scale when doing it
  • create Canvas-GameOver and set up background, text game per, text score, replay button, duplicate with command-D and then rename Canvas-GameWorld
  • create the tag UI, tag those canvas gameobjects as UI


Awake

void Awake()
    {
        //If we don't currently have a game control...
        if (instance == null)
            //...set this one to be it...
            instance = this;
        //...otherwise...
        else if(instance != this)
            //...destroy this one because it is a duplicate.
            Destroy (gameObject);
    }

Lesson 8 - building and prepping for mobile deploy

Certification Exam

  • 100 questions pulled randomly from a bank - mcq, drag and drop, matching, hotspot
  • 90 mins to complete
  • must score 70% to earn Unity Certified Developer
  • Unity Exam shortcut section - based on PC

WEIRD THINGS ABOUT THE UNITY EXAM / crib sheet

  • Z axis is considered the front!!!!
  • Does reducing polygon count of models affect performance on modern day hardware? Yes AND it is an important factor
  • Complete the sentence: the choice of colour on the menu screen… (your own game UI menu) … IS IMPORTANT IN SETTING THE INITIAL MOOD (not that it “will change the mood of the whole game”)
  • Action = handeye coordination
  • experience points = rpg
  • Long term planning - strategy
  • adventure game = explorable world
  • Story story and Visible model damage is not a. Game mechanic
  • Health, damage, coin collection is a game mechanic
  • pcm is not a format, is. a compression.
  • m4a is not used in unity
  • HIGHEST compression = most compressed
  • Vorbis low > verbs high > adpcm > pcm (least compression)
  • which file exportable 3d file formats are supported by unity? Fbx / dae / obj (blender is not considered because blender MUST be. installed. Unity uses blender to open the files for itself) [TRICK QUESTION ALERT]
  • a prefab… is a way of making a linked copy for hierarchies of GameObjects, their components and properties.
  • how to load a scene? Double click the scene asset
  • How to save a scene? File > save Scene
  • which sprite mode is required to break a sprite sheet up in the sprite editor. Multiple!!!!
  • where to add new layers? Is similar to tags and layers. A, B, E. In the menu, in the Layers menu, and inspector.
  • Tags is for programmer to identify game objects. (To identify Gameobjects to programmer) - NOT for filtering groups
  • MeshFilter is the wireframe thingy!!! Blue and white lines
  • Which canvas render mode allows UI to show over objects in the 3d scene? SCREEN SPACE OVERLAY. Overlay the whole 3d scene. [World space = HUD like sims / screen space is the screen itself]
  • Blue circle is the pivot
  • What is function of UI Slider? Allows to set value between min and max.
  • class name and file name must be the same
  • where can you drag camera control script? On to scene object. TRICK QUESTION ALERT.
  • what is the use case for methods? To provide abstraction layer
  • vector3 variable MUST HAVE vector3 in front and must have 3 values.
  • time.deltaTime = time in seconds it took to complete the last frame
  • physics should use fixedUpdate not Update. [LOOK UP FIXEDUPDATE FOR UNITY]
  • if you want to rotate between two vectors, use the FromToRotation Quaternion constructor
  • Quaternions are used for rotation
  • define albedo = base colour of the surface
  • what makes a mirror like surface = metallic 1 smoothness 1
  • how to increase tiling frequency - increase x y tiling
  • normal map == mimics the reflection of light from surface detail [SURFACE DETAIL = NORMAL = the bumpy surface]
  • height map == mimics the parallax effects of surface detail
  • occlusion map == mimics the obscuring of ambient light by the model with itself
  • albedo == mimics the base colour absorption of the world
  • fade = holograph
  • water = transparent
  • brick = opaque
  • Cut out for fishing net
  • sepia
  • if everything is blur its called BLUR not depth of field
  • if all the particles are rotating in different angle = rotation over lifetime [look into billboard, etc] [can’t be collision cos clumped togehter]
  • square lamp = AREA LIGHT
  • THERE IS. NO FUZZY SHADOW
  • what is the minimum that needs to be done to make object participate In global. Illumination? SET LIGHTMAP STATIC
  • a moving light source works with only the real time GI
  • why might you choose to generate your own custom uv maps rather than to let Unity do it for you? TO eliminate unwrapping artefacts because when unity ownself do there is sometimes seams.
  • why might you need to use a light probe group? To allow ambient GI to affect dynamic objects. To make the lighting more realistic.
  • Magic Light Probes asset —> recommended!!!!!! Go to unity asset store
  • Rank the illumination methods by Memory usage. Highest to lowest: Directional specular > Directional > Non Directional > Direct light only
  • When to use rigidbody > when trying to detect projectile COLLIDING with an object. Key word is COLLIDING.
  • if its a laser > use raycast, not collider.
  • if we choose “is kinematic” it is done in code. (The transform) [go google more on kinematic]
  • moving platform in the game? Should be kinematic rigid body collider.
  • purpose of audio listener > to receive audio from any given audio source
  • what will happen if a 3d audio source moves towards a listener at high speed? Pitch is increased
  • Reverb zone = apply effect only in a physical area in the world
  • Audio listener = aggregate all sound
  • Audio source = position sound in 3d world
  • Audio mixer = apply effect to known group of audio
  • Spatial Blend control > the degree to which the position of the audio source affects the sound
  • Animator Controller asset > manages set of animations and transitions between them
  • A state is an animation
  • float = decimal
  • int = whole number
  • bool = true
  • google on what is SOLO transitions
  • when would you use the Any State? > any state is normally used when you let player go to die animation or whatever animation. No matter which previous animation you were in, you should be able to go to the new state. Intercept ANY state and go to the one state. Any state usually used for DIE animation. You should be able to go from any state to die. [TRICK QUESTION WARNING]
  • jumping animation = substates because you have different levels of jumps, high or low jump
  • running, standing, walking animation = 2d blend tree blending between animations
  • CARTESIAN - if your character press left or right, They turn clockwise or anticlockwise. This is commonly used in games. You don’t want the character to turn cos camera angle changes. Eg resident evil.
  • 1D = standing walking running
  • 2D simple direction = standing strafing left right, walking
  • 2D freeform direction = standing strafing left right, walking, running
  • 2D freeform cartesian = standing TURNING left right, walking


* sub-states machine transition from one another [google for substate]

  • any state is still any state any machine.
  • to merge animations together use Layers. [google for layers!!]
  • process of making navmesh is baking
  • navmesh obstacle purpose is to provide obstacle avoidance to dynamic object
  • what is benefit of analytics > you can track which users are most likely to pay for in app purchases [google for more on this]
  • what does cloud build allow you to do > BUILD MULTIPLE TARGETS AUTOMATICALLY (you can build for any platform)
  • what is required for a team member to join a collaborate project > unity id
  • ps vita has a touch screen and remote play
  • 3ds has a touch screen
  • xbox one has Kinect skeletal tracking
  • mark out the questions which are very lousy / and skip for now / don't be demoralised

Beyond Unity

  • Unity isn't the game for every sort of game. Can also consider Cocos-2dx.