How to get the number of nodes that have the same name (+ 1)?

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

I have a button, when i press that button, an instanced scene spawns on the screen with the name being (“object” + 1). After every press i want to know how many nodes i spawned and how are they named.
How do i know that?

:bust_in_silhouette: Reply From: GunPoint

Solved. I made a variable which counts the number of clicks then add to the name that number