Identifiables
The word "Identifiable" is used to refer to any Type or object implementing IIdentifiable and/or extending IdentifiableBehaviour or IdentifiableObject. In short, Identifiables are all objects that can be uniquely described by an Id.
public class MyIdentifiable : IIdentifiable
{
private readonly Id _id;
public override Id => _id;
public MyIdentifiable(Id id) => _id = id;
}
The ID field has a readonly definition in the interface, since by definition an Identifiable instance should have one and only one id during its lifetime.
Some Construct types (e.g. IdentifiableCollection) allow to easily create structures based on Identifiables that can be accessed by ID or IdReference.
There are two abstract types that can be used to define custom Identifiables:
IdentifiableBehaviour. It can be used to quickly define MonoBehaviours that have an ID field.IdentifiableObject. It can be used to quickly define ScriptableObjects that have an ID field.
public sealed class MyIdentifiableBehaviour : IdentifiableBehaviour
{
...
}
[CreateAssetMenu(filename = "new Identifiable Object", menuName = "Construct/Identifiable Object")]
public sealed class MyIdentifiableObject : IdentifiableObject
{
...
}
Customization Attributes
Just like ID fields, Identifiables' ID field in the inspector can be customized. It can be done by decorating the class definition with the same IdInspectorType attribute used to decorate Id fields. In this case, all the fields of type Id defined in the decorated type will show up as defined, unless they are individually decorated with IdInspectorType.
For example
[IdInspectorType(IdType.AutoOnly)]
public sealed class MyIdentifiableBehaviour : IdentifiableBehaviour
{
public Id AnotherDefaultId;
[IdInspectorType(IdType.ManualRegen)]
public Id DecoratedId;
}
looks like this in the inspector:
