Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

HELP - PropertyDrawer, adjust position y for next fields

Discussion in 'Scripting' started by studiostartunity, Jun 11, 2019.

  1. studiostartunity

    studiostartunity

    Joined:
    May 3, 2019
    Posts:
    20
    Hello,
    I'm developing a PropertyDrawer to allign my fields horizontally. I'm able to recalculate x/y coordinates to get the result I want, but I thought that it was enough... instead...

    I'm moving each variable with a custom Attribute. The first variable stays in his original position, instead the second and the third variables (which were located where I've drawn the red boxes) are moved to new position simply recalculating their coordinates.
    The problems seems to be that Unity still considers the second and third variables located in their original positions, so the new x/y coordinates for the next fields are not as I want (there is a big gap between a field and the next fields).
    Is there a way to say to Unity to ignore the second and third variables position or, I don't know, set new x/y coordinates globally for the correct position of the next fields?

    Thanx!
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    2,147
    Are your 3 grouped fields, Value, IsOK and Go, three different objects with three different PropertyDrawers or just one object with one drawer?

    Also, post your code.
     
  3. studiostartunity

    studiostartunity

    Joined:
    May 3, 2019
    Posts:
    20
    They are 3 different variables controlled by own attribute, like this:

    [MyAttribute]
    public string value;

    [MyAttribute]
    public bool isOK;

    [MyAttribute]
    public GameObject go;

    Honestly, I found a solution this morning. Basically I created a new Attribute, a DecoratorDrawer (not a PropertyDrawer this time) that, placed at the end of the 3 variables, adjusts the gap.