Skip to main content

Notes

The '[TppShowAsLabel…]' attributes allow you to display a property. This can be useful in many ways. Here’s an example from TilePlusBase.cs that shows how the Tag property as shown in the Brush Inspector works.

/// <summary>                                            
/// Property to get the optional tag                     
/// </summary>                                           
/// <value>The tag.</value>                              
[TptShowAsLabelBrushInspector(true)]                     
public string Tag                                        
{                                                        
    get => string.IsNullOrEmpty(m_Tag)                   
               ? string.Empty                            
               : m_Tag.Trim();                           
    set                                                  
    {                                                    
        #if UNITY_EDITOR                                 
        if (!TpLib.IsPlayMode)                           
            #endif                                       
            m_Tag = value.Trim();                        
    }                                                     

It’s not a great idea to do anything too complex since there’s repeated access during an Editor session when the Selection Inspector or TilePlus Utility window are in use.

Another way to add a display string is to use the TptNote attribute, for example:

[TptNote(false, "Only X and Y are used")]
public Vector3 m_EndSize = new(2, 2, 1);

This attribute is only used in the Selection Inspector.