logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class FoundationIdReferenceAttribute

    Declares that a string field, property or constructor parameter holds the Id (or, with Kind, the Guid) of an IFoundationSettings definition — the single place the project states "this string names another asset". Inspector tooling reads it to offer a dropdown of the existing definition ids instead of free text, and the reference contract table is derived from the fields that carry it, so validation, adoption and Clone Directory all re-point exactly the declared fields and nothing else.
    Put it on any serialized string (or string array/list) of your own foundation settings type, or of a serializable class nested in one; repeat it when one field is read as different references depending on a sibling field (Selector).
    Pure metadata with no Unity dependency; it has no effect at runtime — the annotated value remains an ordinary string.

    Inheritance
    object
    Attribute
    FoundationIdReferenceAttribute
    Implements
    _Attribute
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.Equals(object)
    Attribute.GetHashCode()
    Attribute.Match(object)
    Attribute.IsDefaultAttribute()
    Attribute.TypeId
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Global.Domain.Attributes
    Assembly: Serenity.Global.Domain.dll
    Syntax
    [AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = true, Inherited = true)]
    public class FoundationIdReferenceAttribute : Attribute, _Attribute

    Constructors

    FoundationIdReferenceAttribute()

    Creates an attribute with no fixed definition type — a self-reference, an untyped reference, or one whose type is named through DefinitionTypeName or DefinitionTypeNameField.

    Declaration
    public FoundationIdReferenceAttribute()

    FoundationIdReferenceAttribute(Type)

    Creates the attribute targeting the given definition type.

    Declaration
    public FoundationIdReferenceAttribute(Type definitionType)
    Parameters
    Type Name Description
    Type definitionType

    The IFoundationSettings-derived type to source ids from.

    Properties

    DefinitionType

    The definition type whose instances' ids are valid values — typically an IFoundationSettings-derived interface (e.g. IAudioPlayerSettings). Editor tooling lists the ids of all assets assignable to this type. Null when the reference is untyped, names its type through DefinitionTypeName or DefinitionTypeNameField, or is a reference to the owning asset itself.

    Declaration
    public Type DefinitionType { get; }
    Property Value
    Type Description
    Type

    DefinitionTypeName

    The short name of the definition type, for a reference to a type the declaring assembly cannot reference (the settings types live in sibling modules). See FoundationReferenceTypeNames.

    Declaration
    public string DefinitionTypeName { get; set; }
    Property Value
    Type Description
    string

    DefinitionTypeNameField

    The serialized string field of the OWNING asset that names the referenced type at authoring time (e.g. a setting's selectableValueTypeName), for a reference whose type is chosen by the author.

    Declaration
    public string DefinitionTypeNameField { get; set; }
    Property Value
    Type Description
    string

    Documentation

    Why this reference exists, surfaced to an authoring agent. Optional: a sentence is synthesised from the referenced type when left empty.

    Declaration
    public string Documentation { get; set; }
    Property Value
    Type Description
    string

    ElementMember

    For a declaration placed on a field that holds a serializable class (or an array/list of one): the name of that class's string member the declaration applies to. Use it when the nested class is shared by owners that read the member differently, so declaring on the member itself would claim the reference for every owner (a generic key/value entry, for instance).

    Declaration
    public string ElementMember { get; set; }
    Property Value
    Type Description
    string

    Kind

    What the string holds: another asset's Id (the default), its Guid, or the owning asset's own Id.

    Declaration
    public FoundationReferenceKind Kind { get; set; }
    Property Value
    Type Description
    FoundationReferenceKind

    Selector

    The run-time condition on the owning element that decides whether this declaration applies; Always unless a sibling field decides.

    Declaration
    public FoundationReferenceSelector Selector { get; set; }
    Property Value
    Type Description
    FoundationReferenceSelector

    Shape

    How the stored value must be interpreted when it is read or rewritten.

    Declaration
    public FoundationReferenceShape Shape { get; set; }
    Property Value
    Type Description
    FoundationReferenceShape

    Implements

    _Attribute
    In this article
    © 2026 Serenity. All Rights Reserved