UE引擎的UWorld是什么,UWorld与GWorld的关系

UE引擎的UWorld是什么,UWorld与GWorld的关系UE 引擎的 UWorld 是什么 UWorld 与 GWorld 的关系 UWorld 有一些关于游戏的重要信息 比如 PersistentLe NetDriver GameState 没有它 你不能做你想做的大部分事情 GWorld 是个全局指针变量

大家好,我是讯享网,很高兴认识大家。

UE引擎的UWorld是什么,UWorld与GWorld的关系

UWorld有一些关于游戏的重要信息,比如(PersistentLevel,NetDriver,GameState),没有它,你不能做你想做的大部分事情。

GWorld是个全局指针变量,指向UWorld的指针(Global UWorld pointer)。

定义在文件:Engine\Source\Runtime\Engine\Classes\Engine\World.h

/ Global UWorld pointer. Use of this pointer should be avoided whenever possible. */ extern ENGINE_API class UWorldProxy GWorld;

讯享网

   World 是代表地图或沙箱的顶级对象,Actor 和组件将存在于其中并进行渲染。
  一个世界可以是一个单一的持久关卡,带有一个可选的流式关卡列表,这些关卡通过卷和蓝图函数加载和卸载或者它可以是使用 World Composition 组织的关卡集合。
  在独立游戏中,通常只有一个世界存在,除非在无缝区域转换期间同时存在目的地和当前世界。
  在编辑器中存在许多世界:正在编辑的关卡、每个 PIE 实例、每个具有交互式渲染视口的编辑器工具等等。

讯享网class UWorld : public UObject { public: // ... class ULevel* PersistentLevel; class UNetDriver* NetDriver; class AGameNetworkManager* NetworkManager; // ... class AGameStateBase* GameState; // ... class ULevel* CurrentLevel; class UGameInstance* OwningGameInstance; // ... };

UWorld代理类:

 / Proxy class that allows verification on GWorld accesses. */ class UWorldProxy { public: UWorldProxy() : World(NULL) {} inline UWorld* operator->() { // GWorld is changed often on the game thread when in PIE, accessing on any other thread is going to be a race condition // In general, the rendering thread should not dereference UObjects, unless there is a mechanism in place to make it safe checkSlow(IsInGameThread()); return World; } inline const UWorld* operator->() const { checkSlow(IsInGameThread()); return World; }

在内存中查看UWorld:


讯享网

FirstPersonExampleMap    0xAEAC0    World 

 查看 UWorld偏移量:ExeModuleBase+0x5B14EB8

查看UWorld内存布局:

 

小讯
上一篇 2025-03-09 23:28
下一篇 2025-03-09 07:28

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/76065.html