Sitemap
CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

Member-only story

Godot 1–01: Instantiating & Moving 3D Units (Godot 4/C#)

21 min readOct 22, 2024

--

Image made by AI

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:

Download a version of Godot with .NET support, to be able to program in C#! :)

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

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)