SDT0403: Missing Enum Field Mapping Attribute
| Property | Value |
|---|---|
| Rule ID | SDT0403 |
| Title | Missing Enum Field Mapping Attribute |
| Category | Input |
| Severity | Error |
Cause
An enum is decorated with [InputMapper], but one or more of its individual fields are missing their required specific mapping attribute.
Rule Description
When an enum is registered as an input mapper, the input system relies on reflection to bind each enum value to a specific physical input (like a button or axis). If a field is missing its mapping attribute, the input system will fail to bind it.
How to Fix Violations
Ensure every field inside the enum has the correct mapping attribute applied to it.
Violation:
[InputMapper]
public enum PlayerActions
{
[MappedButton]
Jump,
// Missing attribute!
Crouch
}
Fix:
[InputMapper]
public enum PlayerActions
{
[MappedButton]
Jump,
[MappedButton]
Crouch
}
When to Suppress Warnings
Danger
Do not suppress this error. Unmapped fields in an [InputMapper] enum will cause fatal input binding failures at runtime. If an enum value is not meant to be mapped to an input, it should not be part of an [InputMapper] enum.