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. Dismiss Notice

Question Property Right Click Field Menu not shows up

Discussion in 'UI Toolkit' started by Wilhelm_LAS, Sep 30, 2023.

  1. Wilhelm_LAS

    Wilhelm_LAS

    Joined:
    Aug 18, 2020
    Posts:
    35
    Hello. I have a class named "DropdownPropertyField" that derives from BaseField<object> and inside it, i got a DropdownField and ObjectField.

    The tree looks like this:

    (UXML Tree)
    DropdownPropertyField (#variable-reference)
    - Label (labelUssClassName)
    - Input Container (inputUssClassName) (Content Container)
    -- DropdownField (Inside Input Container)
    -- Object Field (Inside Input Container)

    At the property drawer, i bind the DropdownPropertyField to a Serializable Class.
    Looks like something like this:
    Code (CSharp):
    1.  
    2. public override VisualElement CreatePropertyGUI(SerializedProperty property)
    3. {
    4.   // Uxml have only DropdownPropertyField and its DropdownField/ObjectField's binding paths are set
    5.   var visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("UxmlPath.uxml");
    6.   var floatReferenceElement = visualTreeAsset.CloneTree();
    7.   floatReferenceElement.name = "reference-container";
    8.  
    9.   // "property" is a Serializable Class
    10.   // Find element and bind
    11.   var variableInputElement = floatReferenceElement.Q<DropdownPropertyField>("variable-reference");
    12.   variableInputElement.BindProperty(property);
    13.  
    14.   return floatReferenceElement;
    15. }

    Everything works fine until i do right click to the DropdownPropertyField's label. The field menu does not shows up so i know something is wrong.
    What i meant by field menu:
    upload_2023-9-30_12-12-48.png
    Look at this too. It does not register the RightClickFieldMenuEvent to the DropdownPropertyField. Instead, it registers to DropdownField and ObjectField inside it:
    upload_2023-9-30_12-12-25.png

    Also it registers to its template container but not the DropdownPropertyField
    upload_2023-9-30_12-24-20.png
     
    Last edited: Sep 30, 2023
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    354
    Hi @RiskyMelody, can you open an issue with this so that we can investigate?
    Thank you!
     
    Wilhelm_LAS likes this.
  3. Wilhelm_LAS

    Wilhelm_LAS

    Joined:
    Aug 18, 2020
    Posts:
    35
    I reported it. CASE IN-56623
     
    martinpa_unity likes this.