Grid system in construction phase

Hi! I need an advice on how to make grid system in construction phase (or any other system where i need a bunch of “Actors” or “Actor-like” objects proceduraly spawned).

Lets say i need a grid with cells like in minesweeper or civilization games. If i want to make the grid in BeginPlay it is easy:

  1. i can create BP_Cell actor, that has specific mesh, collider, its own logic and data
  2. than i create BP_CellManager, that has BP_Cell as a reference and can spawn a grid of cells when game is played

But now, it would be much easier to design level if cells are already spawned in editor without playing. How would i do that?
I guess instanced static mesh isnt the solution here, because each cell needs its own data, maybe i want to have physics with mesh, colliders etc.
Getting reference to other actor from a blueprint (that is created from c++ script) isnt possible before playing game? (i am guessing not)

I prefer c++ solutions if possible.

Please help. I am Unity dev, trying to learn Unreal :).
Thank you

make this an actor, put it in the world and use the construction script. or better yet create a function and tick ‘CallInEditor’, as construction scripts can fire multiple times which would be performance heavy on a large grid.

thank you, will try what CallInEditor does, but i dont think your solution will work.
i know that cellmanager is actor that is in the world, but how can cellmanager have reference to BP_Cell before playing. or am i wrong?
i hope i am decribing the problem so that is understood.
i can put in cellmanager:

UPROPERTY(EditDefaultsOnly, Category = “References”)
TSubclassOf(ACell) CellClass;

and than in blueprint of cellmanager i can assign a cell, but i cannot use this cellclass before beginplay. right?

the BP_CellManager, CallInEditor function spawns the grid (cells) so it can Add the cells to an array to reference them.

CallInEditor works great (i added screenshot) and it is usefull, thank you for that.

But i am still wondering if there is some way to do something like that in constructor, so that if i am changing values like NumOfCells it changes realtime in viewport?

Maybe something like this guy is doing (only problem is that his cells are instanced, so physics dont work without some kind of workarounds - i am not sure… and also it is easier if a Cell is an actor that can be easily modified in blueprints, and than spawned with manager):

But maybe with multiple static mesh components? (or child actors?) Dont know what would be the best way.

My current test project:

you can do it in the actor contruction script, just be careful because it updates when you move it etc so can run each frame.

again doable just expensive if you have many of them