Search Unity

PropertyField in custom inspector not showing

Discussion in 'UIElements' started by soljakwinever, Aug 30, 2019.

  1. soljakwinever

    soljakwinever

    Joined:
    Apr 21, 2017
    Posts:
    4
    Hello,

    I am trying to work with the new UIElements and uxml controls to make inspectors for my custom classes which inherit from ScriptableObject. I am trying to work with the property field control because thats what I've read you are supposed to use to manipulate them, but I can't get them to actually display. In my uxml I've got a few of them defined (because I was trying to see if I could get anything of these property fields to display)

    upload_2019-8-30_11-2-27.png

    The editor does not display anything at all where these properties should be
    upload_2019-8-30_11-6-30.png

    I've been bashing my head on this for hours and I can't find anything online about what I'm supposed to do to get them to show up? Can anyone give me a hand please?
     

    Attached Files:

  2. soljakwinever

    soljakwinever

    Joined:
    Apr 21, 2017
    Posts:
    4
    upload_2019-8-30_11-14-38.png

    Part of the class with the field I'm trying to display in it in case that helps
     
  3. soljakwinever

    soljakwinever

    Joined:
    Apr 21, 2017
    Posts:
    4
    upload_2019-8-30_11-22-17.png

    It shows up in the UIElements debugger, it just doesn't do anything. Am I doing something wrong? Or is there some code I need to call to bind it?
     
  4. hugobd

    hugobd

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    15
    Hi @soljakwinever!

    I can see in the debugger screenshot that the height of your PropertyField is 0px. Could it be possible that your styling is causing this?
     
  5. hugobd

    hugobd

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    15
    Hey!
    Actually your PopertyField is probably not displaying because it can't resolve the binding-path. Does your BaseGameAction is a subclass of MonoBehavior or ScriptableObject? Also, could you test if your properties are properly serialized by calling JsonUtility.ToJson(IfCond) in your Editor class? The properties you want to bind to should be displayed.