Search Unity

Feature Request Tuple in inspector

Discussion in 'Editor & General Support' started by laurentlavigne, Jan 24, 2021.

Thread Status:
Not open for further replies.
  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,362
    to bring the inspector up to speed with what c# can do these days which is
    Code (CSharp):
    1. public List<Tuple<Research_SO, Button, Image>> things;
    instead of
    Code (CSharp):
    1. [Serializable]
    2. public class ThisTupe
    3. {
    4. public Research_SO research;
    5. public Button button;
    6. public Image image;
    7. }
    8. public List<ThisTuple> things;
     
  2. AugustusGabuis

    AugustusGabuis

    Joined:
    May 8, 2022
    Posts:
    1
    this and being able to display Lists and dictionaries would make the inspector so much better!
     
  3. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,925
    You can already see lists in the inspector though?

    Unity can't display dictionaries because it can't serialise them. Unity's serialisation is limited for a reason.
     
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,442
    So, here's what I gather is the general philosophy of the Unity Editor. The Editor is extensible. If it can be done by somebody other than Unity team, then they seem to prefer that approach. They implement what is absolutely necessary.

    There are extensions that implement List drawers. There are extensions that implement Dictionary drawers. You could write an extension that implements a Tuple drawer in just the same way. Heck, if you do a good enough job, you could sell it as an Asset on the Asset Store.

    Every line of code that Unity provides inside the Editor is a source of bugs and compatibility concerns going forward. Rather than having them see themselves as adding every wish of everybody out there, they just give the extensible API so you can do it yourself.
     
    skabed, Kurt-Dekker and Ryiah like this.
  5. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,925
    Agreed.

    Unity does 75-90% of the work for us in most of its packages. The remaining space is for use to implement in a way that works to our particular needs/style. Unity is the toolbox, and we're the tradie.

    And there's plenty of packages out there that can do what you need with a small purchase/download. If you want to serialise dictionaries, the Odin Serialiser is open source (that won't draw them in the inspector, but halfway there).
     
    skabed, Kurt-Dekker and Ryiah like this.
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
    Last edited: Feb 17, 2023
    skabed and spiney199 like this.
Thread Status:
Not open for further replies.