MissingReferenceException: The object of type 'ConversationController' 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.

Hi, I encountered this problem when I tried switching to another Scene and after a while I went back again to previous Scene

I have a script that creates a GameObject and add a Component to it,
since upon switching to another scene, Objects and components
are destroyed and trying to load the other scene which dynamically recreate the game objects and add components to every scene with the same name that is previously destroyed…

then after that i got this error

MissingReferenceException: The object of type ‘ConversationController’ 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.

you can keep an object between scenes i believe using object.DontDestroyOnLoad