DefaultGameObjectInjectionWorld
The World that code running outside a system reaches for, at the top of the currently active World stack. Null until Unity creates the first World.
阅读时间1 分钟最后更新于 14 天前
Definition
- Type: Property
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
public static World DefaultGameObjectInjectionWorld { get; set; }
Remarks
Code that runs outside a system has no world to work from, so it reads this property instead. This applies both to your own MonoBehaviour scripts and to Editor tools such as the SubScene Inspector and the Entity Inspector. The most common use in your own code is to reach an EntityManager, for example .
World.DefaultGameObjectInjectionWorld.EntityManagerTo change which World this reports, push one onto the stack with World.ActiveWorldScope and let the scope restore the previous one.
Additional Resources: ICustomBootstrap, DefaultWorldInitialization