#🧰┃ui-toolkit

1 messages · Page 4 of 1

pearl hamlet
#

Okay, I think I've narrowed it down to a specific document that's not receiving callbacks. It's a rather complex document, and it used to work, so I'm not sure what could be causing this. What could cause a document not to receive events?

#

it also has a lot of scripts all accessing that document, like this

hasty parcel
#

Why does this button clicked event not work? Its 100% finding the button.

#

And the button's icons and pseudo-classes are being set correctly.

#

But this one function isn't getting called.

#

And the event is showing up in the debugger.

#

Figured it out. Nevermind.

#

Apparently if you disable the frame and re-enable it, the registered events are removed.

mystic flicker
#

hi how do you convert from screen to panel in 2021.1 before RuntimePanelUtil ?

wet copper
#

Hey, guys! Can you, please, tell me how to style default tooltip (that appears at runtime for all built-in controls)? Is there any resources with all internal selectors (and their properties) for predefined controls?

pearl hamlet
#

it doesn't get key down events either

wet copper
shell shale
#

how can I create a crosshair with the ui toolkit should I use a symbol(text) or an image and how do I center it correctly

#

?

pearl hamlet
#

ok im getting closer. I've figured out that if I put one document I have inside of another, neither of them can receive events. This didn't happen before; what gives?

long cobalt
#

I'm getting a NullReferenceException whilst I'm opening/closing my inventory UI, or sometimes when I drag and drop items.

The exception isn't frequent at all, and will be perfectly fine for a while, and then out of nowhere it'll just throw a hiccup.

Errors:
https://hatebin.com/khbaiepzos
https://hatebin.com/bnlyeluvyq

gusty estuary
#

this error means literally nothing without context, so I suggest you to just learn what's it about

#

and figure where it happens at least

grave dust
#

So, is there an option to easily disable the possibility to click a singular button via code for UI toolkit?

meager talon
#

Hello I've got a question is UI Toolkit oficially 'production ready'? Because It was kinda laggy for me and I don't know if it's because I've use *-preview version or it just works like that

#

I mean, sometimes it would freeze entire PC (I'm using linux), it's a common problem or just me?

gusty estuary
#

or maybe even LTS in 2021

#

oh yeah, 2021 is LTS now

#

and it has UITK built into engine

#

generally it's good to go now

meager talon
#

ok, thanks for info

#

Because sometimes it would freeze entire OS, thus loosing unsaved changes made in UI Editor....

gusty estuary
#

Never experienced or heard of it

pearl hamlet
teal belfry
#

is there not an easy way to set all the borders color at once?

#

I have to change the top and left and right and bottom border color in code?

#
renderTexture.style.backgroundImage = new StyleBackground(hero.renderTexture);
#

can you not set renderTexture in code?

#

this doesn't work

gusty estuary
#

or through UXML

teal belfry
gusty estuary
#

ah, no runtime binding yet by default

#

but I am actively working on one

teal belfry
#

brutal

#

thanks 🙂

static canyon
#

You can actually you just need to create a new Background object and set the renderTexture property if memory serves

#

But the border thing is a pita - I should just create an extension method thinking about it

static canyon
#

new Background() { renderTexture=hero.renderTexture }

#

Try that maybe? Not in front of pc atm

teal belfry
#

didn't even know Background was a thing

#

I found StyleBackground...but it didn't have anything renderTexture wise

static canyon
#

Yea it’s definitely a bit jank but historically it was done through the Image type which was never exposed publicly so… it’s better than it was but still not great

thin bane
#

is there anyway to make the listview go horizontally instead of vertically?

#

have also tried changing it in code but didnt work

#

doesnt look like its possible :(

teal belfry
#

@thin bane no clue Listview vs Scrollview

#

But scrollview can just go horizontally

#

Or just vertically

#

Or maybe both at once...not sure if thats possibly tho

#

Any solutions for UI toolkit lagging when you type? (Very large/complex doc)

unborn bluff
#

Any Unity staff here able to advise what the plan is for XR UI and UI Toolkit because MS just laid of their entire XR team?
Lots of devs were using MRTK which had a nice spatial UI system (with flex/algiment/etc.. similar to UI Toolkit and flexbox).. https://www.itworldcanada.com/post/entire-microsoft-vr-team-among-laid-off-10000-staff#:~:text=Microsoft's 10%2C000-person layoff may,virtual reality products being axed

pearl hamlet
#

I'm just doing

document = GetComponent<UIDocument>();
document.rootVisualElement...

but it keeps telling me that rootVisualComponent is null? What could cause this? my UI document is fine, and isn't null.

analog elk
#

Z-index when? 🥹

#

I just want a simple dropdown

#

while having the parent element docked relatively

#

WindowContent overlaps the dropdown...

#

even the built-in dropdown is a fake popup

#

what da heeeaaallll

teal belfry
#
VisualElement root = GetComponent<UIDocument>().rootVisualElement;
#

assuming the script is on the object with UI Document and the UI doc isn't blank

#

I imagine it should work

vale charm
#

Anyone know why UI will work in the Editor, but when I try in a build clicks do not work on my buttons?

#

I have the Event System in the scene.

#

If it makes any difference, im using BOTH input systems and the UI is made from the Toolkit.

teal belfry
#

or I have like a joystick stealing inputs also

vale charm
#

Well the Hover color change works for the mouse on the buttons, so it has to be something weird

#

Im going to try and set the Sort Order to 1 and see if it help. I doubt it

#

I feel like something is missing.

vale charm
#

.1.4f1

gusty estuary
#

not sure then
It was broken in 2022.2 until 1f I believe

vale charm
#

oh shit. well damn

#

I thought maybe it was because I didn't have a Player Input on any GO in the scene

#

but even then it still doesn't work

gusty estuary
#

you just need to have event system

#

as long as it's here - inputs are passed to UIDocuments

#

check log

#

for errors

#

I'm pretty sure

#

it'll reveal what's up

vale charm
#

I forgot how to pull up the Debug console on a dev build

gusty estuary
#

log file is here

#

on windows

vale charm
#

Nothing good or useful in there.

#

Dont see any errors

vale charm
#

It's just strange how the Mouse Hover works, but not the Click event.

#
_playButton = _root.Q<Button>("playbtn");
_playButton.clicked += PlayButton;
#

I can even click and drag on the input field. So it must be the .clicked not working correctly.,

vale charm
#

I updated to 22.2.3f1 and it still doesnt work...

vale charm
#

Anyone else have Ideas or suggestions

#

Im open to any feedback.

gusty estuary
#

Try pure test in empty project

vale charm
#

Still nothing

#

And I have both of those. Man this is frustrating

#

I made a custom style for :focus and that goes to show you that clicking works.

#

Now why the hell won't the actual function run???

#

GOT IT. FINALLYYYYYYYY

#

I took the subscriptions out of the Awake function and threw them into start.

pearl hamlet
teal belfry
wind gorge
teal belfry
wind gorge
#

so if you want your code state to persist after tweaking uss values, you should put it in onenable

vale charm
pearl hamlet
#

my structure is this. why is rootVisualElement null?...

teal belfry
pearl hamlet
#

inpector + NewInventoryControl

teal belfry
#

you have root declared above as a VisualElement?

pearl hamlet
#

yeah

gusty estuary
#

Each time you enable object hierarchu is instantiated

pearl hamlet
#

okay. One minute, my scripts can't find the root element of the UI Document, but input events work on the UI document. I restart Unity, and now most of the scripts find the root element fine, but input events break. I feel like im going insane

distant cedar
#

Anyone got theme style sheets working? I'm trying to style all buttons but cant get it to work.
My .tss file:



/* TODO: why not applied? */
.unity-button {
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    margin-bottom: 0px;
}```
distant cedar
#

🤦‍♂️ apparently there is a dropdown where you have to select your theme in the UI builder

gusty estuary
#

yep, different UIDocuments can have different panel settings

gusty estuary
#

I don't quite understand. Do tooltips work in Play mode?

#

or build?

#

so far they only work for me in UI Builder

#

literally everything else doesn't

distant cedar
gusty estuary
#

almost 3 years passed 😅

distant cedar
#

yeah, but probably nothing happened

static canyon
#

Yup editor only but at least the tooltip field is still available and useful at runtime so pretty easy to make your own

gusty estuary
#

some cool stuff is at works
All code required to make this UI:

    public partial class TestViewModel : ViewModel
    {
        [RelayCommand]
        private void Increment() => Counter++;

        [ObservableProperty, NotifyPropertyChangedFor(nameof(FontSize))]
        private int _counter;

        public StyleLength FontSize => Counter;
    }
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements"
         xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements"
         noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd"
         schemaLocation="UnityEngine.UIElements file:/F:/UnityProjects/Packages/ECSMVVMToolkit/UIElementsSchema/UnityEngine.UIElements.xsd"
         editor-extension-mode="False">
    <ui:VisualElement style="flex-grow: 1; font-size: 70px;">
        <ui:Label text="#Text"/>
        <ui:Label text="Tooltips don't work in runtime :(" tooltip="#Tooltip"
                  style="background-color: rgb(255, 255, 255);"/>
        <ui:Button text="Counter" view-data-key="{@IncrementCommand}"/>
        <ui:Label text="$Counter={Counter}"/>
        <ui:IntegerField label="Counter" view-data-key="{%Counter}"/>
        <ui:Label text="This text font size is bound to Counter" view-data-key="{^style.fontSize=FontSize}"/>
    </ui:VisualElement>
</ui:UXML>
teal belfry
#

how do I make it so an entire background you can click and do something, but if you click on any element not-background it doesn't do the background button event?

hasty parcel
#

Any way to correct the difference between whats show in the ui builder and ingame? It looks awful in game.

unborn bluff
#

Hi guys I need help to make a coin for my game the coin name is "DIRHAM" and it's grey I don't know how to design it

wind gorge
#

UI builder defaults to the editor theme

hasty parcel
wind gorge
#

This kind of looks like bloom? Not sure how bloom can affect overlays

hasty parcel
#

There is currently no preprocessing for UI, I believe.

wind gorge
#

Maybe its due to blending with the background?

hasty parcel
#

You can see a little bit of overlap with the background and its still different on both.

wind gorge
#

Try setting the background in the builder the same as ingame, assuming the theme is also the same

hasty parcel
#

Tested that, it still looks fine with unity default runtime theme.

#

Also, disabling all post processing makes no difference.

#

Is there something I can put in a them style sheet to fix this?

teal belfry
#

wtf, this button doesn't work at all

#
tryBackButton = root.Q<Button>("tryBackButton");
        if (tryBackButton == null)
        {
            Debug.Log("backbutton null");
        }
        tryBackButton.clicked += GoBack;```
#
void GoBack()
    {
        //MainMenu.instance.CloseMe(root);
        root.pickingMode = PickingMode.Ignore;
        root.style.display = DisplayStyle.None;
        Debug.Log("backclicked");
    }```
#

its not null

#

and not clicking

hasty parcel
#

Test it with logs. Whats the picking mode on it set to initially?

#

Oh. I see you have. I types that before you updated your message.

#

Perhaps another element is ontop of it.

teal belfry
#

yerp that was it apparently

hasty parcel
#

Is there a way to make an event such as PointerUpEvent to prevent the same event from triggering on something underneath the triggering element?

hasty parcel
#

Ty

muted geyser
#

How do you make animation for the whole asset (like fade-in/out)? Do you have root VisualElement that gets animated or you can somehow animate asset?

hasty parcel
#

So I've got some drag and drop functionality using this to identify droppable slots:

    private bool OverlapsTarget(VisualElement slot)
    {
        return movableDisplay.worldBound.Overlaps(slot.worldBound);
    }

How might I improve this to prevent it from observing a slot if the slot is entirely hidden behind some other third panel? I have a popup inventory panel and I don't want it to be possible to slot into "hidden" slots.

wise ravine
#

Hello,

I'm a beginner on unity and toolkit and I'm looking to know if it's possible to control the toolkit interface with a joystick. If so, how can I do that?

somber field
#

I need help with UI toolkit TextInput.
In the UI builder page the sizes look different comapred to the simulator window.
Also while in play mode the text entered inside the text input is not visible
Here is the comparison.
Text looks small in the toolkit window compared to simulator and the input section is also very different in size

gusty estuary
somber field
#

I have only one option in that

gusty estuary
#

there should be at least 2

#

runtime and editor

somber field
#

This one right?

gusty estuary
#

well, you are meant to create your own, but for testing this works

#

also

#

check whether window size matches

somber field
#

Ohhh I had no idea we were supposed to create one also.
Some tutorials i followed did not mention that

gusty estuary
#

the best ui toolkit manual -is unity one

#

3rd party are outdated

somber field
gusty estuary
#

this works too

somber field
gusty estuary
#

it's in the manual

somber field
#

Ok

#

will check it

gusty estuary
#

first pinned link

somber field
#

Great
Will check it
Hopefully it gets resolved

fallow anchor
#

How can I repeat a background texture?

gusty estuary
#

To modify uv there's a style property

fallow anchor
gusty estuary
#

Odd

fallow anchor
#

I had to add background-size: contain and background-repeat: repeat-x

#

For some reason those properties aren't visible in the UI builder

gusty estuary
#

Ui builder is meh in general

#

Just s preview tool

#

it also misses tons of ui elememts

#

Like multi column list or tree

#

and etc

fallow anchor
#

Those are just for editor usage though right?

gusty estuary
#

They are part if runtime engine

hasty parcel
#

I have a pretty long scroll view and no matter what I set the size to, nothing changes how fast the scroll is (incredibly slow). Any advice on making it scroll faster?

gusty estuary
#

oh yeah, I'm struggling with same problem

#

I suppose bug report should help

#

there's also annoying bug with scroll color

#

which gets different in runtime compared to ui builder

pearl hamlet
#

man, this problem is driving me up the wall. Sometimes, when I start the unity editor, I don't get any input on my runtime UI, but other times, I do. Last time I got it to work, it was after I had deleted the library. I wonder if that could be part of the issue? Should I file a bug report? I'm not sure how to reproduce it, though...

gusty estuary
#

if it reproduced - file a bug report

fallow anchor
#

I never know which ones are runtime and which ones are editor only...

fallow anchor
#

Although it doesn't seem to tell you if it's runtime compatible

gusty estuary
#

check namespace

#

if it's engine

#

it is

fallow anchor
#

My screen was cutting of the namespace field 😅

fallow anchor
#

Any ideas why I can't drag an existing UXML asset into the UI builder to instantiate it as a template?

#

that just doesn't work for me

gusty estuary
#

you drag it from UI Builder panel

fallow anchor
#

Ah, I thought it meant the project library, oops 😅

#

Thanks 👍

fallow anchor
#

It's faster but is still missing features

#

and the authoring is completely different

#

I'd recommend just experimenting with it a bit and seeing yourself. If you do frontend work you'll at least find the markup language and styling parts familiar

#

Yes, VisualElement has a RegisterCallback<T> method, where T is the event type, e.g. ClickEvent

#

If you want inspector support for binding you'll need to add that part yourself somehow, since the visual elements aren't part of the hierarchy

verbal yacht
#

trying to get sliders to display correctly, but they always seem to want to scrunch up and not show the slider bar thingy...

gentle egret
#

Hey everyone, does anyone know if it's possible to detect mouseover events on buttons built using the UI Toolkit? I'm trying to trigger a sound effect on mouse over

#

Nvm, I figured it out:
buttonStart.RegisterCallback<MouseEnterEvent>(TriggerSound); and then create a custom method that receives a MouseEnterEvent as an argument for future reference.

rough scarab
#

UXML is a one way format. You can consider it for authoring only. When it's instanced it's just managed objects, no UXML.
You can instance other UXML (VisualTreeAsset) into the hierarchy from what you parsed from JSON or you construct it all via C#.

rough scarab
#

Okay?

#

My point is that UXML is not the runtime format. You can modify the hierarchy at runtime as much as you want via C#.

#

You are misspeaking. UXML is the authoring format, and the UI document is not represented by UXML, nor can be entirely converted to UXML at runtime

#

The UI document is often created by UXML, but it's a one way conversion

hasty parcel
#

I've got some drag and drop functionality. Is there a nice way to bring something "to the front"(what would be z-index in css)? It doesn't look like z-index is an option currently.

Reordering in hierarchy doesn't work for me because it messes with some Events and it needs to have 100% width/height in its style due to it's dynamically sized parent so it is massive when I move it.

Is it perhaps possible to make a custom rendering call in LateUpdate to make it draw ontop of everything else?

hasty parcel
# gusty estuary VisualElement.BringToFront

That only brings it to the front within its own local hierarchy. So if you have an inventory system where you want to drag items around, it doesn't quite work for all slots after the starting slot

gusty estuary
#

You can have everything as one hierarchy

hasty parcel
#

It is all one hierarchy, but if the thing I'm moving is nested within slot 4, it will be above 1,2,3 but under 5+

gusty estuary
#

Alternative - move your element to separate ui document and modify it's sort order

hasty parcel
gusty estuary
#

This is pretty much having element in root

#

So if you want onw hierarchy - that's the way

distant geyser
#

hmmm i have no idea why i am getting this error...
any ideas?

distant geyser
#

here's the ui builder and a link to the code in pastebin
pic 2
https://pastebin.com/xfriTZS0
pic 1
https://pastebin.com/Zb7k00hq

distant geyser
#

nvm figured it out was looking at the wrong "template" and gave it the wrong binding

vast maple
#

hi, so I have a tile-based map, which is being parsed into a grid-like system. My current problem is, how do I go about scaling this according to the map size? And is it possible to keep the grid cell size, while resizing the UI?

gusty estuary
#

I suggest to just use uGUI

vast maple
#

the square in the top middle part is the "template" object I am recreating via code

gusty estuary
#

most style attributes only exist in UXML

#

and are resolved only once on Instantiation

#

in runtime they will behave a bit differently

vast maple
#

then in what cases would you ever want to use the ui toolkit then?

#

only for static menu screens and UI?

gusty estuary
#

not world UI

#

you can do dynamic, just not something that is bound to world space

vast maple
#

I might be misinterpeting what you're saying, but this issue above isn't related to world space

gusty estuary
#

the most valuable things that are missing in UITK rn:

  1. proper text rendering (there are some limitations rn)
  2. world space
  3. materials/shaders
vast maple
#

it's when I try to add new VisualElements to a container

gusty estuary
#

🤔

#

What are you even trying to do?
Is that TileMap on your screenshot or everything is UI?

vast maple
#

it's all UI

gusty estuary
#

oh

vast maple
#
     for (int i = 0; i < size.x * size.y; i++)
        {
            VisualElement newTile = new VisualElement();
            newTile.style.width = tileSize;
            newTile.style.height = tileSize;
            newTile.AddToClassList("slotIcon");
            m_SlotContainer.Add(newTile);
        }```
#

this is essentially what im doing

gusty estuary
#

yeah, that part might be tricky, especially when you start testing different screen dimensions

#

are you relying on pixels or %?

vast maple
#

pixels

wind gorge
vast maple
#

thats not the issue

#

the issue is that its not aligning properly within a container

#

if i copy paste the elements, they align like this, which is what I want

gusty estuary
#

you might want to go with % then

vast maple
gusty estuary
#

that's the only way to keep it dynamic during screen resize

vast maple
#

that's a fair point, but still not the origin of my issue

wind gorge
#

it kind of looks like you're not adding them to the right container?

#

the ui debugger is your best friend there

#

compare the styles on both the container and the tiles with the copy-pasted method and see what is different

gusty estuary
#

oh wait

#

you can also use callback

#

<GeometryChanged>

#

to track resize

vast maple
#

was adding it to the root instead of the container

#

thanks

vast maple
muted geyser
#

I'm trying to make animation logic when switching between menus (for example from main to settings). Is it better to use tweener or try to add uss classes at runtime?

gusty estuary
unborn bluff
#

is it possible to change the USS from a C# script

gusty estuary
#

Is there any event that tracks adding to hierarchy?

#

I am trying to make custom radio group

#

and I need a way to obtain all children that will be added after construction

gusty estuary
#

yes, background style supports it

#

create a circle visual element with infinite border radius

#

and then register it to all pointer up/down events

#

this will make your VE a perfect circle

#

no matter what size it has

#

otherwise you are fine just setting a very huge number

#

judging by description it's a custom field for us to use however we want

#

are you talking about my package

#

?

cosmic raft
#

Has anyone else experienced a huge increase in build size after adding and using UI Toolkit? web build.data is 167.97 MB and it's a single scene with minimal UI elements. The prev file size (before adding and using UI Toolkit) was 26MB.

small vapor
#

it's possible to have inline images using rich text in the UI Toolkit?

gusty estuary
small vapor
gusty estuary
#

here all supported

#

and yeah, looks like sprite is indeed supported

small vapor
#

Hi there, does anyone know if the Unity UI Toolkit can completely replace UGUI? I've missed some things, especially a tool for making interface animations. In these aspects, can the UI Toolkit already replace UGUI?

gusty estuary
#

world space UI is uGUI

#

and I don't believe there's any better solution

small vapor
#

and how about ui animation?

gusty estuary
#

ui toolkit supports transition animations

#

all done through styles

tawdry bone
#

Hi, I'm using the UI Builder to create UI for my new project and was wondering if it is possible to add components to Visual Elements, so when I clear and add sub elements, they can handle their own interface logic. Or more like VisualTreeAsset's, hence uxml objects you open to edit in the UI Builder.

gusty estuary
#

as for components - you can add manipulators

tawdry bone
#

well I'm trying to create a whole menu system with the UI Builder, including settings and etc. So each button needs logic. My thought so far was to use VisualTreeAseets and add/remove them based on button clicks.

#

but so far I only have a main MenuControler script attached to the UIDocument Root.

#

it would be nice if I can somehow just add the Visual Element "sections" replacing certain parts of the UI with ´Clear() and Add(...CloneTree()).

#

and each "template" have their own monobehavior logic

#

or am I going about this wrong?

gusty estuary
#

I'm not sure what exactly you are trying to do

tawdry bone
#

Like I said, create a complete Mainmenu with basics like settings and etc

#

but obviously certain elements need to change to go through setting menus

gusty estuary
#

this way you'll have easy way to bind logic through uxml

tawdry bone
gusty estuary
#

everything requires code from behind

tawdry bone
#

but I guess basically I just want the templates, like a VisualTreeAsset to be paired with a component

gusty estuary
#

I hated this workflow and made this framework

#

😅

tawdry bone
#

ahh

#

that makes sense then

#

damn... so when ever I replace a sub-interface element with a certain uxml asset.. I need to manually give it a component o.o

gusty estuary
#

I think you should go over UI toolkit manual first

#

I feel like you are misinterpreting how it works

#

2022.2 version of manual is reaaally good

tawdry bone
#

ok

tawdry bone
#

Sorry, but I'm starting to get confused. I have watched multiple vids on how people are using the UI Toolkit and read through most of the docs, but everyone is doing something else. Is there no simple "meant-to-be" way to change the state of the UI and give it logic with the Toolkit? Like when pressing the settings button in a menu menu, the existing MainMenu is removed and adds the settings UI with according components/logic to handle the sliders/buttons?

wise dawn
#

Hey there guys. I have an inventory and I want to drag items out of it. Each slot has a visual element and the problem with the code I have is that if i move the mouse too fast I will lose the Icon. Basically it stops updating the dragged Icon position(it stops).

#

draggedIcon.RegisterCallback<PointerMoveEvent>(OnPointerMove);

#

private void OnPointerMove(PointerMoveEvent evt)
{

        if (!draggedIcon)
        {
            return;
        }
        
        draggedIcon.style.top = evt.position.y - draggedIcon.layout.height / 2;
        draggedIcon.style.left = evt.position.x - draggedIcon.layout.width / 2;

    }
#

And the class is a Scriptable Object. Tought a Coroutine could solve this, but I cant use that. Does anyone know another solution to update its position when it moves too fast?

gusty estuary
#

Model-View-Presentation, Model-View-ViewModel and etc

#

my framework brings the best out of MVVM

woeful cave
#

I'm trying to make a style for my slider, so the Label only takes on 100px and then leave the rest for the slider itself. In flexbox (HTML) that is easily achieved by setting flex: 0 0 100px - i can't seem to change anything though - i can change grow/shrink/auto but nothing happens?

#

I can change the color and font size though - but the width of the label i can't change?

#

my selector is .unity-slider Label and like i said i can change lots of things, just not the size or flex properties

#

found it:

.unity-base-field__label {
    min-width: 100px;
}

It seems it had a min-width set to something more 🙂

lean horizon
#

is there is any hacky way to make UI_Toolkit world space?

wise dawn
#

problem was with the draggedIcon.RegisterCallback<PointerMoveEvent>(OnPointerMove);

#

m_root.RegisterCallback<PointerMoveEvent>(OnPointerMove);

#

will solve

#

m_root being the main uxml covering the all canvas

unborn bluff
wise dawn
#

guys noob question

#

how do I change value of visualElement width in c#

#

wanted to do something like _visualElement.style.width.value = something

#

i cant

vast maple
#

Is it possible to render a UIDocument on a plane or something?

gusty estuary
#

but having so many RenderTextures and panels will certainly be no good for perfomance if it's world space you after

woeful cave
# wise dawn how do I change value of visualElement width in c#

You do like you would in the properties window, so if it works to change the width value in the properties window, then yes, that is how you do it with code as well. Often though, you want to use the Flex layout instead - depending if you want specific width or just want it to fill out some space

#

If the value does not change when you do it in code, then try if it works in the properties window - chances are, it doesn't work there - then find what properties work first, then do the same in code. Often the width of an element is controlled by the parent if in a flex layout

wise dawn
wise dawn
#

Btw i solved it

#

It was working. I was just querying the visualElement for the _manaBar before it was in the main VisualAssetTree

#

so it couldnt find it

hallow fjord
#

Is there a way to tint BackgroundImages in a VisualElement in a color?

        {
            value = new Background
            {
                sprite = img,
            },
            keyword = StyleKeyword.Undefined
        };
        backGround.style.color = new StyleColor
        {
            value = Color.green
        };```
#

this sytle.color wont have any effect. the background sprite stays white

#

do i need to create all color variations as extra sprites now?

gusty estuary
#

or smth like that, take a look at UI builder, it has it exposed

#

right below texture selection

hallow fjord
# gusty estuary imageTint I believe

ah its style.unityBackgroundImageTintColor in C#. thanks!

got another basic question. how do i make a visualelement not grow with its children?

gusty estuary
#

you can define it in % or px

#

or with initial

#

so it's fixed with initial size

#

Allthough I'm not sure on later

#

never used it

hallow fjord
#

yes youve shown me. but i need it for editor

#

the green pills are a scrollview

#

i want the scrollview to not scale up the parent container with more items

#

so that there would actually be scrolling

gusty estuary
#

That should work that way by default

#

you define scroll view size

#

and it never changes

hallow fjord
#

thats how i wanted it to look. but to make that screenshot i had to set the width of the VisualElement containing the scrollview to a hardcoded value.

gusty estuary
#

are you setting it up in uxml or pure c#?

hallow fjord
#

i want that element to not scale based on the items in the listview

#

pure c# atm

gusty estuary
#

hmm

#

Check whether you add to scroll view correctly

#

btw, now that I thought about it, my package should work in editor

#

you'll just have to manually create instance of binding through code and that's about it

hallow fjord
# gusty estuary Check whether you add to scroll view correctly
        scrollView.mode = ScrollViewMode.Horizontal;
        scrollView.horizontalScrollerVisibility = ScrollerVisibility.Hidden;
        scrollView.contentContainer.style.flexDirection = FlexDirection.Row;
        scrollView.contentContainer.style.flexWrap = Wrap.NoWrap;```
thats my scrollview and i just add to it with scrollView.Add(someElement)
#

but the scrollview should not be the problem here. the visualelement containing that scrollview is. how do i avoid scaling it based on children but scale it based on parents?

gusty estuary
#

100% width

#

for example

hallow fjord
#

doesnt work 😦

gusty estuary
#

and what happens instead?

hallow fjord
#

nothing

gusty estuary
#

then waht's the problem?

hallow fjord
#

my scrollview still scales the parent visual element and with it the whole node

gusty vapor
#

then (optionally) set the parent to a fixed size in % too

#
parentVisualElement.style.width = new StyleLength(new Length(50, LengthUnit.Percent));
#

so 50% here will only apply to the parent but it will be 100% to the children

nimble marsh
#

How can I make an image behind the button and make it as child of this button?

hallow fjord
gusty vapor
#

are you sure you're styling the correct VisualElement?

hallow fjord
#

there are not many involved.
The hierarchy : Node-ContentContainer-QueryContainer-ScrollView

#

i set the QueryContainer to 50 %

#

the scrollview somehow still scales the Node

#

Im a UI noob so tell me if im wrong here but scrollview should be contained within QueryContainer right?

#

whats the setting that allows a childelement to increase the parents size?

#

i mean what causes the node to scale when for example one of the PortLabels in the inputcontainer would overflow

#

when i set position to absolute it looks like this:

#

scaling would be correct like that but position is obviously wrong

#

seems like i need : style="max-width:fit-content;" how do i do it in USS?

kindred current
#

Hello! anyone know if there is a video element, or if there is a way to add video in UI Builder?

gusty estuary
#

is supported by styles

#

and you can render video to it

kindred current
#

thanks I'll look into it

hallow fjord
#

Wow. Who decided it would be a good idea to have backspace delete unsaved UI Builder VisualElements without warning 😄

#

missclicking into a textfield and hitting backspace just deleted all my test setup again :S

gusty estuary
#

supreme editor

hallow fjord
#

im pretty sure scrollview is bugged. at least the horizontal version

#

here is my repro in UI builder :

gusty estuary
#

paste uxml instead

hallow fjord
#

Both "nodes" (blue and green) have the same settings. the only difference is the green one has a visual element as the child in CantScaleNodeContainer and the blue one has a scrollview

#

CantScaleNodeContainer is set to 100% width. so it should keep the size of the parent. (the node)

#

but in the blue node the Node is actually scaled as if CantScaleNodeContainer was set to auto width

gusty estuary
#

you have way too many styles attached

#

to scroll view at very least

#

align-self: flex-start;

#

this one might not do what you want

#

and you might want to control it's position through parent instead

hallow fjord
gusty estuary
#

so what's the problem? ScrollView is bigger than you want?

hallow fjord
gusty estuary
#

?

#

I don't get it

hallow fjord
#

and its different behaviour than a simple visual element

gusty estuary
#

do you want scroll view to match size of it's parent container?

#

or not?

hallow fjord
#

yes. and it may not drive the size of the parent.

gusty estuary
#

it doesn't do that

hallow fjord
#

which is usually achieved with setting the container to 100%

#

it does. else it would only be 200px in the sample

#

which is the width of the node

#

it would have the width of the green node

gusty estuary
#

can you show scrollView in debugger?

#

scrollview mouseover

hallow fjord
#

it is scaling the node. even though its supposed to have 100% of the parents width...

gusty estuary
#

you don't show how it looks 😅

hallow fjord
#

huh? what do you want to see?

gusty estuary
#

this shows element size

#

margin

#

and padding

hallow fjord
tawdry bone
#

question about the proper way to handle switching menu's like in a main menu to the settings area. following a class for the UI Toolkit for Runtime: he uses a custom "panel manager.cs" with a root "UI" GO, and then depending on buttons pressed , the panel manager will enable/disable the according children game objects that have UI Documents on them. Is this in 2023 how I should do this?

hallow fjord
#

kinda hard to see but scrollview is slightly bluish

gusty estuary
#

I can see it

#

so I don't see how anything wrong with it

#

seems like it's saying in bounds

#

of it's parent

hallow fjord
#

yes its in bounds but it did scale the parent

gusty estuary
#

check parent

#

and it's size settings

hallow fjord
#

parent is set to 100% too

gusty estuary
#

in debugger as well

hallow fjord
#

didnt i show that the bug is there with my repro?

#

if not can you explain to me why the blue node is bigger than the green one

#

when none of the child elements are supposed to scale the node

gusty estuary
#

that's the whole point of scroll view

hallow fjord
#

its exactly what i want to achieve. i want it to ignore the children so i can actually scroll through. but its not working. the children do somehow scale the container

gusty estuary
#

can you show it?

#

so far it seems like children are within scrollview bounds

hallow fjord
#

when i delete the scrollview from the blue node :

#

both same size

#

sec i encountered another strange thing -.-

#

I CANT DEAL WITH THIS omg

#

just by dragging the scrollview over the hierarchy this happens

#

the green node has no settings changed but now it ignores its set minSize of 200px

#

okay bug nr 2 aside :

#

scrollview added again. nothing changed all good

#

adding elements to scrollview and setting it to horizontal

#

its supposed to be as big as the green one still

gusty estuary
#

idk what you are doing

#

I just tested

#

my scrollview matches exactly size of container

#

with only style

#

flex grow 1

#

same for horizontal

#

I use % to control size

#

pixels don't work

#

that's the only thing I noticed

#

that is unusual

hallow fjord
#

else you wont need to scroll

gusty estuary
#

yes

hallow fjord
#

but thats where my issues start

gusty estuary
#

children of scroll view are 500x bigger than it is

hallow fjord
gusty estuary
#

I don't use pixels for sizes

#

they don't scale with screen

#

only text pixels scale

hallow fjord
#

yes but for arguments sake. containing the scrollview inside the outer container without scaling it

#

thats the whole point

gusty estuary
#

no, pixels didn't work for me

tawdry bone
#

Let me re-ask with the current Info I have gathered about the UI Toolkit, I see two options currently about navigating through a menu:

  1. Create a root UI Panel Manager that registers to certain buttons and enables/disables certain game objects that contain a UIDocument and script for handling the logic of that template.
  2. Create a root UIDocument for that scene and dynamically clear and clone templates based on buttons pressed and also having to add script/logic components for the loaded in UI.

These are are 2 variants I have seen people doing on Youtube, but these are from over a year ago and many components they use dont exist currently.

So what in 2023 I currently the "proper" way to navigate through UI and dynamically change its content with the logic it needs.

gusty estuary
#

I use approach of pre-creating whole hierarchy and just enabling/disabling it through display style

#

as for navigation - no right or wrong approach

#

even in non-gamedev GUIs every framework uses it's own implementation of navigation

#

so it all depends on how you want to do it

tawdry bone
gusty estuary
#

this is MVVM, so potentially oyu worked with it

#

already

hallow fjord
#

no matter how the outer container is setup. can be in % too

gusty estuary
tawdry bone
gusty estuary
#

and no one really answered about proper pattern to use

#

but if you use naked UITK

#

I belive that would be MVP

#

with pretty much everything having code behind

#

the only thing they mentioned about proper pattern - styling

#

they use BEM

#

and recommend to use one as well

tawdry bone
#

@gusty estuary , what do you think your future support will be and do you think the UDevs will implement your work, or something based on it in the future?

gusty estuary
#

they said they work on binding and localization support

#

welp, i did it already 😅

tawdry bone
#

hehe yeah

#

ok, thank you for your work, I will read your docs and see if I can implement it

zinc minnow
#

how might one get :hover to work on elements if there's another element between it and the mouse? is there a way for hover to work without setting the picking mode to ignore for the topmost element?

hallow fjord
hallow fjord
#

And now i dont like the look of it anyways 😄

gusty estuary
#

take a look at uitk manual

#

styling section

#

it has explanation on child selectors

dire nova
#

I want to show a few dots when text doesn't fit into a line, I've tried setting overflow to hidden, Text overflow to ellipsis and Wrap to no wrap. This seams to somewhat do the job but it hides the line below aswell, what am I doing wrong?

gusty estuary
#

if you could check if it's reproducable in new project - bug report would be appreciated

dire nova
gusty estuary
#

but it certainly sounds like very edge case someone didn't think of

sick timber
#

hello, I'm new to the whole UI Toolkit system, I'm trying to make a hud and menu manager for my game.
I'm trying to move some of the Update HUD stuff over to the UI, and let the monobehaviours ask for it, but I'm not sure if thats good practice.
Could I get some tips? 😅

gusty estuary
sick timber
#

yes, uGui specifically

#

Im also a web dev

gusty estuary
#

are you familiar with mvvm?

sick timber
#

Sorta yes. I usually do more mvc

gusty estuary
#

other than that - there are no patterns Unity defined to build UI with UITK, so... mostly people just do their own thing

#

and it always involves a lot of code behind

#

since built in binding doesn't work outside of editor

sick timber
#

I assume this can compile to WebGL? UnityChanThink

gusty estuary
#

oh yes, I am developping a webGL project while doing it 😅

#

so I ensure it's fully supported

sick timber
#

@gusty estuary think I can reuse my existing uxml? Its a bit nested.
I assume all I'd need to do is set up the text bindings on the UI Builder(?)

gusty estuary
#

My framework assumes you split logic between different .uxml difles for each screen or it's part

#

but technically

#

you can still nest everything at the same file

#

it's just not going to be very perfomant

sick timber
#

how so?

gusty estuary
#

It uses INotifyPropertyChanged attribute

#

allthough...

#

binding happens to nested object instead...

#

yeah nvm

#

perfomance will be same

#

Bindings are set up in .uxml

#

you can use Builder yes

#

but generally I suggest to use simply text editor alongside, since UI builder is really underdeveloped (many built in elements are not even present in it)

sick timber
#

How does one install?

gusty estuary
#

just clone repo somewhere and use Unity PackageManager

sick timber
#

my lad, have you considered openupm?

#

can I add package from git url instead? (Im participating in the game jam)

gusty estuary
#

I did, but I haven't released a stable version yet

sick timber
#

ah

gusty estuary
#

as I constantly push new features

gusty estuary
hallow fjord
#

is there a way to write my own visual elements such that if i bind a Scriptable object to the upper most visual element each child element binds the correct properties?
essentially what do i need to do to cascade that binding

rough pewter
#

focusing a TextField from code using .Focus() is not selecting the text, neither using .SelectAll()
could someone help me to achieve it?

static canyon
rough pewter
#

the elements are getting focused properly, the problem is that it doesn't open the text editor engine again (no caret, no selection, no keyboard input...)
I've already tried with .delegatesFocus = true, .visible = true, .SelectAll(), .Blur() and .Focus()

static canyon
rough pewter
static canyon
# rough pewter 2021.3.16f1

Ok - I think Focus() is working for us fwiw. I'd suggest double checking it still doesn't work in a new scene and make the simplest repro you can - if it's still broken, submit bug with repro to Unity. If it works, my guess would be there could be another listener (eg FocusInEvent or something) causing eg a change in a listview or some indirect change of selection. I'd also suggest making sure the textfield.isDelayed is set to true for testing it too.

rough pewter
#

im using a custom text field with placeholder that inherits from TextField using RegisterValueChangedCallback, RegisterCallback<FocusInEvent> and RegisterCallback<FocusOutEvent> but im not modifying its focus on them

static canyon
#

If the problem is only with your own custom inherited version I can't offer much advice except do be sure that you're correctly calling the base constructor with whatever parameters are expected.
i.e.

{
    public MyTextField():base()
    {}
}```
rough pewter
#

is it necessary even if base is empty?

#

i have a constructor without :base()

static canyon
rough pewter
#

it is not working either with a standard TextField

#

but it works fine if I toggle the enabled property before focusing on it like this

#
textField.SetEnabled(false);
await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate); // Wait a frame
textField.SetEnabled(true);
textField.Focus();
hasty parcel
#

If I have a selection of possibly overlapping visual elements and I want to determine which one is "on top" how could I determine their position in the hierarchy? I don't see a method or documentation on this.

#

And I mean relative to the root. child.parent.indexOf(child) won't work.

gusty estuary
#

hmm

#

there's hierarchy field

#

check if it contains reference to parent

hasty parcel
#

Z-Index would be really nice to have :/ even if it was just a readonly computed field.

I'm hoping that calling .Last() on a querybuilder will work.

#

That did appear to work.

tame palm
#

Is there a way to force a ui element to resolve its size immediately? Let's say I have a tooltip and dynamically resize it based on the text inside that tooltip, the text will change immediately but sometimes the size remains at its previous size for a frame

gusty estuary
#

you can notify root element

tame palm
#

Found it, thanks!

celest grove
#

When using a FontAsset In Label, no color is applied.
Is this supposed to be like this?

gusty estuary
#

rich text does not work with custom fonts it seems

celest grove
#

And using Font, sometimes works fine, but sometimes it throw the exception, MissingReferenceException: The variable m_AtlasTextures of FontAsset doesn't exist anymore.

gusty estuary
#

yeah

#

I noticed it too

celest grove
#

should I not use rich text in ui-toolkit?

gusty estuary
#

I use it, but no text shadow or outline can be used

#

along

full agate
#

so with toolkit, for images, how do I use the sprite atlas? It doesn't seem to be an option.

full agate
#

tried many different ways, all are pretty inconvenient, best way is using a PNG sprite sheet

gusty vapor
#

it is the future of Unity's gui, so definitely yes

#

much faster than the legacy

gusty estuary
#

world space is under consideration for UITK so

#

potentially it would be meant to use both

#

for different purposes

gusty estuary
stone fox
#

The manual mentions to do it this way so it should be fine. I would expect the "none" display styles internally to be moved to some other list so it doesn't get processed. I'm not aware of an alternative other than unloading the document or using several gameobjects, one for each panel/screen.
In general: don't assume, measure! 😉
In the meantime trust what Unity is saying you should be doing ...

gusty estuary
#

style.display makes VE ignored when building or propagating events.
As alternative - you can literally cut it away from hierarchy and re add on demand.

#

VisualElement without attached panel will only take up memory afaik

surreal ember
#

Maybe a bit complicated problem, For custom control visual element, How to add a list trait, for example, a scriptable object list.

#

UxmlListAttributeDescription is not available

gusty estuary
#

not possible

#

You can only attach any Unity Object through code

surreal ember
#

When I newed a custom control, using another script change that list, it seems not binding. that list I set to public static

#

Hence, I am thinking using trait

#

Like a popwindow,show the filtered list, the list is keep update by another script

#

Tried three days, always said the object reference problem

#

Can this custom control be made by UI Toolkit?

surreal ember
#

I found another way, visit the custom control visual element, then add a list to it. This seems the easy way to do it, and more flexible

#

when I newed the custom control in other script, just visit the new one , then add the list

#

This way errors should also be less

dire nova
#

How can I make a Text Field always focused?

gusty estuary
dire nova
gusty estuary
#

what is actual goal behind it?
Technical implementation you ask for will remove any gamepad/keyboard support for navigation

dire nova
#

You should be able to edit the name while selecting a Category and Template

fallow anchor
#

What's the intended way to update UI toolkit elements if I need to do something each frame? I can't find an update event or anything, is there something better than just externally calling the function each frame from somewhere?

#

The only real native thing I can think of is doing something like schedule.Execute(...).Every(0), although I'm not sure how that interacts with the update loop

#

Also, are schedulers automatically cleaned up if the element leaves the hierarchy? I haven't used them much

gusty estuary
#

but I'm curious what exactly do you have, that you need update?

fallow anchor
#

e.g. updating values on a progress bar

gusty estuary
#

generally UI should never have update, but instead be fully event based

#

ooh

#

I solved it by using async methods

fallow anchor
gusty estuary
#

my progress bar view model provides IProgress<float> object

#

after I get reference to it, I just report current progress to it in async method before yielding

#

most Unity async operations have a property to provide current progress

gusty estuary
fallow anchor
#

How so? The visual element can just read the value from the entity

#

And I checked earlier, the scheduler updates each frame, and automatically de-registers if the element is removed from the hierarchy

gusty estuary
#

because if it's just task - then it's as easy as slapping async to method

#

and doing it all just inside of it

#

let me show some example I guess

fallow anchor
#

Yeah I get that, but how is that easier than a method that is just called once per frame

#

(This is without events)

gusty estuary
#
        public static AsyncOperationHandle<T>
            WithProgress<T>(this AsyncOperationHandle<T> operation, IProgress<float> progress)
        {
            TrackProgress().Forget();

            async UniTask TrackProgress()
            {
                while (!operation.IsDone)
                {
                    progress.Report(operation.PercentComplete);
                    await UniTask.Yield(PlayerLoopTiming.FixedUpdate);
                }
            }

            return operation;
        }
gusty estuary
#

system is overkill

fallow anchor
#

It does have one

#

schedule.Execute(...).Every(0) runs once per frame

gusty estuary
#

it does? Is it exposed?

#

ooh

#

that's what you meant

#

I see

#

didn't know about it

fallow anchor
#

It also seems to automatically be disposed if it leaves the hierarchy

#

I don't have a lot of UI so I don't want to over engineer it

fallow anchor
#

The progress bar is health, so it's not a thing that is done at some point

#

It just needs to update to the current value (and animate a little)

gusty estuary
#

ah

#

then I guess you can go on with system here

#

which retrieves proper instance in OnStartRunning

#

and then just updates value with change filter

#

this way you can even use SystemAPI

fallow anchor
#

I'm not sure if I should have a single system to update all bars, or keep the update code in a custom visual element

gusty estuary
#

well, if you have a lot of them

fallow anchor
#

Since if bars can be created / removed during runtime the system would need to re-query the UI document (which wouldn't be a huge deal)

gusty estuary
#

a system will be perfect

gusty estuary
fallow anchor
#

It's just generic HUD stuff, health, mana, etc

gusty estuary
#

if it's singleton - then system is best

rocky raptor
#

Is it possible to remove the pointer events with css only?

#

(don`t block mouse)

gusty estuary
rocky raptor
gusty vapor
cerulean gyro
#

Hello !
Is there a recommended way to modify the default styling of a builtin VisualElement ? As exemple, I would like a Radio Button to display a Button instead of a toggle with the associated name next to it (similar to the EnumButtonGroup of OdinInspector) . Do you have any recommandation to achieve something like this without reinventing the wheel ? Thanks !

gusty estuary
#

generally you use TSS Themes

#

with your own style overrides to default Unity theme

cerulean gyro
#

Thanks for the answer ! I will look into it. I did'n found this documentation this morning.

teal belfry
#

if I want to show a particle effect

#

do I need to make a RenderTexture?

#

or is there a better way to do this?

wise dawn
#

Where can i learn uitoolkit responsiveness

#

Basically I have a VisualElement Inventory that has a background Image

#

and i want to have this inventory responsive to every screen but the image doesnt keep its aspect-ratio

hallow fjord
#

How would you guys handle this:

#

hovering over "TargetQuery" expands the grey box with the ALL ANY and NONE Lists

#

that VisualElement obviously needs to get in front of everything else.

#

Its supposed to be some kind of ContextMenu

#

I want that Menu to be a Child of that TargetQuery VisualElement so that i can use absolute position based on it.

#

So what i would need to do now is to move the TitleContainer of the Node above the contentContainer. But if I do this i get that result:

#

the menu is in the front now but the order of the flex parents changed with it

#

So TLDR : How do i render VisualElements on Top without having them on Top of the Hierarchy?

gusty estuary
hallow fjord
#

for me its a little bit more complicated. i need to add the VisualElement to the Node, else the Zoom function does not work with it

#

guess i need to calculate the absolute position relative to the node coordinate space instead of the graphview

#

can i get the absolute position of one element based on another?

#

e.g the absolute position of the TargetQuery Element based on the Node?

hallow fjord
#
        {
            VisualElement element = (VisualElement)evt.target;
            var absoluteWorldPos = element.LocalToWorld(element.transform.position);
            var node = GetFirstAncestorOfType<Node>();
            var absolutePosInNode = node.titleContainer.WorldToLocal(absoluteWorldPos);
       }```
gusty estuary
#

seems like very complex solution

#

can't you just make dropdown a child of element you clicked?

hallow fjord
#

i cant add it as a child because then it does not render on top anymore

#

which was the original problem

#

i need to add it to the node (so content scaling works) but at the absolute position where the child is.

gusty estuary
hallow fjord
#

Yes I know. as I wrote unity has z ordering on roadmap. It's just a missing feature I need to get around.

rocky steeple
#

Yo!

#

Guys!

muted geyser
#

How to track if style "Display" is changed on visualElement with callbacks?

lapis pendant
#

I have a map editor for my game with buttons for a user to select what kind of items they want to edit onto the map. im looking to show the 3d objects on these selection buttons so the user can visually identify what they are selecting. It is a grid of buttons which means a lot of these 3d objects need to be shown at once. Is there a good way to go about this? I thought about potentially using a secondary camera and rendering the 3d model somewhere away from the main gameobjects and stuff but that wont work when i need to display a bunch of models for a bunch of buttons. not sure what to do.

#

Should I just setup a scene with a camera to take images of the models somehow?

#

or is there a better way?

#

I am using the new UI builder with USS.

lapis pendant
#

I just ended up setting up a camera to take image captures.

#

anyways i have a new question.. does the IMGUIContainer visual element have an actual image property i can apply an image to? or just the background image property?

#

and also, i cannot programmatically change the background image of my IMGUIContainer element, here is what i am attempting
tileInfoImage.style.backgroundImage = Resources.Load<Texture2D>("D:/Strategy Game/Assets/Screenshots/Sea.png");

#

this doesnt throw an error or anything but it does show nothing on the background image, its just blank / empty space.

dark blade
#
.label-style {
    -unity-font: url('project://database/Assets/Block%20Square/Scripts/Editor/Fonts/COASBL__.TTF?fileID=12800000&guid=a598abb22c2113948b4bc28a6cb9e536&type=3#COASBL__');
    -unity-font-definition: url('project://database/Assets/Block%20Square/Scripts/Editor/Fonts/COASBL__%20SDF.asset?fileID=11400000&guid=bc0163fd39f3dd048b3889989c489ca7&type=2#COASBL__ SDF');
``` how i can get the path like that??, using copy path by right clicking in editor wont give that path, thanks in advanced

edit: anyway im using UI Builder and assign the Font from there to get that path, but what if i dont want to use UI Builder just to get the "correct path"
gusty estuary
#

it's way easier to manage USS styles with UI builder compared to text editor as well

dark blade
gusty estuary
#

yeah, I feel you

#

but just get used to use both

dark blade
#

okay thanks, hope they improve more, on next uodate

gusty estuary
#

there are many things UITK is missing

#

far more important than url assigning tbh

dark blade
#

i know, and its A LOOOOT

#

anyway see ya,

gusty estuary
static canyon
#

at least, that's been my experience and the technique I use

muted geyser
#

How do you animate transitions between screens (from main to settings for example)? Using Tweening library or using styles with transitions?

gusty estuary
#

but UITK indeed supports transition animations for this

#

allthough, their implementation could be tricky

muted geyser
#

for the moment feels like adding and removing styles with transition can make a headache

gusty estuary
#

Check if there's transition trigger for display style

#

cause usually you enable/disable screens using this style

muted geyser
#

i know

gusty estuary
#

if it does support it

#

there most simple animation that comes to my mind - using root screen's transform and just move it to side when none and from side to center with flex

muted geyser
#

the main issue is to how manage this animations. Create 1 style with complex animations; Create multiple animation styles and combine them with code and registrer callback on end to disable particular screen
Here comes the question with reusability

gusty estuary
#

USS has a lot of selector options

#

you barely need any code to work with styles

muted geyser
#

With tween library like Dotween i can make DoTween.To value like opacity but i need to create some sort of framework and thats quite time-consuming to be able create atom-based animations like opacityAnimation and reuse the functionality by tweaking some values while with uss i need to create opacity style for each animation

gusty estuary
#

well, depending on pattern you use

#

it varies

muted geyser
#

yea

gusty estuary
#

I personally would rather avoid using code behind

#

and do it with styles

#

meanwhile nothing also stops me to adding some inlined animation options for all root screens

muted geyser
#

yea but my thought about tween library came after i could not understand how to add "pre-animated" state.
For example:
When switching Main to Setting I want:
Scale-out main screen;
Scale-in setting screen
Setting screen has to be in special scale, after add scale-in style and transition will come automatically

gusty estuary
#

UITK animations are transitions

#

so you would want to define your pre state in a style

muted geyser
#

scale-in-prepare which will have scale 0.7 0.7
scale-in with transition scale 1.0 1.0

gusty estuary
#

for example ```css
.disabledScreen { display = "None";
Transform.x = -1;
}

muted geyser
#

and when transition started remove style scale-in-prepare?

gusty estuary
#

when you remove style

#

animation will begin

#

if it's defined

muted geyser
#

it would work but i don't know why but it feels odd. Need to try out styles on maximum and after consider should I shift to tweener

gusty estuary
#

your defined animation will happen until previous style values meet new style values

#

idk, UITK is first UI framework I worked with, so... feels ok to me 😅

#

(well, after IMGUI)

muted geyser
#

Heh

lapis pendant
#

I get that this system realizes to reusable UI document files but is there a way to create customized UI components that can be reusued across not only UI document but many? For example if you want to have multiple UI documents for multiple different scenes but they all have access to a customized button component.

static canyon
lapis pendant
#

You can only load a single uxml file to a UIdocument/scene though right?

#

Sounds like the custom visual element might be what I'm looking for

static canyon
lapis pendant
#

Sounds overcomplicated for the solution, I think I'll go with the custom visual element route.

#

Thanks for the tip

#

Also do you happen to know if the IMGGui element has an actual image property or just the background image property?

#

Cus I can't find a bonafide image property. Makes me question the point of the IMGGui element its basically just a normal Visual Element with a different name.

static canyon
#

🤔 sorry - not too sure I understand. The IMGGui element is mostly there to support the old editor UI - you can draw what you want in there but I wouldn't recommend using them unless you absolutely have to.

lapis pendant
#

Basically just looking for a component to display an image.

static canyon
#

just a basic VisualElement can display an image by setting the background property

lapis pendant
#

I ended up using that IMGGui element because it sounded right

static canyon
#

I'd suggest it's probably not what you want

lapis pendant
#

Yeah sounds about right. Usually a background image property means that the container won't respect the image size so it could cut off the image. That was the concern

#

Speaking in terms of how web development stuff works.

static canyon
#

I'd suggest experimenting in UI Builder to find what you need rather than doing everything from code - you usually need to set the background mode to what you want (eg scale & fit) and you often need to nest visual elements for more controlled alignment & sizing.

lapis pendant
#

I have been doing that for the most part but that specific use case i needed to set things programmatically as i have a heads up display thingy that changes the text and image depending on what piece of terrain the user is looking at

#

but everything else is static and will be set in the UI builder

gusty estuary
#

but if you talk about specific VisualElement instances shared across multiple views - then no

#

also you can use as many UI Documents as you want

#

there is a way to use them in hierarchy, but I find this approach not very useful, due to the fact, that enabling of UIDocument fully recreates view from scratch, which is slow.

lapis pendant
#

Is there a way to set a button index? I have a bunch of buttons in a single UI element panel laid out like so

#

pressing the D keys (using WASD navigation) goes in the order above

#

ideally it should work more intuitively than that, such that if you are on the top row of buttons it goes from "Terrain" to "Buildings" to "Units" to "X" (close) and if you are on the row below that then it would go "Plains" and then "Sea"

#

but it doesnt really work that way

#

I've tried googling this but there isnt any relevant answers as far as i can tell

#

I've also tried the "Tab Index" options and set them to
0,1,2,3
4,5
but that doesnt work either

surreal ember
#

A basic problem. I want to make a popUp custom control, when I make the window flex , it will share its width with other visual Element, which make it in the hierarchy, not hover , how to fix it?

surreal ember
lapis pendant
#

I don't get how that would make the button selection work in a certain order

surreal ember
#

Then VisualElement.Add(Button[0]), should use for (i=0; i< buttonList.Count,i++)

lapis pendant
#

Hmmm

surreal ember
#

I think first make a condition how you order the list, then do the circle add the buttons by index

#

cycle

#

This way all button children are arrange by its index

surreal ember
#

.

gusty estuary
#

And size manual

surreal ember
#

Thank you so much! it works

tribal void
#

Is there a way to get all elements un a UIDoc that have Text available on them?

gusty estuary
#

where T is TextElement

tribal void
#

oh I see, everything that has text will be inheriting from TextElement

#

like Label, Button etc

gusty estuary
#

kind of

#

some custom elements might implement text as well

#

but that would be on them

tribal void
#

I am only using the unity ones, and the ones I made myself.
So if I know that I can make sure its correct

#

unless unity makes changes to that structure I will be fine

#

and that seems unlikely

gusty estuary
stable relic
#

How do i add selectables for the drop down button?
Add all the options
Right now its just blank

lapis pendant
#

am i really to understand the ui toolkit is just so broken and incomplete that you can't simply configure the focus order on ui elements?

#

the more i work with unity the more i question my choice in using it.

gusty estuary
lapis pendant
#

just so frustrating to get the dumbest things working.

lapis pendant
#

but it doesnt affect the WASD/arrow key focus order

gusty estuary
#

🤔

lapis pendant
#

those will just be messed up no matter what.

gusty estuary
#

are you sure your elements are sorted correctly?

lapis pendant
#

im not entirely sure what you mean

gusty estuary
#

open debugger

lapis pendant
#

do you mean with the focus index property?

gusty estuary
#

no

#

I mean hierarchy of your elements

#

as children

#

whether it's correct

lapis pendant
#

is there a specific debugger for ui toolkit stuff?

#

and if so where do i find that please?

#

i will check

#

ah okay i think i found it

gusty estuary
#

on top right of game view

lapis pendant
#

what am i looking for in here specifically please?

gusty estuary
#

hover over elements in debugger

#

they will be highlighted

#

ensure everything is fine here

lapis pendant
#

they appear to be in the right order, meaning that they are in order on the debugger

gusty estuary
#

🤔

#

can you show your specific menu uxml?

lapis pendant
#

you want me to copy paste the uxml or a screenshot?

gusty estuary
#

uxml

#

I want to look how it's structured

lapis pendant
#

i just tried to paste it as text but it wont let me

#

so ill do a screenshot

#

thank you by the way for taking the time to help me

gusty estuary
#

jeez, I hate UI builder, it brings so much garbage into code

lapis pendant
#

i was thinking maybe learning to create uxml without the builder

#

but i figured since its a feature they have it should be fine to use it

#

guess not?

gusty estuary
lapis pendant
#

is the name property being the same on multiple buttons perhaps messing wit hit?

#

im not sure if the name property is similar to the id property in html

gusty estuary
#

neither Rider or VS recognize USS yet fully

lapis pendant
#

i actually have been doing all the .uss stuff by hand

gusty estuary
#

it's all in manual

lapis pendant
#

since i understand css and its similar enough

gusty estuary
#

to be sure

#

or UI Builder also exposes them pretty much fine

lapis pendant
#

still though looking at the above do you see anything obvious causing this specific issue?

gusty estuary
#

well, from what I see - your buttons aren't just in a single list, they are parts of different containers, which messes with the way navigation works

#

also I'm not familiar with how tabIndex value works with it

lapis pendant
#

well the idea was to go for a tab system

gusty estuary
#

it's been fine for me simply without it

lapis pendant
#

so a row of buttons for tabs that controls what tab content shows

gusty estuary
#

but I never used buttons the way you did

#

my buttons always were just in single container

lapis pendant
#

gotcha

#

thanks for taking a look. if nothing else that last comment there may give me some ideas.

#

maybe i can make all buttons in a single container but style them and control them differently how i need

#

is an extra pain in the ass but might be doable.

lone mantle
gusty estuary
#

I literally use CommunityToolkit.Mvvm, so it should be very familiar

lone mantle
gusty estuary
#

currently trying to implement Localized asset table support

#

which is very tricky

lone mantle
#

I'm not aware of that

#

oh you mean localization as in translations

gusty estuary
#

yes

lone mantle
#

I'm here for the data binding part

#

so it doesn't bother me

gusty estuary
# lone mantle so it doesn't bother me

heavy development stage might though.
Be aware, I might push a lot of breaking changes until first stable version.

Hopefully though, all of those will only touch backend.

lone mantle
#

@gusty estuary in the section where code generation for the observable property is introduced, I think it would be useful to see what's actually gonna be generated. I'm gonna guess it's an event and a property, or a property that calls into INotifyPropertyChanged with the property name

gusty estuary
#

it's native IDE feature

#

should be just ctrl + left click on type declaration

lone mantle
#

yeah I'm just reading the doc

fallow anchor
#

I've run into a strange issue that I can't figure out.
I have a crosshair that I instantiate from a VisualTreeAsset, then add to the UIDocument root. Then I grab an element in the asset, set the position to absolute and move it (it's a crosshair). For some reason it's offset exactly one screen height from the top, and I don't understand why

#

From debugging the screen space and panel space values that are set for top and left seem to be correct

rough scarab
#

What's the UI Elements Debugger show?

fallow anchor
rough scarab
fallow anchor
#

Well that would have saved me a lot of time

fallow anchor
#

values are slightly differently since I'm centering the element

#

But it seems to just invert the Y coordinate for some reason

#

That's where the log message is

rough scarab
#

What values are set to bottom and left in the debugger?

fallow anchor
#

The stranges thing is this worked, and then I upgraded to entities .44, and now it broke somehow. I didn't touch anything UI related

#

There's also nothing UI related in my git changes, and this is one commit after it worked

rough scarab
#

I meant the UIElements debugger; I'm presuming they are what you expect and that maybe there's some border, padding, or margin that is messing with your expectations

fallow anchor