Class DisplayNameAttribute
Specify a custom name to be used when displayed in the Editor.
Namespace: UnityEngine.Localization
Syntax
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public class DisplayNameAttribute : Attribute, _Attribute
Examples
This example shows how Metadata can be given a custom name.
using System;
using UnityEngine.Localization;
using UnityEngine.Localization.Metadata;
/// <summary>
/// When displayed in the Inspector, such as the add metadata menu, the name will be displayed as "My Custom Name".
/// By default the name would have been "Metadata With Display Name".
/// </summary>
[DisplayName("My Custom Name")]
[Serializable]
public class MetadataWithDisplayName : IMetadata {}
Constructors
DisplayNameAttribute(String, String)
Specify a custom name to display in the Editor.
Declaration
public DisplayNameAttribute(string name, string iconPath = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name to display. |
String | iconPath | Optional icon to display when possible. |
Properties
IconPath
Path to a Texture file to display as an icon.
Declaration
public string IconPath { get; set; }
Property Value
Type | Description |
---|---|
String |
Name
The custom name to use when displayed in the Editor.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |