DefaultGameObjectInjectionWorld
The default World. The code that runs outside a system reads this property to reach a world.
Read time 1 minuteLast updated 19 hours ago
Definition
- Type: Property
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
[NoAutoStaticsCleanup]public static World DefaultGameObjectInjectionWorld { get; set; }
Remarks
Initialize assigns this property, so it's null until Unity creates the default world, and null again after you dispose that world.
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.EntityManagerAssigning a different world to this property redirects all of those callers to that world.
Additional Resources: ICustomBootstrap, DefaultWorldInitialization