So I have an empty that is holding scripts. This is initiated on the first level (menu) I then use DontDestroyOnLoad to bring it through to the next level as it has some script functions that need to be executed in that scene.
Where I am having the trouble is trying to find GameObjects in that next level.
public void ClickStartSeq (){
//Pulls in tracking data for each object
GameObject PhoneTrack = GameObject.Find("PhoneData");
Debug.Log(PhoneTrack);
//PhoneTrackingData = PhoneTrack.GetComponent();
GameObject HelmetTrack = GameObject.Find("HelmetTrack");
Debug.Log(HelmetTrack);
//HelmetTrackingData = HelmetTrack.GetComponent();
GameObject JerseyTrack = GameObject.Find("JerseyTrack");
Debug.Log(JerseyTrack);
//JerseyTrackingData = JerseyTrack.GetComponent();
GameObject AutographTrack = GameObject.Find("AutographTrack");
Debug.Log(AutographTrack);
//AutographTrackingData = AutographTrack.GetComponent();
//GameObject TunnelTrack = GameObject.Find("TunnelTrack");
//Debug.Log(PhoneTrack);
//TunnelTrackingData = TunnelTrack.GetComponent();
GameObject VideoAudio = GameObject.Find("VIDEO");
AudioSource audio = VideoAudio.GetComponent();
audio.Play();
StartCoroutine(StartSeq()) ;
This method is called on a button click after the scene has loaded.
What is weird is that according to my Debug, the HelmetTrack and the AutographTrack are being found, where as the others are returning a null value.
Any ideas on what the issue is would be much appreciated!!
↧