I’m stumped,
Here is the use case, I have a DefaultToInstanced, EditInlineNew StateMachine UObject to be used within other UObjects as an Instanced UPROPERTY which cuts down on boilerplate and promotes clean code. But when attempting to get the StateMachine’s Outer it acts as a ClassDefaultObject and returns a reference to the asset:
LogUObjectBase: Error: 'this' pointer is invalid.
WaliWarning: Warning: DFL (UWaliObject) (GetWorld) Default__BP_GameStateMachine_C does not have a valid direct world reference. See logs for details.
WaliWarning: Warning: DFL (UWaliObject) (GetWorld) Attempting to get an indirect world reference...
LogUObjectBase: Error: 'this' pointer is invalid.
WaliWarning: Warning: DFL (UWaliObject) (GetWorld) Default__BP_GameStateMachine_C Outer /Game/Blueprints/Core/Game/BP_GameStateMachine does not have a valid world reference. See logs for details.
WaliWarning: Warning: DFL (UWaliObject) (GetWorld) Returning default global world reference.
#pragma region World
UWorld* UWaliObject::GetWorld() const
{
if (!IsValidLowLevelFast())
{
DEBUG_ERROR("%s is not valid, see logs for details.", *GetName());
return nullptr;
}
UWorld* World = Super::GetWorld();
if (World->IsValidLowLevelFast())
{
return World;
}
DEBUG_WARNING("%s does not have a valid direct world reference. See logs for details.", *GetName());
DEBUG_WARNING("Attempting to get an indirect world reference...");
if (IsAsset())
{
DEBUG_ERROR("%s is an asset.", *GetName());
return nullptr;
}
const UObject* Outermost = GetOutermostObject();
if (Outermost != this && IsValid(Outermost))
{
World = Outermost->GetWorld();
if (World->IsValidLowLevelFast())
{
return World;
}
DEBUG_WARNING("%s Outermost %s does not have a valid world reference. See logs for details.", *GetName(), *Outermost->GetName());
}
const UObject* Outer = GetOuter();
if (IsValid(Outer))
{
World = Outer->GetWorld();
if (World->IsValidLowLevelFast())
{
return World;
}
DEBUG_WARNING("%s Outer %s does not have a valid world reference. See logs for details.", *GetName(), *Outer->GetName())
}
DEBUG_WARNING("Returning default global world reference.")
return GWorld;
}
#if WITH_EDITOR
bool UWaliObject::ImplementsGetWorld() const
{
return true;
}
#endif
#pragma endregion
You’d expect the Outer of an Instanced UObject to be the implementing UPROPERTY owner right? Or at the very least for the Instanced UObject to act as normally.
Maybe I’m just missing something about Instance Objects. Any help would be appreciated. I’ve tried searching for similar issues, but some have come up short.