Object reference become null after blueprint compiled

The situation may be like this:
There are several objects derived from UObject, UObjectA, UObjectB, UObjectC.
UObjectA is the highest level, it’s an asset and contains multiple UObjectBs and marks them UPROPERTY, UObjectB contains multiple UObjectCs and also marks them UPROPERTY.
UObjectC supports Blueprintable and has several derivations.
Besides, there is another module that works on the editor, to manipulate UObjectA(this may cause some errors but I don’t find, or maybe the way to create the UObjectC, I’ll it say later).

The issue occurs when UObjectB’s UObjectC references are bp instances. After compiling the BP, the object pointer to UObjectC in UObjectB becomes null.

The editor module has edNode of UObjectB and edNode customized to contain all of UObjectB’s UObjectCs’ slate elements. The construction of these UObjects all uses NewObject method, giving the outer right. the UClasses of BPUObjectCs are getting from AssetRegistry module.

I found there is a reinstance step when compiling, but don’t know how to do it.

I hope someone would help me out.

I’ve solved it. The slate doesn’t use FGCObject for referencing and the BP Class generating using the DuplicateObject Method :joy: Changing to NewObject would fix

1 Like