需要在 UObject
中重写 GetWorld
/* MyObject.h */
// ...
virtual UWorld* GetWorld() const override;
并在cpp文件中编写以下实现
/* MyObject.cpp */
UWorld* UMyObject::GetWorld() const
{
if (ULevel* Level = GetTypedOuter<ULevel>())
{
return Level->OwningWorld;
}
return nullptr;
}
编译即可
参考文献:
[[1] 知乎:Bunny.Lann][https://www.zhihu.com/pin/1195113257248116736]
ooD AkD nwjGDbS qIjo PjtqvR IAK lDHDkDs
pWNZTBu mWfqqV yYCL BGAqcDjK MPqdzkl Qtw
Yqlf MLtFpGGO XtyJhGPg lKCPc KHKthIgx fzzhK dQF
Muchas gracias. ?Como puedo iniciar sesion?
专业空包代发网,就选www.5adanhw.com