Class FormerNameAttribute | Serialization | 1.2.0-preview
docs.unity.cn
    Show / Hide Table of Contents

    Class FormerNameAttribute

    Use this attribute to rename a struct, class, field or property without losing its serialized value.

    Inheritance
    Object
    Attribute
    FormerNameAttribute
    Namespace: Unity.Serialization
    Syntax
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
    public class FormerNameAttribute : Attribute, _Attribute

    Constructors

    FormerNameAttribute(String)

    Initializes a new instance of FormerNameAttribute with the specified name.

    Declaration
    public FormerNameAttribute(string oldName)
    Parameters
    Type Name Description
    String oldName

    The previous name of the member or type.

    Properties

    OldName

    The previous name of the member or type.

    Declaration
    public string OldName { get; }
    Property Value
    Type Description
    String

    Methods

    TryGetCurrentTypeName(String, out String)

    Gets the current name based on the previous name.

    Declaration
    public static bool TryGetCurrentTypeName(string oldName, out string currentName)
    Parameters
    Type Name Description
    String oldName

    The previous name of the member or type.

    String currentName

    When this method returns, contains the current type name, if the name exists; otherwise default string.

    Returns
    Type Description
    Boolean

    True if the given name exists in the remap table.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX