Member-only story
Godot 1–01: Instantiating & Moving 3D Units (Godot 4/C#)
This is actually easier than you think!

One of the key moment of any game dev project is when you start to combine your scenes together, and create some NPCs, mobs or objects at runtime to populate your environments.
And, of course, you usually want to use some randomness to avoid having too similar visuals…
So, in this tutorial, we’ll see how to instantiate some pre-made scenes using C# code, and also how to use Godot’s built-in random utilities to place or move units in a basic scene. We won’t talk collisions or navigation, we’ll just be doing transform-based translations; but we’ll also discuss some quick tricks for getting better randomness in a video game.

As usual, since we’ll be coding our logic in C#, make sure that you have a version of Godot with .NET enabled:

And of course, don’t forget that you can get the demo scene and all the assets from this demo on my Github 🚀 with all my other Godot tutorials.
Also, if you enjoy my content, don’t hesitate to leave a few claps at the end to support my work — thanks a lot! 👋
Checking out the demo scene
To start off, let’s have a quick look at the scene and assets I prepared for this tutorial.
Here, I’m going to use some assets by Kenney for this demo, and more precisely his Space Kit:

This pack contains a good amount of low-poly cartoony 3D models, with both environment props and little spaceships, so those will be really neat for doing our little units :)
After I imported the GLB spaceship models from Kenney’s pack, I used Godot’s advanced import editor to replace one of their…