docs.unity3d.com
    Show / Hide Table of Contents

    Class DisplayNameAttribute

    Specify a custom name to be used when displayed in the Editor.

    Inheritance
    Object
    DisplayNameAttribute
    Namespace: UnityEngine.Localization
    Syntax
    public class DisplayNameAttribute : 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
    Back to top
    Terms of use
    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