Populating an array with blueprint objects in editor. Best practice?

I am trying to make a menu level with 3d models as the menu items, which you can then scroll through left and right.
To test things out I made some very simple blueprints which represent the menu items.
I named the blueprint ObjectBase, and then made several blueprints which inherit from ObjectBase.
Also I am using only blueprints to code this, and not C++.

The initial obstacle I came across is getting these items into an array in game properly.
The blueprint MenuController has an array variable of ObjectBase, from which it will display them all lined up in a row.
Later on there might be objects added to or removed from the array with code.
I want it in such a way that a level designer would not have too much trouble filling the menu with items, and arranging them as he sees fit.
Also I want the code to be clean and understandable for fellow programmers.

The first solution I came up with is simply dragging all blueprints into the level, and using a “Get all actors of class” node.
In order to arrange them I would have to write complicated code with “For each” and “Equal” nodes.
Also this means every menu will be bound to a level, and it needs to be dragged manually into the level.

The second solution I made was simple “Spawn” nodes which connect to a “Make array” node.
This makes it easier to arrange the array, but it does not feel like a great way for a designer to fill in menus, especially if there are a lot of them.

Building on the first two solutions I could make use of the level blueprint.
With this I could drag the objects in the scene, and make references in the level blueprint.
But that would only bind the menu even more to a level, and unable to reuse in other levels.
I would prefer to use the MenuController blueprint to initialize the menus.

The third solution was to make a datatable which is then used to initialize the menu.
But when assigning values in the datatable I get the notification “Editing this value in structure’s defaults is not allowed”.
From what I understand this notification is by design since version 4.20.
MenuNotification

After some searching I found that simply referring to classes instead of instances in the structure fixed it.
MenuStructToClass

With this I ended up with the final solution to this obstacle.

I suppose this is an easy method to create the initial menu.
But if a new level would be opened, then maybe a different configuration of the menu would be needed, while datatables are read-only.
And this could even change during gameplay.
So from a brief glance at further solutions, I would have to dive into savegames, writing to xls files or coupling a database.

But before I do that, are datatables the the way to go?

1 Like

Data tables aren’t writable without a plugin ( or C++ ). XLS and DB is plain nuts :slight_smile:

You could use a data table for the initial config, and then save games for the changes from that. What’s wrong with that?

Thanks for the feedback.
I will stick to data tables for the initial config for now.
I did not mean to imply there is anything wrong with any of these methods.
These are just a few of the alternative possibilities I came across, and did not look to deep into them yet.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.