Starting with a Custom Inspector


My good friend, Richard Stamp, advises that the reception to a Unity tool depends a lot on how much you can do with it in the editor. So, I’m using that as a reason to learn UI Toolkit (which is the replacement for IMGUI).

UI Toolkit takes a lot of its design from web pages, with (yet another) XML definition for layout (called “UXML”), and (yet another) style sheet definition (called “USS”). But, it includes a graphical UI editor called “UI Builder.” Now, UI Builder appears to be in an early stage and, like other things we’ve seen from Unity in the past, has been released with maybe too few features and maybe too many bugs. But it can be used!

So, following Sid Meier’s advice that what the user sees is all that matters, I’m designing the Custom Inspector first. That may be a goofy place to start, but it’s letting me learn UI Toolkit and that’s valuable on its own.

Here’s the first draft: image.png

The top section controls how far left and right, and how far up and down, the camera can “orbit” the point it is currently looking at. “Horizontal unlimited” lets the camera orbit endlessly left or right.

The middle section specifies where the camera will be in its two degrees of freedom upon initially arriving at a LandingPad. It also sets the distance from the point the camera will be looking at (the “radius” of its orbit around that point, if you like). Using it just once means that, if the camera leaves this LandingPad and later returns, it will return to the position it was in when it left, not the initial position.

The last section’s “Back” field controls where the camera goes when the player hits the “back” button. If the field is blank, they go back to where they came from. But, if the developer drops a LandingPad in there, the player goes “back” to that LandingPad instead. Makes sense when you have to hop from one pad to another then another, to reach a certain goal, but it would be needlessly tedious to have to hop back along the same path, rather than just to some obvious earlier pad in one hop. The “Next” field lets the developer set this LandingPad as merely a step along the way to another. This is useful if there’s no good path directly to another LandingPad. This one becomes a stepping stone to the one you want.

How’s it look?

Leave a comment

Log in with itch.io to leave a comment.