Enable/disable a GameObject component from a script [Unity3D]
<p>I need to take the value of a boolean (put in a variable called "bouclier") set in one script to enable or disable a GameObject.</p>

<p>The variable is in game object Player (bottom right here):</p>

<p><a href="https://i.stack.imgur.com/Pb2VM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Pb2VM.png" alt="enter image description here"></a></p>

<p>And I need to enable of disable this game object ("Bouclier01"):</p>

<p><a href="https://i.stack.imgur.com/ubrhG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ubrhG.png" alt="enter image description here"></a></p>

<p>To do this, I attached a script to game object "Bouclier01". Here it is:</p>

<pre><code>using UnityEngine;
using System.Collections;

public class ShowBouclier : MonoBehaviour {

    public GameObject Bouclier01;
    public bool bouclier;

    // Use this for initialization
    void Start () {
        Bouclier01 = Bouclier01.GetComponent&lt;GameObject&gt;();
    }

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

        Bouclier01.enabled = false;
        if (bouclier == true) {
            Bouclier01.enabled = true;
        }
    }
}
</code></pre>

<p>I must be missing something, because this comes up with this error message:</p>

<p><a href="https://i.stack.imgur.com/m9iWg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/m9iWg.png" alt="enter image description here"></a></p>

<p>Any idea how to properly accomplish this?</p>