[A small test] Can Unity SceneManager's Unload unload nodes that have been moved out of the Scene?

Because there is an Unload API in SceneManager, I suddenly came up with a problem.
If the default scene a is currently running, and then a new scene b is loaded using addtive mode, then the things in scene b are removed. Will the removed things be removed when the scene is unloaded through SceneManager.unload? Uninstall it.
So I did a test:
Insert image description here
the default scene 3, the Addtive mode loaded scene 1 and scene 2
Insert image description here
, and then I uninstalled scene 1, and it seemed to be uninstalled very cleanly.

Insert image description here
Based on Figure 1, I moved nodes 1 and 4 to the default scene 3
and then uninstalled scene 1.

Oops, Scenario 1 was uninstalled, but Node 1 and Node 4 did not change
and no error was reported.

So we come to the conclusion that Unity uninstalls scenes in units of scenes.
Then the question arises. If the logic is reversed and a node is created in a scene that has been loaded, what will happen when it is unloaded.

Insert image description here

Insert image description here

You can see that it is still uninstalled in units of scenes.
Unity's scene management will be based on scenes . Rather than content as the unit.


Programming is endless.
Everyone is welcome to communicate. If there is anything unclear or wrong, you can also chat with me privately.
My QQ 334524067 God-like Didi

Guess you like

Origin blog.csdn.net/qq_37776196/article/details/118677818