Class FormerNameAttribute
Use this attribute to rename a struct, class, field or property without losing its serialized value.
Inherited Members
Namespace: Unity.Serialization
Assembly: Unity.Serialization.dll
Syntax
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)]
public class FormerNameAttribute : Attribute
Constructors
FormerNameAttribute(string)
Initializes a new instance of Former
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 |
---|---|
bool | True if the given name exists in the remap table. |