WEEK3 |Unity 2D Basics| Unity’s Component System

Components in Unity

  • we can attach components to Game Objects to affect their state and behavior
  • we can write custom scripts to attach as components
    • a script is a class, but when the script is attached as a component, the game object gets an instance of the class(an object)
    • we can attach scripts to multiple game objects to give them the same behavior
32.png
Unity | Scripts
4
Transform.localScale
5
Script Attached as Component
6
Instance of attached Class(script) in the gameObject
7
Transform.localScale
8
Script Attached as Component
91.png
Instance of attached Class(script) in the gameObject
10
Transform.localScale
11
Script Attached as Component
121.png
Instance of attached Class(script) in the gameObject