hi, i need help, i’ve noticed this issue where my player character is a DontDestroyOnLoad object, but then when i grab other regular objects i make them child objects of my player so they move with my player, but then after dropping those objects, even when i added the transform.parent = null; they keep inside the DontDestroyOnLoad folder, and when i change the scene, those objects get carried without destroying. how do i prevent them to be in the DontDestroyOnLoad? i don’t want them to get destroyed right when i drop them, just at the next scene load, i’ve noticed that i can drag them out in the inspector, but how do i do it via script? transform.parent = null don’t work for that.
You should be able to move it back to the main scene like this:
SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene());
1 Like