ReSharper 2025.3 Help

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 both partial and readonly.

  • Unity.Entities.IJobEntity: Must be marked as partial.

  • Unity.Entities.ISystem: Must be marked as partial.

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

struct MyAspect : IAspect { // ... }
readonly partial struct MyAspect : IAspect { // ... }

The quick-fix adds the missing modifiers automatically.

08 April 2024