Failed to find object

Hello,

I’m experiencing this warning message each time I run my game. Today I finally managed to track its origin but I’m not sure how to fix it. I have my own custom SaveGame class that has a USTRUCT() variable. Inside that struct there is a UPROPERTY() for a UTexture2D*. If I comment out this property the warning disappears. Something during serialization of my SavedGamed->Struct->Property goes wrong and I get the said warning. I tried using TAssetRef instead but that didn’t help either. I also changed the UTexture2D* to AActor* and I still get this warning.

The bad news is that I tried to reproduce this in a brand new project by making a SaveGame class that uses the same structures but the warning didn’t appear. The warning occurs in UObjectGlobals.cpp on line 842. I’m posting the call stack of the warning below. It doesn’t cause me any problems besides filling my Output Log with a bunch of warnings.

>	UE4Editor-CoreUObject.dll!StaticLoadObject(UClass * ObjectClass, UObject * InOuter, const wchar_t * InName, const wchar_t * Filename, unsigned int LoadFlags, UPackageMap * Sandbox, bool bAllowObjectReconciliation) Line 842	C++
 	UE4Editor-CoreUObject.dll!FObjectAndNameAsStringProxyArchive::operator<<(UObject * & Obj) Line 92	C++
 	UE4Editor-CoreUObject.dll!UObjectProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 32	C++
 	UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 145	C++
 	UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1320	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::StaticSerializeItem(FArchive & Ar, void * Value, const void * Defaults, UScriptStruct * Struct, const bool bUseBinarySerialization, const bool bUseNativeSerialization) Line 153	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 168	C++
 	UE4Editor-CoreUObject.dll!UArrayProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 68	C++
 	UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 145	C++
 	UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1320	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::StaticSerializeItem(FArchive & Ar, void * Value, const void * Defaults, UScriptStruct * Struct, const bool bUseBinarySerialization, const bool bUseNativeSerialization) Line 153	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 168	C++
 	UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 145	C++
 	UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1320	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::StaticSerializeItem(FArchive & Ar, void * Value, const void * Defaults, UScriptStruct * Struct, const bool bUseBinarySerialization, const bool bUseNativeSerialization) Line 153	C++
 	UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 168	C++
 	UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 145	C++
 	UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1320	C++
 	UE4Editor-CoreUObject.dll!UObject::SerializeScriptProperties(FArchive & Ar) Line 984	C++
 	UE4Editor-CoreUObject.dll!UObject::Serialize(FArchive & Ar) Line 926	C++
 	UE4Editor-Engine.dll!UGameplayStatics::LoadGameFromSlot(const FString & SlotName, const int UserIndex) Line 1350	C++
 	UE4Editor-TPS.dll!ATPSMenuMode::BeginPlay() Line 17	C++
 	UE4Editor-Engine.dll!AWorldSettings::NotifyBeginPlay() Line 132	C++
 	UE4Editor-Engine.dll!AGameMode::HandleMatchHasStarted() Line 605	C++
 	UE4Editor-Engine.dll!AGameMode::SetMatchState(FName NewState) Line 721	C++
 	UE4Editor-Engine.dll!AGameMode::StartMatch() Line 582	C++
 	UE4Editor-Engine.dll!UWorld::BeginPlay() Line 3050	C++
 	UE4Editor-Engine.dll!UGameInstance::StartPIEGameInstance(ULocalPlayer * LocalPlayer, bool bInSimulateInEditor, bool bAnyBlueprintErrors, bool bStartInSpectatorMode) Line 273	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEGameInstance(int PIEInstance, bool bInSimulateInEditor, bool bAnyBlueprintErrors, bool bStartInSpectatorMode, bool bRunAsDedicated, float PIEStartTime) Line 3137	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::PlayInEditor(UWorld * InWorld, bool bInSimulateInEditor) Line 2385	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlayMapRequest() Line 1066	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1244	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 366	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 2428	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
 	UE4Editor.exe!GuardedMainWrapper(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 126	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 200	C++
 	[External Code]

So I’m pretty sure this is because when you save the pointer to the actor/texture, the texture/actor don’t necessarily exist when you’re serializing if you’re doing it yourself. If you’re using the engine’s serialization of its CDOs then it should be handled, but since you seem to be loading more dynamically, I don’t think everything you want exists when you want it to. The link below should explain what you want to do, but it sounds like what you want is the “Construction Time Reference” or “Indirect Property Reference” parts.

If you want to use actual properties that designers are editing in editor or on a per-instance basis not at runtime, just don’t save that property and let the CDO/Instance initialize it.

Hey -

I too tried to create a project with a SaveGame class but did not get any log warnings when I added a struct to it. It’s possible that the warning messages are related to code specific to the affected project. If you’re able to upload the project to dropbox and post the link or send it to me in a PM on the forums I can investigate further, however if the warnings are not affecting the behavior of the project it may be possible to ignore them as well.

Cheers

Thank you both for your answers. I also think that it’s an issue specific to my project. I decided to not store the entire structure but just the parts that I needed, which in the end will also help me not bloat my save game.