Resizing array of classes and then saving gives warning

I currently have a struct that takes a class. I then save this class without anything in it (NULL) and any time I later try to get the save object it shows the warning:

LogUObjectGlobals:Warning: Failed to find object 'Object None.None'.

From testing I find this gives the warning whenever an empty class has been saved. For my inventory I need to be able to resize an array and fill with empty classes and keep that structure when I save. Is there any way I can fix this?

Edit: Here are the steps needed to reproduce on a fresh project

  • Create new project
  • Create Save Game
  • Add two variables inside the save game, one a string with any text inside and the second an array of actor classes.
  • Open the player character and repeat what is shown in this image.
  • In the output log it will say LogUObjectGlobals:Warning: Failed to find object 'Object None.None'.

It looks like resizing the array causes this warning. How can I and others get around it?

My current engine version is 4.14.3. It also occurred in the first 2 releases of 4.14.

This warning didn’t occur in UE 4.12.5 or 4.13.

hm, just for understanding. why do you need to save the class if its empty?
and what else is inside the struct?

If I have 30 inventory slots and numbers 1, 9, and 15 have items inside, when I reload the inventory after saving I want those items to still be at 1, 9, and 15. The way my inventory is based off is the item class and stack amount in a slot. So for slots without items I leave the class and stack at nothing but they still must be there as filler inbetween the slots that have items.

I suppose one way I can solve is by having a dummy class, but that wouldn’t be my preference. This warning only appears after my upgrade to 4.14 from 4.12.

The warning happens whenever I access my save game object. I have a pure function that I use to get the save game and when using it to print a separate unrelated boolean it will still warn me.

The only thing that would make sense is if the function that gets my save game was compromised, but the base of it is done in c++ so there shouldn’t be a reason for that.

Additionally most if not all of my inventory functions check if the class is valid but maybe a couple slipped past. I will check anyways, thanks for the suggestion!

It shouldn’t return a warning unless you are actually trying to access the contents at that empty index. I’m sure you are accessing every index so you can see if there’s something in it, but you should be able to prevent the warning by using IsValid or !=None on the class variable for each index before actually trying to do something with it.

i know this is not helpful for your problem, but i also only got the warning, after updating from 4.13 to 4.14. in 4.13 it worked without warning.

Thank you for this information, I will added it to the main question

So I ended up posting the question to Reddit with different phrasing and someone helped me fix it. This is a month after I first had the problem and I’ve just tried to ignore it since then. I had hopes 4.15 would change things but it didn’t.

The gilded comment in this thread helped me solve the issue.