GetUnsafeSystemRef<T>(SystemHandle)
Resolves the system handle to a reference to its underlying system instantiation.
Read time 1 minuteLast updated 2 days ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
public ref T GetUnsafeSystemRef<T>(SystemHandle id) where T : unmanaged, ISystem
Parameters
The system handle
Returns
Type | Description |
|---|---|
| T | A reference to the concrete ISystem compatible instance for this system |
Remarks
This system reference is not guaranteed to be safe to use. If the system or world is destroyed then the reference becomes invalid and will likely lead to corrupted program state if used.
Generally, instead of public member data, prefer using component data 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.
GetUnsafeSystemRef-
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
-
does not provide lifetime or thread safety guarantees for system access through the returned ref