scripting SetActive(true_false)?

Hey guys i have a problem with getting a deactivated gameobject to be reactivated

When i enter my atv everything works fine accept for the player it is still in the scene but turned off.
my exit script can`t find it when i press F so how can i fix this?


using UnityEngine;
using System.Collections;

public class Exit_ATV : MonoBehaviour {


    public GameObject Player;
    public GameObject ATVplayer;
    public GameObject ATV;
    public GameObject Trigger;
    public GameObject TriggerATV;

    // Use this for initialization
    void Start () {
        Player = GameObject.FindWithTag("Player");
        Player = GameObject.Find("Player");
        ATVplayer = GameObject.FindWithTag("ATVplayer");
        ATV = GameObject.FindWithTag("ATV");
        Trigger = GameObject.FindWithTag("Trigger");
        TriggerATV = GameObject.FindWithTag("TriggerATV");
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.F))
        {
            Player = GameObject.Find("Player");// Here is the problem! Player cant be found becouse it is set to SetActive(false) by my enter atv script
            Player.SetActive(true);
            ATVplayer.SetActive(false);
            ATV.SetActive(true);
            Trigger.SetActive(true);
            TriggerATV.SetActive(true);

        }
    }
}

There are multiple solutions to this … here are 2:

  1. Drag the GameObjects to the slots of the script (they are all public) and don’t use GameObject.Find() in Start(). or
  2. Leave all the GameObjects active in the Inspector, use GameObject.Find() in Start() and deactivate the unwanted directly after finding them (also in Start() )