when settings EditFixedSize, we just want the user to not edit the array size that we planned to set in C++.
But, as of today, if I set an array of 2 elements with EditFixedSize.
Create a BP on it
Change the C++ to add a 3rd element
Open the BP => 2 element and you can’t get the third one.
Can you elaborate on what’s happening? It sounds like the size of the array is not updating in the blueprint when it is updated in the code, is that correct? If you create a new blueprint after updating the code does it have 2 or 3 elements? How are you using EditFizedSize? Can you post a code snippet to show how you have your class setup?
I’m not seeing the same behavior. When I copied your code into a class I had to add “” after TArray to get it to compile, but when I created a blueprint of my class the blueprint and instance of the blueprint in the viewport would update each time I added a new element in the constructor.
I updated my comment so everything appears as I wrote it. the output that you were seing was not exactly what I wrote.
In all case, could you please share with me the property that you set in C++ so I can understand the differences if there are some and test it on my side?
Does the Array that you used had one element before the BP was created or was it empty?
In the constructor for MyActor I then added an element to the array:
MyArray.Add(what);
After compiling the code I created a blueprint based on MyActor and added an instance to the viewport. At this point I could see the one element of the array in the details panel. Back in the constructor of MyActor I added a second element to the array and compiled again which triggered a hot reload in the editor. After the hot reload the instance of the BP in the viewport showed 2 elements.
I’ve not heard back on if the sample code I provided was able to help you with setting up your array. I will be marking this post as resolved for tracking purposes however if you’re still having problems seeing new elements of an array after compile please feel free to comment on this post and we will investigate further.
Using an object instead of an actor I did see some inconsistency with the size of the array updating after a hot reload. I have bugged this behavior (UE-14992) for further investigation. In the cases where the array did not update I found that creating a new instance of the blueprint after the hot reload would show the correct number of elements. setting the UObject* as a UPROPERTY() I also found reduced the frequency of the inconsistency occurring.
I tested adding array elements in 4.9.2 and my blueprint instance updated with each addition. Let me know if you’re still seeing this in the latest engine version and what you’re doing in code/editor.