BindTypeNameToTypeAttribute

An attribute that lets you help the DefaultSerializationBinder bind type names to types. This is useful if you're renaming a type, that would result in data loss, and what to specify the new type name to avoid loss of data.

namespace Sirenix.Serialization
{
[AttributeUsageAttribute((AttributeTargets)1)]
public sealed class BindTypeNameToTypeAttribute : Attribute
}

Requirements

Namespace: Sirenix.Serialization
Assembly: Sirenix.OdinInspector
Version: 1.0.6.1

See Also

Constructors

Definition Description
BindTypeNameToTypeAttribute(string, Type) Initializes a new instance of the BindTypeNameToTypeAttribute class.

Example

[assembly: Sirenix.Serialization.BindTypeNameToType("Namespace.OldTypeName", typeof(Namespace.NewTypeName))]
//[assembly: Sirenix.Serialization.BindTypeNameToType("Namespace.OldTypeName, OldFullAssemblyName", typeof(Namespace.NewTypeName))]

namespace Namespace
{
    public class SomeComponent : SerializedMonoBehaviour
    {
        public IInterface test; // Contains an instance of OldTypeName;
    }

    public interface IInterface { }

    public class NewTypeName : IInterface { }

    //public class OldTypeName : IInterface { }
}