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

World.AddSystemManaged

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

Declaration

public T AddSystemManaged(T system);

Parameters

Parameter Description
system The existing system instance to add

Returns

T The input system

Description

Adds an existing system instance to this World

Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before adding the system, and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

Note: This system reference is not guaranteed to be safe to use. If the system or world is destroyed then the OnDestroy and cleanup functionality will have been called for this system.

If possible, using World.CreateSystem is preferred, and instead of public member data, component data is recommended for system level data that needs to be shared between systems or externally to them. This defines a data protocol for the system which is separated from the system functionality.

Private member data which is only used internally to the system is recommended.

Keep in mind using a managed reference for systems - encourages coupling of data and functionality
- couples data to the system type with no direct path to decouple
- does not provide lifetime or thread safety guarantees for data access
- does not provide lifetime or thread safety guarantees for system access through the returned managed reference


If T has not been registered with the TypeManager, this method will register it before adding the system.