UNITY TUTORIAL | PROJECT | Roll a Ball | 5. Creating Collectable Objects

Roll a Ball

Creating Collectable Objects

2
Cube Object
3
deselection in the inspector
4
changing transform of Collectable
5
Attaching Script to
6
Public Variable | Transform.Rotate()
ezgif.com-video-to-gif
Rotating Cube
5. Creating Collectable Objects
Adding time.deltaTime | Frame Independent
ezgif.com-video-to-gif-2
Smooth Rotation with time.deltaTime
8
Trying to make Prefabs
9
Making Prefabs
10
Local View
11
Global View
ezgif.com-video-to-gif
Moving GameObject in Global View
12
Putting Prefabs | Values of Prefabs
13
Changing​ Values in Prefab Origin
14
Change applied to every Prefab
ezgif.com-video-to-gif-2
PickUps
5. Creating Collectable Objects
Creating Material​ to Change Color of Prefab
5-creating-collectable-objects-2.png
Apply the Material to an instantiated prefab
5. Creating Collectable Objects 3
Applying change to every prefab
ezgif.com-video-to-gif
Changing​ Color of

WEEK3 |Unity 2D Physics | Prefabs, Collider

Prefab

  • a prefabricated gameObject
  • a gameObject we have configured the way we want, then saved as a prefab
  • easily adding instances of the prefab to a scene in the editor
  • easily adding instances of the prefab to a scene from a script(spawning)
5
Prefabs | Sprite
6
Prefabs | Sprite change

 

9
Component added to Prefab

 

7
Component applied to GameObject from Prefab
83.png
Component applied to GameObject from Prefab
10
RigidBody2D | GetComponent() | Rigid
11
Script attached to a GameObject
12
Script working in a GameObject
13
Inspector | Prefab Apply
14
Prefab change Applied

 

Collision Detection

  • Detecting collisions between gameObject
  • if both game objects have 2D collider, the Physics 2D engine automatically does collision detection
15
Edge Collider
16
Box Collider
17.png
Physics Material
18
Physics applied to Collider

Collision Resolution

  • Doing something based on the fact that a collision has been detected
  • 2D Physics materials for the game object colliders determine how the Physics 2D engine resolves the collision(Friction/Bounciness)
  • Additional collision resolution by ourselves is possible
19
OnCollisonEnter2D
20
OnCollisionEnter2D