Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

How to access objects that was not destroyed on load?

$
0
0
I have a game object called "Keep" that's the tag "Keeper" and is meant to send data between scenes and is not destroyed on load, it has a script attached to it called SaveMe.cs In SaveMe.cs... void Awake() { DontDestroyOnLoad(this.gameObject); } I try to access the object in another scene with `GameObject.Find("Keep" or GameObject.FindWithTag("Keeper")` In another script from another scene... private void Awake() { keeper = GameObject.Find("Keep"); } It comes with NullReferenceExecption error not set to instance of an object

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>