title: The 'this' keyword in Unity3D scripts (c# script, JavaScript)
body: <p>I'm confused that:<br /></p>
  
  <h2>CODE (CS01.cs)</h2>
  
  <p>The script is attached to a simple Cube object.</p>
  
  <pre class="lang-c# prettyprint-override"><code>using UnityEngine;
  using System.Collections;
  
  public class CS01 : MonoBehaviour {
  
      // Use this for initialization
      void Start () {
          Debug.Log (this); //--&gt; Cube(CS01)
          Debug.Log (this.GetType()); //--&gt; CS01
          Debug.Log (this.GetType() == typeof(UnityEngine.GameObject)); //--&gt; False
          Debug.Log (this == gameObject); //--&gt; False
          Debug.Log (this.name); //--&gt; Cube
          Debug.Log (gameObject.name); //--&gt; Cube
          this.name = "Hello"; // --&gt; Will get the gameObject's name changed to 'Hello'
          Debug.Log (gameObject.name); //--&gt; Hello
      }
  
      // Update is called once per frame
      void Update () {
  
      }
  }
  </code></pre>
  
  <p>1> Will <code>CS01</code> be an script object right?</p>
  
  <blockquote>
    <p><b>DOC</b>: Scripting inside Unity consists of attaching custom script
    objects called behaviours to game objects.</p>
  </blockquote>
  
  <p>2> In <code>Component</code> object, variables like transform, renderer, rigidbody are referenced to the components of <code>gameObject</code> this <code>Component</code> attached to. So in the script, <code>this.renderer.material.color = Color.red;</code> is equivalent to <code>this.gameObject.renderer.material.color = Color.red</code>. However, the description of variable <code>name</code> in the document <code>name: The name of the object.</code> only tells it's the name of the object. <br />
  3> So, how to understand the code above? Does the variable <code>name</code> also return the <code>name</code> of the gameObject this script attached to? <br />
  4> <code>this</code> means the script object but not the gameObject the script attached to, right?</p>