Skip to content

UniqueIdAttribute

Namespace: SideXP.Core | Inherits from: PropertyAttribute

public class UniqueIdAttribute : PropertyAttribute

Marks a field as a container for a unique id.

If used in an asset script (likely ScriptableObject), the property will contain the GUID of the asset as generated by Unity. Note that this will work effectively only on assets saved on disk.

If the previous case is not applicable and this attribute is used on a string property, it will contain a native C# GUID. For an integer or float property, it will contain the hash code of a native C# GUID.

Remarks

You should use this attribute in addition with SerializeField, and HideInInspector or ReadonlyAttribute in order to make the field readonly.