warning reference will be nullptred bug
I have described the problem here: https://answers.unrealengine.com/questions/716269/warning-reference-will-be-nullptred.html
now I think it is a bug, so I am reporting it here, with a way to regenerate it. the problem is that some minor changes to base class may cause some pointers (of this class or its derived classes ) to be nullptred after build is done. this happens onley in the current opened level. other instances in other levels seems to be fine.
this happens when I get a warning like this one:
Steps to Reproduce this bug:
this bug may cause big miss when level has many pointers , like our case. waiting for fix. Thank you.
This has been a real pain for us so I did some debugging. I have found that most of the hot reload process seems to proceed as expected (or at least, as far as I can infer what is expected), however when we hit UEngine::CopyPropertiesForUnrelatedObjects, the class of the old object has lost references to any properties defined in the C++ super class.
i.e. lets assume we have a c++ class, "MyGameModeBase", and a blue print, "BP_MyGameMode". If we modify "MyGameModeBase" and click the cog to hot reload, the "BP_MyGameMode" class will be correctly detected, submitted for reinstancing, recompiled and eventually for each object of type "BP_MyGameMode", a new instance will be created and "CopyPropertiesForUnrelatedObjects" will be called. This, I assume is all correct.
However, if we allow the function to dump the properties of both the old and new objects, the old class will have no record of any of the properties of "MyGameModeBase", where the new class will. I believe as a result of this, the property values are not copied from the old instance to the new instance, and thus get reset to defaults.
It's also worth noting that any objects that are currently not loaded will not be reinstanced at this point (obviously!). This explains why it works if not hot reloading (or indeed, if you hot reload before loading the object). When the editor is reloaded, and you open the object, unreal seems to pick up on the fact that its type is out of date and triggers a reinstance. As before, this calls CopyPropertiesForUnrelatedObjects, however in this case both the old and new object classes have a correct list of properties.
I hope this accelerates the process of this being fixed. Whilst I will continue to dig, I find it amazing that this isn't considered extremely high priority. A reproducible bug that causes extensive loss of data as part of the core workflow in a content creation package. As a game developer, we wouldn't even consider shipping something with this kind of floor, let alone ignore it. And the fact that a coder with only a month of Unreal experience can get as far as the above in a few hours kind of suggests an experienced engine programmer should be able to work out the problem.
answered May 11 '18 at 09:31 AM
The bug was fixed some time ago, but didn't make it into the 4.19 release. It will make it into the 4.20 release though.
For a fix in the meantime, your UObjectCompiledInDefer() function should look like this:
Hope this helps,
answered May 15 '18 at 03:34 PM
Steve Robb STAFF
Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here https://issues.unrealengine.com/issue/UE-52220 . You can track the report's status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.
answered Nov 09 '17 at 08:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here