Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Vector2Field in Editor script: changing labels and adding a tooltip

Discussion in 'Scripting' started by guy_lateur, Jun 15, 2020.

  1. guy_lateur

    guy_lateur

    Joined:
    Oct 4, 2015
    Posts:
    9
    I've been writing some Editor scripts in an attempt to keep the GUI on my components nice and tidy. For instance:
    Code (CSharp):
    1. genPT.origin = EditorGUILayout.Vector2Field("Origin", genPT.origin);
    Here genPT is the target of my Editor script, and it has a public Vector2 property named 'origin'.

    The float fields in Vector2Field are labeled 'X' and 'Y' by default. Is there any way to change this? Eg, in some cases, I'd like those to be labeled 'Min' and 'Max'.

    Also, can I add a tooltip on this property? Can I make it so that a tooltip appears when I hover over the label ('Origin') of my property? Is this possible?

    TIA!
     
  2. Legiondairy

    Legiondairy

    Joined:
    Dec 12, 2021
    Posts:
    1