How to add a grid building system in my game?

Hello there everyone I was wondering if anyone knows how I could potentially create a grid based building system for some sort of game like sims city, kingdoms and castles and others like them as of now all I care about is being able to place cubes on the grid and such and also the areas the players mouse is over on the grid will light up I don’t care about anything else but being able to place on the grid and make it glow with the mouse.

thank you in advance :slight_smile:

I do a grid snapping setup in my RTS project here: Unreal Engine 4: RTS :: Episode 10 - Follow Cursor - YouTube

The main functionality starts around the 8 minute mark with the lead up functionality. The actual grid snapping occurs I think around 22 minutes but I suggest watching the whole thing from the 8 minute mark. This is for a preexisting project but hopefully it will give you enough information to help adapt it to your project and needs.

thank you I see if it works

Hello. Curious if you know of any tutorials to help me out. I am also trying to build along a grid with modular pieces, however I want it to be avle to automatically generate a house from the predetermined pieces. I know there are some tutorials where they explain something similar for “embeded for loops” but this gives the house system only the ability to build in rectangular form and doesnt show how I would include rooms inside the house. Id like to give the variables x y and z, telling it how large the grid is, but not using all the blocks on the outside of the given grid. Giving it a not so rectangular shape overall. Thank you in advance.