transform.localScale Property in Unity

Notes:

transform.localScale Property in Unity:

Scaling Game objects using transform.localScale:
Scaling means changing size of a game object

transform.localScale:
- is used to set or get scale of a game object relative to its parent space

Note:
- if there is no parent then the game object is scaled relative to its self space
- scale of a game object in Unity is stored in the form of Vector3 structure
- negative scale flips the game object

using UnityEngine;

public class CubeController : MonoBehaviour {

void Start () {
// scale relative to self space or object space
this.transform.localScale = new Vector3(3f,3f,3f);

// scale relative to parent space
this.transform.localScale = new Vector3 (2f, 2f, 2f);

// flip game object
this.transform.localScale = new Vector3 (-1f, 1f, 1f);

}

void Update () {
// scale continuously
this.transform.localScale = this.transform.localScale + new Vector3(1f,1f,1f) * Time.deltaTime;
}
}