Search Unity

Feature Request Use XML Comment as Tooltip

Discussion in 'Editor & General Support' started by SolarianZ, Nov 15, 2020.

  1. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    237
    Use XML Comment as Tooltip, then I don't need to write same words twice.

    Code (CSharp):
    1.  
    2. /// <summary>
    3. /// A long XML Comment.
    4. /// </summary>
    5. [Tooltip("Same with XML comment, but I have to write it again!")]
    6. [SerializeField]
    7. protected float someField = 100;
    8.  
     
  2. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    24
    No one's interested in this? I think that's a good idea.
     
    ExodusOTH likes this.
  3. ExodusOTH

    ExodusOTH

    Joined:
    Nov 30, 2017
    Posts:
    45
    I really wish this had more attention... XML Comments (as well as their step-sibling the Javadoc comment) are a standard in a majority of the Computer Science industry.

    Especially considering that
    • Tooltips don't provide Intellisense nor autocompletion
      • XML Comments do
    • Tooltips are an editor only attribute
      • XML Comments are a standard that many code IDEs support
    • Tooltips are only loaded when Unity compiles the code
      • XML Comments are also a compile-time only feature (that is stripped upon building the executable)
    It would be fantastic for the Tooltip attribute to have a no-argument constructor that serializes any XML comment attached to the same variable.
     
    SolarianZ likes this.