SDT1304: Invalid RML Data Struct Member Type

Property Value
Rule ID SDT1304
Title Invalid RML Data Struct Member Type
Category UI
Severity Error

Cause

A field or property decorated with [RmlDataVariable] uses a type that is not supported by RmlUi data binding.

Rule Description

The RmlUi data-binding system only supports the following member types: * Primitives: bool, byte, char, string, int, uint, long, ulong * Vectors & Colors: ColorRgba, Vector2f, Vector3f, Vector4f * Variant container: RmlVariant * Nested RML Data types: types implementing IRmlDataArray, IRmlDataStruct, or IRmlDataScalar

Any other type cannot be synchronized with UI documents.

How to Fix Violations

Change the member's type to a supported primitive, vector, or RmlVariant, or wrap custom objects inside a class implementing IRmlDataStruct.

Violation:

public sealed class PlayerData : IRmlDataStruct
{
    [RmlDataVariable] public DateTime LastLogin;
    [RmlDataVariable] public System.Guid PlayerGuid;
}

Fix:

public sealed class PlayerData : IRmlDataStruct
{
    [RmlDataVariable] public string LastLogin = string.Empty;
    [RmlDataVariable] public string PlayerGuid = string.Empty;
}

When to Suppress Warnings

Danger

Do not suppress this error. RmlUi cannot synchronize unsupported types with UI markup templates. Using unsupported member types will cause binding table construction to fail at runtime.