Class FormerNameAttribute | Serialization | 1.4.3-preview
docs.unity3d.com
    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 © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023