Hey guys im trying to exit the turrent but my script can not find or activate my player and my off turrent
how can i fix this ??
using UnityEngine;
using System.Collections;
public class ExitTurrent : MonoBehaviour
{
public GameObject Turrent;// the player turrent
public GameObject Player; // the player
public GameObject TurrentOff;// the scene turrent
public bool inTurrent = true;
EnterTurrent turrentscript;
GameObject guiObj;
AudioSource source;
public AudioClip audio;
// Use this for initialization
void InTurrent()
{
inTurrent = true;
Player = GameObject.Find("_SpartanPlayer");// Find Player
Player.SetActive(false);
Turrent.SetActive(true);
TurrentOff.SetActive(false);
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.E))
{
Player = GameObject.Find("_SpartanPlayer");// Find Player
TurrentOff = GameObject.Find("UNSC Warthog MK1");
SendMessage("GetOut");
Debug.Log("Getout");
}
}
// Update is called once per frame
void GetOut()
{
{
Player = GameObject.Find("_SpartanPlayer");// Find Player
Player = GameObject.FindGameObjectWithTag("Player");// Find Player
TurrentOff = GameObject.Find("UNSC Warthog MK1");// Find Player
Player.SetActive(true);
BroadcastMessage("Playertrue");
Player.transform.parent = null;
TurrentOff.transform.parent = null;
Turrent.SetActive(false);
TurrentOff.SetActive(true);
turrentscript.enabled = false;
inTurrent = false;
}
}
}