Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

World.DefaultGameObjectInjectionWorld

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static World DefaultGameObjectInjectionWorld;

Description

The default World. The code that runs outside a system reads this property to reach a world.

DefaultWorldInitialization.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 World.EntityManager, for example World.DefaultGameObjectInjectionWorld.EntityManager.

Assigning a different world to this property redirects all of those callers to that world.

Additional resources: ICustomBootstrap, DefaultWorldInitialization