Context
Instanced structs are great for holding simple data with the main advantage they have is a low memory overhead unlike instanced objects.
Problem
The problem is in StructUtils plugin's `FInstancedStruct` in a CPP-defined struct in a `TArray` on an actor component defined in CPP and implemented in BP. Populating the instanced struct in an actor BP's class defaults breaks serialization of the class defaults. The array contains only the entries from before the `FInstancedStruct`s were populated.
One workaround at the moment is to remove the BP and re-add it to the world. It then counts the indexes properly.
1.) Download and open repro project uploaded in ticket
2.) Ensure level "TestMap" is opened (should be opened by default when opening project), if not go to Content Drawer > Content > TestMap
3.) Start Play in Editor
Observe: Top left of viewport, prints out array indexes (should be 0, 1, 2)
4.) Stop Play in Editor
5.) Open "BP_MyActor"; Content Drawer > Content > BP_MyActor
6.) Click on "AC_MyComponent" in the Components tab
7.) Expand "My Array" in the Details tab under "My Component"
8.) Expand all the indexes and set each index's "My Property" to "S My BPStruct"
9.) Save and Compile
10.) Add 2 more indexes by pressing the plus button next to "My Array" and populate their "My Property" with "S My BPStruct"
11.) Save and Compile
12.) Start Play in Editor
Observe: Top left of viewport, prints out array indexes before added indexes
Expected: Prints out all array indexes, even added new ones
If it prints out the indexes properly as expected, repeat the process:
13.) Go back to "My Array" and click the trash bin icon or "Remove all elements"
14.) Add 3 indexes
15.) Save and Compile
16.) Repeat from Step 3
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-291743 in the post.