Get number of object in the Scene

Hello guys,
i looking in this forum an in the web for an solution to get the number of the objects in the scene.
I create an virtual exhibition and i want to have an time machine, at this point i got an Gui to change the year. When i change the Year the objects from the next year will be load, but if i want to go back to the last year i dont want to create all of the existing objects again.

Is there something like scene.length to get the number of the existing objects?

You could use scene.meshes.length

2 Likes

thank you.
But it didnt worked like i expected that.

I thougth i can do a l loop to get all names but i cant use scene.meshes.getChildMeshes.

Do you know an way to get to the names?

Could map it to an array of names like this if that’s what you want.

const names = scene.meshes.map(mesh => mesh.name);
1 Like