Make PopupField constructor not require a default value

I really like PopupField but there is one thing that’s constantly bugging me about it. Initializing it becomes tricky when the list it’s supposed to get its values from is not yet populated. Yes, I could just initialize my list with a dummy item, but then I or the user has to remember to get rid of the dummy value once it is no longer needed.

So how about having a constructor argument for PopupField to display a built-in dummy option (default T or something) until a real value becomes available?

If there is another way to solve the problem, I’d love to hear that too.

I suggest you implement a custom control that inherits from PopupField. It’s not too bad and you can still expose it to UXML for your users.

I also encounter this inconvenience from time to time. I’d love it if the PopupField would handle an invalid state by assigning an index of -1. In this case, the popup should simply be blank and have no options, but then I could populate the list at a later time.