Your tip about DynamicTransform was very helpful, thank you.
I read some cautions about some devices not being able to handle many of these. Is this to suggest that other methods might be better (canvases, quads), or are they just going to be similarly limited too?
As far as frustrations, the current API documentation is very minimal and bereft of code usage examples once you go past the surface layer.
Maybe it’s my use cases, but the first things I ever need are:
- Elements positioned in relation to GameObjects
- Elements that reflect game information
- Buttons that do things.
Everything else is secondary. I don’t need a 30 minute tutorial to show me how to align bold text in the center of the screen or what padding does. Without initial learning bits directly related to my use cases, I find there’s no good mental framework to slot new information into. Maybe that’s just me.
Looking up information has been frustrating because there’s also a lot of ambiguity if the information pertains to the editor or runtime, or if is outdated (Including “runtime” in a google search doesn’t help much.) Several times I’ve found myself puzzling over a tutorial only to find it isn’t for runtime.
I know there’s some crossover, but just not much in my 3 initial use cases.
For example:
The first thing I saw was Unity Learn: UI Toolkit - First Steps
Ok, I guess I gotta start somewhere. And it’s for the editor - not what I’m after. But then there’s nothing. No links to other areas, no way to back out to, say, a table of contents about UI Toolkit.
I tried searching for “UI Toolkit Runtime” which leads me right back to the same tutorial that’s definitely not about runtime.
So I tried to search with google: Ah ha! Unity Learn - UIElements, sounds promising: “Sorry, this learning content is no longer available.”
I’ve gathered that UI Toolkit is somehow based on a thing called FlexBox. But looking up that yields a lot of ambiguity too. (FlexBox 4 Unity? References to paid assets? Oh, I see, it’s depreciated. This kind of noise is distracting.) And I’m pretty sure learning about FlexBox is not a path to my first 3 requirements anyway.
Getting an element to visually appear over a GameObject was a wild ride because using transform.position is wrong, and VisualElement.style.width (and similar) can’t be read from. Instead it’s VisualElement.resolvedStyle.width, which I found on accident.
Now, I’m seeing conflicting information on how to make a button do something.
Some things use RegisterCallback
And others use event handlers that look like delegates.
There was another way too maybe, but I think it’s for extending the editor.
Is this just because some things are out of date, or…?