Files
PHY/Plugins/GCS/Source/GenericCombatSystem/Private/GCS_ActorOwnedObject.cpp
2026-03-03 01:23:02 +08:00

21 lines
516 B
C++

// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#include "GCS_ActorOwnedObject.h"
#include "GameFramework/Actor.h"
UWorld* UGCS_ActorOwnedObject::GetWorld() const
{
// To Make sure the outer is Valid and can be used
if (!HasAnyFlags(RF_ClassDefaultObject) && !GetOuter()->HasAnyFlags(RF_BeginDestroyed) && !GetOuter()->IsUnreachable())
{
//Attempt to get the world
AActor* Outer = GetTypedOuter<AActor>();
if (Outer != nullptr)
{
return Outer->GetWorld();
}
}
return nullptr;
}