Hi all,

This is just the second day playing with Godot, but I'm not pretty sure if what I did is the correct way of Spawning or Creating new instance of objects.

What I did was, I created a MeshInstance in the editor , put it somewhere far away and set the visibility to false as shown in the image below, those ships are not visible.

This is my sample code on spawning the create MeshInstance in code ( C# ).

And so far the output is good.

Kindly reply if there is other ways which is much more efficient or correct way when spawning an object in Godot, rather than setting the object visibility to false in the editor and I just duplicate it in code.

Many thanks in advanced any hint will be very much appreciated _y

Dexter

@DexterZ said: Kindly reply if there is other ways which is much more efficient or correct way when spawning an object in Godot, rather than setting the object visibility to false in the editor and I just duplicate it in code.

Check out the official Instancing tutorial. The best-supported way of accomplishing this is to move part of the node hierarchy you want to duplicate into a new scene, then instance the scene. You can instance the scene in the editor as described in the tutorial, or you can instance in code -- whichever makes the most sense for a given part of your game!

Hi llasram ,

Awesome bro! many thanks for the fast reply! very helpful and informative _y

2 years later