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

Question Field labels are unreadable when using nested arrays, how to change field width ?

Discussion in 'Editor & General Support' started by Otnima, Feb 21, 2023.

  1. Otnima

    Otnima

    Joined:
    Sep 5, 2017
    Posts:
    4
    I'm using quite a complex scriptableObject which has nested arrays, the problem is that after getting a few levels deep the field labels are no longer readable even though there is adequate space to fit both in quite comfortably.

    Screenshot 2023-02-21 at 20.52.01.png

    Is there any way to change the field size for all the nested fields ? most will be numeric values up to 100 so having the field inputs be 60px wide would be more than sufficient. Removing the imo unnecessary indentation from the arrays would help gain a bit of space also.

    Elements are an array of custom classes, I have tried fiddling with the the `
    CustomPropertyDrawer` but i'm not sure it's the correct solution as it appears to only effect the `Rect` of the drawer and not the children. I have no prior experience with creating custom Unity editors, so I may be wrong here.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    AFAIK there's no super-pretty easy way to do this.

    Does it get any better if you make the Inspector window super-wide? Or just it just reach a "useless" limit?

    Some custom serializers such as Odin / AdvancedInspector might do better, but don't quote me on that.

    I suspect the Unity Way(tm) would involve a CustomPropertyDrawer, or at the minimum a custom Editor for the outer type that handles each of these inner fields in a nicely-spaced way, but it is kind of a super-high-maintenance route.
     
  3. Otnima

    Otnima

    Joined:
    Sep 5, 2017
    Posts:
    4
    If I make the window wider yes it does eventually fit but it's not ideal having to resize the window each time. Seems almost like a bug, I can't imagine I'm the first one to nest 2 arrays aha.

    From what I saw while looking up solutions going into custom editors looks like a lot of work. If there was an easy solution than maybe I would have looked into it, but if not tbh I'd rather spend that time focusing on game dev.

    I was just looking at Odin and it looks pretty powerful, that may be my best solution. I'll have a look at what AdvancedInspector has to offer also. Thanks for the help!
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,012
    Kurt-Dekker likes this.