How do I know which nodes are instantiated

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By colcolkol

In the debugging monitoring screen, I see that the number of nodes exceeds the expected number, so how can I simply know which nodes are instantiated? thank you

:bust_in_silhouette: Reply From: jgodfrey

With your project running from within the Godot editor, you can view the live scene tree - which will show all instantiated nodes. To do that, just select the “Remote” tab in the “Scene” panel.

The scene tree shown there is LIVE, for the running game.

Thank you for your reply!But ,it’s not very convenient. I don’t want to check one by one. There are too many. I hope all instances are listed in a list, and it is better to add them in real time along with the process.

colcolkol | 2022-11-19 03:55

I guess I don’t understand what you’re looking for. The scene tree will show you ALL instances in a tree hierarchy. I’m not sure how that differs much from your proposed “list”.

Further, I assume these instances are being created by your code, so I’m not sure why you wonder “which nodes are instantiated” anyway… You could do something at the code level to “track” them if necessary, but again - I guess I don’t really understand what you’re trying to solve.

jgodfrey | 2022-11-19 04:14

Yes, the instances I want to find are created by code, but the problem is that although the scene tree can see all the created instances, but they are mixed with a large number of other nodes, making it difficult to track.
The code tracing you mentioned is a good idea, but I still need to write a lot of code, which is inconvenient,
So what I want to solve is how to display these nodes created by the code separately in other places, so that I can track them clearly,
Because the structure of the scene tree of my game is too deep and complex, it is difficult for me to immediately know what instances are created in the next second.

colcolkol | 2022-11-19 05:44

Maybe add each instanced node to a collection and include other important info (creation time stamp, …). Then, write a custom function that dumps that collection to the console (or to an on-screen control). That’d seemingly be simple and might help?

jgodfrey | 2022-11-19 15:19

It looks simple, thank you

colcolkol | 2022-11-20 06:02