Code inspection: DOTS: The type specified must be a structure type
The Unity DOTS (Data-Oriented Technology Stack) relies heavily on specific memory layouts and performance optimizations provided by the Burst compiler and ECS (Entity Component System) architecture. For these optimizations to work, certain ECS components and systems must be implemented as value types (struct).
Detection logic
The inspection targets classes that implement the following interfaces:
Unity.Entities.IAspectUnity.Entities.IJobEntityUnity.Entities.ISystem
If any of these interfaces are implemented by a class (reference type) instead of a struct (value type), the inspection triggers a warning. Reference types are not compatible with the high-performance memory management and parallel processing models used in DOTS.
Example
public class MySystem : ISystem
{
public void OnCreate(ref SystemState state) { }
public void OnUpdate(ref SystemState state) { }
public void OnDestroy(ref SystemState state) { }
}
public struct MySystem : ISystem
{
public void OnCreate(ref SystemState state) { }
public void OnUpdate(ref SystemState state) { }
public void OnDestroy(ref SystemState state) { }
}
26 March 2026