Values for component properties not actually being deleted

I have a c++ component with a property exposed to the editor:

UPROPERTY(EditAnywhere)
TArray<FVector> ThrusterLocations;

I have added this component to a blueprint class and I can edit the values of the array:

62582-ue4bugpic.png

At one point I added 4 values to the array and then I deleted them and took the screenshot above.

The problem is that the 4 values that I deleted are obviously still being loaded into that array at runtime. I have verified this through on-screen debugging and by stepping through the c++ code that iterates that array.

If I change the default values pictured above they DO propagate to runtime.

If I add more values they DO NOT propogate to runtime.

The editor crashed when I removed the UPROPERTY macro and tryed to compile through the editor. It crashed again when I added the macro back and tried to compile. I was doing this in an attempt to reset whatever datastore these values are saved in.

So you edit defaults right? Where do you check the array? When you spawn it?

Hey BerenCamlost-

Can you elaborate on what exactly is happening? Creating a scene component class and adding it to a blueprint, I was able to add/delete elements in my array without issue. How and when are you deleting the array elements? Are you adding/deleting them from inside the blueprint or while running PIE?

Cheers

I am editing them from inside the blueprint (remind me what PIE stands for?). Graphically everything is working just fine. So when I make changes to the values at index 0,1,2, or 3 the changes show up at runtime. The problem is that the values at indexes 4,5,6, and 7 are still being loaded at runtime. If, using the gui from within the blueprint, I once again add values at indexes 4,5,6, and 7 and then edit the values to be different than the values I used previously then I see the original values instead of the new ones.

GUI State 1. Defaults in c++ constructor. Runtime state is in sync:

0: -50,50,0
1: 50,50,0
2: 50,-50,0
3: -50,-50,0

GUI State 2. My first modification to the values made through the blueprint gui. runtime state is in sync:

0: -50,50,0
1: 50,50,0
2: 50,-50,0
3: -50,-50,0
4: 25,0,0
5: 0,25,0
6: -25,0,0
7: 0,-25,0

GUI State 3. I then deleted these new values (this is where the screenshot is from) but the runtime state matches GUI State 2:

0: -50,50,0
1: 50,50,0
2: 50,-50,0
3: -50,-50,0

GUI State 4. I then tried re-adding different values at those indexes with the gui but the runtime state matches State 2:

0: -50,50,0
1: 50,50,0
2: 50,-50,0
3: -50,-50,0
4: 10,0,0
5: 0,125,0
6: -3,0,0
7: 0,-456,0

Yes I edit the defaults. I check the array while the game is playing.

This screenshot shows my debug lines. There should only be 4 of each color (since there are only 4 values in the array according to the gui) but there are 8. The 4 that should not be there are in the exact place they should be if I hadn’t deleted the last 4 values of the array.

62643-ue4bugpic2.png

By PIE I was referring to “play-in-editor”. So you start with 4 default values in code and then add 4 values inside the editor and run play-in-editor to test. Then you remove the 4 values added and run play-in-editor again, but the removed values are still present? Am I understanding the steps you’re taking to creating/removing the values to/from your array correctly? If there is anything I’ve missed can you list out the steps you used so that I can try to reproduce what you’re seeing on my end?

You have everything right. The only other step would be the step I mentioned in GUI state 4 where I re-add 4 values and, when I PIE, the old values (from GUI State 2) are still present rather than the new values (from GUI State 4).

I’m still not seeing the behavior you’re describing. If possible could you send me your project to test this issue directly? If you’re able to upload the project to dropbox you can send me a private message on the forums with a link to download it for privacy.

Is it alright if I remove the contents of Binaries/Win64 and Content/StarterContent to reduce the size? My isp caps uploads at 4mbps.

The important folders are the Config, Content (minus StarterContent), Source, as well as the .uprjoect file. Binaries, Intermediate, Saved, and the .sln and .suo files can all be stripped out.

I linked you the project by the way.

After adding/removing additional elements to the thruster location array I was left with the original 4 thrusters. Here are the steps I took to test

  • placed instance of Racerwithhoverpad into the level and play in editor (4 thrusters)
  • exit play in editor and open Racerwithhoverpad blueprint
  • added 4 elements to Thruster Location array and set them to the values you posted
  • play in editor again (8 thrusters)
  • exit play in editor and reopen the blueprint
  • click the drop-down arrow next to the elements added to delete them
  • compile the blueprint and play in editor again (back down to 4 thrusters)

After doing these steps and removing the thrusters from the array I was left with the original 4 thrusters along the corners of the the mesh. Can you let me know if following these exact steps if you still have 8 thrusters ?

I created a new instance of the blueprint and followed your steps and everything worked correctly. The old instance still has 8 thrusters though:

62820-ue4bugpic3.png

The only thing I did differently when the problem started was that I used the reset button (yellow looping arrow icon) to go back from 8 to 4 thrusters. However, I tested that method with the new instance and it worked correctly. In any case, I can at least get around the problem by using a new instance.

Since using a new instance works to solve the issue for you I am going to mark this as fixed for tracking purposes. If you have the same issue occur with the new instance as well feel free to comment here to reopen the post for further investigation.

Cheers