Code inspection: DOTS: Inconsistent type keywords
In Unity DOTS (Data-Oriented Technology Stack), certain interfaces require specific modifiers on the implementing types. These modifiers are necessary for the DOTS source generators to function correctly and to ensure safety and performance.
Detection logic
The inspection targets classes or structs that implement the following interfaces:
Unity.Entities.IAspect: Must be marked as bothpartialandreadonly.Unity.Entities.IJobEntity: Must be marked aspartial.Unity.Entities.ISystem: Must be marked aspartial.
The partial modifier is required because Unity's source generators create additional parts of these types. The readonly modifier for IAspect ensures immutability, which is required for safety and performance in ECS.
Example
The quick-fix adds the missing modifiers automatically.