My grid only works when I enable all the spatial UI in it, if I try to enable each grid slot individually they don't work, why?

Hi, I’m making a city builder game and I’m having problems with my grid system. I’m trying to enable each grid slot individually rather than having the whole grid enabled from the start. I run a for each loop to enable all the grid slots and I can interact with the grid but when I try to individually enable one slot I cant interact with the grid.

Enabling all grid slots


UnrealEditor_4nIFQOCyQt

Enabling only 1 grid slot


UnrealEditor_8CsC9HMR4D

When setting visibility to enabled on 1 grid point the widget doesn’t receive any input.

My gut feeling tells me that what the mouse is over is not this:

Debug it, manually trace against the visible widget - what do you actually get?


Out of sheer curiosity - what made you choose world space widget components as candidates for grid slots?

yeah your right I had a print string which showed me which grid point it is getting from the array then I hovered over the grid point in the world and it wasn’t the same one why is that happening?

And I chose to do my grid as a widget mainly because I just did a UI course at my university and feel pretty confident in it haha, also taking the city skylines grid as my main inspiration which looks like its UI.

Merely asking. Haven’t seen it done like this before. I’m torn between the two scenarios:

• it will be just fine
• you’ll run into a really annoying issue / bug / limitiation and you’ll need to refactor the entire thing

No inbetweens.

On topic, step through the tile generator - I sense you create more tiles than needed.

(post deleted by author)

It isn’t completely UI based as the widget is still attached to an actor so hopefully it wouldn’t be too hard to reformat if needed.

I did create the grid generation using a YouTube tutorial as I spent too much time trying to figure it out myself and needed to move on so I don’t really understand how it works if I’m being honest but ill attach images of it below.


Sorry about the screenshots, not currently on unreal and these are the only ones i have of it if you need better ones il be able to post them tommorow

Better screenshots of grid generation

This entire scripts boils down to:

Do count what you’re spawning vs the number you’re expecting to have - do they match? Debug it, give them IDs, trace, see what you’re hitting.

I replaced my current script with that macro, wish I knew about it from the start thanks for showing me it though.

But I’m still having the same problem, the right amount of grid points are spawning but for some reason the grid point which it says it spawned isn’t the same one that is actually visible. It says its spawning grid point_0 but when I hover over it in game it comes up as grid point_2 and I can’t interact with it.

Edit: when I say spawning grid point 0 I mean just setting it visible as I’m spawning all of them but only trying to make the first one visible