Data organization question. Array of Structures?

I need array of actors connected to other actors where same actors can appear multiple times.
I tried maps but key must be unique so it is no go for my purpose.

I assume I need to create custom structure with only two variables as single links on my objects. And then I need to create array of that structure.

Any suggestions?

Sounds like you’ve answered it already:

structure with only two variables as single links on my objects:

image

And then I need to create array of that structure.

Yeah sounds about right but I encountered strange issue…

This is how I add records to the array:

It works fine while Im placing blocks in a row:

But when I connect 2 or more blocks to the same block this start to happen:


And I dont know why… “Halp!” :slight_smile:

It is different structures created on the flight… there should be no connection between them to delete references in other structures…

Update: This issue happens even with only 2 blocks just with some time passed

Seems like I have very similar issue like in this topic:

Log output:
[2023.08.26-01.20.28:788][ 60]LogBlueprintUserMessages: [BP_ShipEditoPlayer_C_0] Child Block BP_FrameBlock01_C_0 Connected to Parent Block BP_CoreBlock01
[2023.08.26-01.20.34:148][703]LogBlueprintUserMessages: [BP_ShipEditoPlayer_C_0] Child Block BP_FrameBlock01_C_0 Connected to Parent Block BP_CoreBlock01
[2023.08.26-01.20.39:463][335]LogBlueprintUserMessages: [BP_ShipEditoPlayer_C_0] Child Block None Connected to Parent Block BP_CoreBlock01

I did absolutely nothing. Just sit and press “print log”.
After 10 seconds first variable in data structure became empty :frowning:
Its always first variable that should contain link on component. And it does… first couple of seconds…

if a parent has more than one child you need a struct per child?

I want to store a map of connected objects.
Child need to be able to connect to several parents.
Which leads me to structure per each child.

Is there another solutions? Im open to suggestions :slight_smile:

  1. In this context what is a parent and what is a child?
  2. All you need is connected actors?

Parent is a block that is already part of a ship. Child is new block that player want to add.
I mean I understand this is not regular parent-child concept. I just use same words to simplify understanding.

IMO a Map <parent, child array> should be enough, but only for this instance.

Do you plan to allow the player to save this?

Yes for save.