SDT1301: Illegal IRmlData Interface Extension
| Property | Value |
|---|---|
| Rule ID | SDT1301 |
| Title | Illegal IRmlData Interface Extension |
| Category | UI |
| Severity | Error |
Cause
A class directly implements IRmlData instead of one of the specialized marker interfaces: IRmlDataArray, IRmlDataStruct, or IRmlDataScalar.
Rule Description
IRmlData serves as the root marker interface for the RmlUi data-binding system. The binding engine requires specialized type definitions to understand how to traverse and bind data:
* IRmlDataStruct for objects exposing structured variable members.
* IRmlDataScalar for custom get/set scalar wrappers.
* IRmlDataArray / IRmlDataArray<T> for collection types.
Directly implementing IRmlData provides insufficient contract information for RmlUi to register the type, which results in binding failure at runtime.
How to Fix Violations
Replace the direct IRmlData implementation with the appropriate interface: IRmlDataStruct, IRmlDataScalar, or IRmlDataArray.
Violation:
public sealed class InventorySlot : IRmlData
{
[RmlDataVariable] public int ItemId;
[RmlDataVariable] public int Quantity;
}
Fix:
public sealed class InventorySlot : IRmlDataStruct
{
[RmlDataVariable] public int ItemId;
[RmlDataVariable] public int Quantity;
}
When to Suppress Warnings
Danger
Do not suppress this error. Implementing IRmlData directly causes runtime registration failures. The RmlUi binding engine cannot bind to types that do not implement a concrete data marker interface (IRmlDataStruct, IRmlDataScalar, or IRmlDataArray).