#Hi Scene Overlays Tools UX guy here
1 messages · Page 1 of 1 (latest)
I don't think I really have anything of note to share about actually using overlays right now. The main issue I have with it is that the documentation is pretty bad on it as a whole, and how the Tools API relates to and interacts with it. Along with how to show component specific overlays (especially this).
Every time I need to do overlays I find my self going back to the forum threads where it was first shown off to try to remember how to use them again. Or looking at the source code.
That's great feedback, thanks! One question - regarding showing component-specific overlays, can you describe the situation?
Sure, glad it was helpful! The most recent use I had was to have a button that would toggle showing debug gizmos for the component since that seem like a more appropriate place for that sort of toggle button than a custom editor.
Oh, I did think of one other thing which I know you are already ware of. But the fact that the overlay toolbar is like ~30px while the standard toolbar is 21px is mildly annoying when two windows are next to each other 😛
(I don't have any suggestions for how to best 'fix' this though)
Thanks for the details! Yeah, for debug stuff ... same issue internally. There's no standard overlay for debug items. However ... you could use an Overlay that appears only when an object with that particular component is selected?
Yeah, maybe work with the Editor Foundations Design System folks and come up with a standard for debug items for components? 😄
(Assuming they have not been reassigned 😬 )
Tbh at the time I couldn't figure out the right way to do an overlay like that so I just tossed it in the editor instead. I actually just found (while talking to you) the ITransientOverlay interface which I assume you use on your overlay with the visible property doing something like this.
public bool visible
{
get { return Selection.gameObject != null && Selection.gameObject.GetComponent<MyComponent>() != null; }
}
Which seems a bit clunky and unintuitive to me. (And not well documented 😉 ) But if that works, cool.
Foundation - eh, names change, focus ... well also changes but better, in this case. We have a real good push for consistency and foundation (vs features) happening. It's good stuff, but slow going to turn a giant ship 😉
ITransientOverlay - I gotta check with team, we actually have something better now, I think - yes clearly this needs more doc/sample/etc! Or, visibility to what exists.
Oof, haha. Well I do like consistency, I am sure you are well aware the need for it in Unity. So I am happy to hear that! I hope the site continue to get updates at some point because I know for my self and others creating tools it is very nice!
Which site specifically?
People know and use that? Fantastic! 😄
I looked for an override in the Editor class, and a property for the Overlay attribute and for any other attributes that might look like they would be it but didn't find anything. So if there is something and you think to do so, please do let me know!
Yeah! Mostly for numbers (Font size, margin, colors, etc.) but the "patterns" section was nice for clear instruction for when Unity wants us to use what type of actions. A good chunk of it is things I found to be 'obvious'/natural. But it was nice to see it clearly written out.
Does this help? See the "InstanceOverlay" bit perhaps?
https://docs.unity3d.com/2023.1/Documentation/ScriptReference/Overlays.Overlay.html
I'll ask the devs tomorrow morning for more info. I keep meaning to learn this up myself, but it's busy busy UX days. Maybe if they added back UnityScript 😉 ... ha ...
I took a look at what the Camera component does. Looks like this is what it does with SceneView.AddOverlayToActiveView(instanceOverlay); in OnEnable and then removes it in OnDisable. Which I guess isn't too bad, but also doesn't feel like the 'right' way to do it. Especially with how (relatively) common this could be to do.
I mean, UX is pretty fun and exciting to work on, so...
Yeah, the difference is that (in 23.1, with InstanceOverlay vs the older ITransient), the "temp" overlay is given full ... life? ... , so it actually lives in the Overlays Menu and can be toggled on/off ... but it only shows there when applicable, of course. And is separated for clarity.
Huh, interesting. Good to know!
So, "as a user ... " if I simply don't want that particular contextual overlay ... I can disable it! Hooray! ... and easily re-enable it later, from the same menu (with, in this case, a Camera selected).
Not that it is your area really, but my suggestion would be if the Editor had a virtual Overlay CreateSceneOverlay() method that would handle the lifetime of the overlay, and it would also help to give an API hint as to how to do it. Instead of having to know about the SceneView methods and mange the lifetime yourself. Also feels consistent with the rest of the Editor APIs.
Just wanted to give my two cents haha.
That's great info, thanks! Candid is good for sure!