Hey guys, I really need some help.
I have a C++ Save System that I made, and it has worked since a very long time, no problems.
But since I updated my project to 4.23, the system broke.
I’m trying for over a day to find out whats going on and I just can’t.
I have a few suspicions but I’m not sure, I’ll first explain how my save system works then my suspicions.
First, I save the relevant actors references within an Array (and more information within ActorRecords, not relevant for this case)
After this, I open a new level, start it and make that level load the relevant save file… ok, it works just fine up until this point.
Next, I compare every actor reference from the array to the ones in the level, deleting the ones that are not found within the array (dead enemies, picked up or used items, etc…) and creating actors from the array that were not found within the level (spawned enemies during runtime, etc…)
Then I load their ActorRecords and etc…
So, whats the issue?
Before 4.23, the game used to match the references saved within the array to the ones in the level, so for example: PlayerCharacter wouldn’t get deleted because he would exist both in the array and in the level, matching them perfectly and updating their values (works just fine on the 4.23 editor, and in previous versions’ compiled builds), see the log here as an example:
[SPOILER]Purges actors without reference in the Array but that are present in the Level.
[2019.09.19-06.17.44:464][102]LoadGameLog: Display: BP_WeaponSpawn3_53 has no loading reference, purging it…
[2019.09.19-06.17.44:464][102]LoadGameLog: Display: BP_WeaponSpawn4 has no loading reference, purging it…
Creates actors which references were found in the loaded Array but not in the Level.
[2019.09.19-06.17.44:484][102]LoadGameLog: Warning: Creating Actor Base_Spear01_C_2 of class Base_Spear01_C.
[2019.09.19-06.17.44:485][102]LoadGameLog: Warning: Creating Actor Base_Spear01_C_3 of class Base_Spear01_C.
Loads player successfully.
[2019.09.19-06.17.44:485][102]LoadGameLog: Loading actor PlayerCharacter_C_0…
[2019.09.19-06.17.44:486][102]LoadGameLog: Warning: PlayerCharacter_C_0 has 0 spells.
[2019.09.19-06.17.44:486][102]LoadGameLog: Warning: PlayerCharacter_C_0 has 0 items.[/SPOILER]
Now, within the compiled build of 4.23, the PlayerCharacter is getting purged because the reference inside the level does not match the reference inside the Array, then the reference inside the array is also created, like this:
[SPOILER]Player inside the level gets deleted because it doesn’t match the reference in the Array
[2019.09.19-06.26.35:765][871]LoadGameLog: Display: PlayerCharacter_C_2147481494 has no loading reference, purging it…
Player gets recreated because the array reference is not found within the level.
[2019.09.19-06.26.35:766][871]LoadGameLog: Warning: Creating Actor PlayerCharacter_C_2147482312 of class PlayerCharacter_C.
Player fails to load.[/SPOILER]
Note how in the first log, the player character is named PlayerCharacter_C_0, with “PlayerCharacter” being my blueprint’s name.
In the second log, which fails, the PlayerCharacter has this gigantic number after his name PlayerCharacter_C_2147481494 and the other PlayerCharacter_C_2147482312
I suspect UE4 changed something related to this or the GC is now clearing the references within my Array, neither of which helps me deal with this issue.
I hope anyone can help me, its extremely complicated to explain how everything works and I’m willing to share more details as necessary, I didn’t provide code snippets because it is quite huge and would make this post even bigger and harder to explain.