Okay, I made a game, in this game I have stores, the stores have texts within them I link these texts using codes such as :
public Text TextObjectName and I link my texts in the game engine, and it all works well and fine, until I load a new scene while playing the game, when that happens the text is not linked anymore, the text does not change and I get an error saying :
MissingReferenceException: The object of type ‘Text’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
but if I start my game from that scene it works fine, it is only when I load it while I am playing when I get this error and it doesn’t work, which is confusing me a lot, and I don’t know what to do.
if you need to know I use the code: SceneManager.LoadScene(SceneNumber); and yes the arrangement of the scenes in the build index is fine and the scene is opening all well except for the texts.
if you know anything about how to solve this please tell me.
EDIT: the texts that are not being linked are texts that are children of a button, I don’t know if that helps, but the buttons are also linked in my code, and it also doesn’t work, I think it might be the use of public gameobject in the case of the buttons and the public text in the use of the text, is there an alternative way that I can link my objects in a way that when I change scenes they stay linked???