#šŸ§°ā”ƒui-toolkit

1 messages Ā· Page 24 of 1

rough scarab
#

the thing I have been asking about, the circular cursor/finger

cold tapir
#

when I record video using mobile that element will appear but not relate to unity or my game

#

is not part of unity it relate to my mobile itself

rough scarab
#

Great, then the issue is probably just that the framerate isn't high enough and you are feeling the delay in comparison to the hardware cursor

cold tapir
#

really so 30 FPS not enough to follow the button very fast ?

rough scarab
#

It's not just framerate, it's also the delay of the entire process from Unity polling the input to the time it's rendered.
Also, doing your positioning in LateUpdate may be introducing a single frame delay, I would do it at the end of Update as afaik UITK does some updating in PreLateUpdate (UpdatePanels; then it calls RepaintPanels in PostLateUpdate)

rough scarab
#

Though due to how you're collecting the position from an event you'll also have to make sure you're setting the position after that

sand phoenix
#

Hey, is there a way to detect if the mouse is over a UI toolkit button (my goal is being able to move the user when clicking on the screen, except when i'm over some UI)

cold tapir
#

All UI Element have Pointer down and Pointer UP event when Pointer down create bool and set to true , and Pointer Up set to false and on another script that handle user movement check that bool before any other action
I solved same issue like that

sand phoenix
#

I'll have a look at that thanks

cold tapir
fickle perch
#

does UITK have support for inline elements in text?

#

like, say, I have a checkbox that I want to sit inside text, that I also want to respect word wrapping behavior

#

basically what <span> does, or, display: inline-block

#

I tried to find something on this, but couldn't, then tried to find a way to hack it in, but good lord uitk does not give you a lot of glyph information

#

I feel like there has to be a way?

rough scarab
#

I would consider allocating that space using a sprite and then trying to pull the text layout info and absolute positioning your element at that position

fickle perch
#

that was gonna be my fallback but it seems ridiculously complicated to even get just that information

#

it's possible to get vertex data, but not glyph data

#

so the closest I can get is to like,, read the vertices and check the UVs to see if they line up with my dummy sprite, which seems violently hacky šŸ’€

rough scarab
#

yeah they don't make it easy, back in the day before rich text support I split colored text into hundreds of elements šŸ˜„

wooden sigil
#

how can i fix those Email and password fields do that both input fields are alined

wooden sigil
graceful carbon
glass musk
#

Hey, I have a problem with my UI buttons. I have a menu system set up that switches between different menus. but when I switch back to the original menu it wont let me click on the buttons anymore. any idea why that would be happening?

wooden sigil
#

thanks

scarlet flame
#

yo, is there any way to detect when a scrollview is moved?
I'm trying to sync a vertical scroll view with a horizontal and vertical view in an editor window

hexed heron
#

Does databinding work with non scriptable objects?

Basically I'd like to bind the UI to an object, however, the fields may be changing (money, hp, etc).
I thought about using an object with these stuff to bind them.

Is it better to just use a script to update or is there a way to just let an object do it?

grave valve
#

In App UI's DI system, is there a way to register instances of a class as a dependency rather than the class itself?

wooden sigil
#

how to curve text in UIdocument

unique pine
#

Is there any place which has some visual compilation of what each library element of the UI Toolkit's UI builder look like in a more concise manner than the official unity website ?

graceful carbon
misty frost
#

do ui shaders have per-element instance data?

obsidian jungle
#

What am I supposed to do about this? Upgrading older UITK project in Unity 6

glossy plaza
#

I wanted to share this here, too, because I'm interested in how useful (or not) having modern MVVM architecture support (with source generators, analyzers and code fixes) would be for Unity UI Toolkit ... my motivation for creating this plugin was to make my NoesisGUI workflow reach parity with .NET Core/WPF, but I figure this could also be used easily by other frameworks ... it is, after all, used by WPF, UWP, Uno, Avalonia, MAUI and all sorts of UI frameworks.

https://github.com/atcarter714/MVVM-Toolkit-Unity

GitHub

The .NET MVVM Community Toolkit supplied as a fully-working Unity plugin ... - atcarter714/MVVM-Toolkit-Unity

glossy plaza
#

I really made the plugin for NoesisGUI, which is based on WPF, and using the same .NET ecosystem libraries and tooling consistently makes things a lot more portable and flexible. I'm just curious if anyone will find a use for it other than Noesis.

#

I believe AppUI is also still a preview package and I've been let down before by Unity abandoning some of these kinds of things ... I guess because it wasn't popular enough.

#

That reminds me ... I need to check in on if they ever did anything else with the editor node graph/grid package stuff.

rough scarab
obsidian jungle
rough scarab
obsidian jungle
obsidian jungle
#

@rough scarab actually I was only counting compile errors of which there were none, but after replacing

public class PlayerDefaultWeapon : VisualElement {
    public new class UxmlFactory : UxmlFactory<PlayerDefaultWeapon, UxmlTraits> { }

with

public class PlayerDefaultWeapon : VisualElement {
    public new class UxmlFactory : UxmlElementAttribute { }

I get the following error in Unity which seems to be a fundamental difference between the factory and element attribute. But I don't know what I'm meant to be replacing exactly

Element 'PlayerDefaultWeapon' is missing a UxmlElementAttribute and has no registered factory method. Please ensure that you have the correct namespace imported. UnityEngine.UIElements.VisualTreeAsset:Instantiate () EditorElement:.ctor () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/VisualElements/EditorElement.cs:24) EditorPlayers:.ctor () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/VisualElements/Editors/Characters/EditorPlayers.cs:17) MenuCharacters:.ctor () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/VisualElements/MenuSecondary/MenuCharacters.cs:12) MenuPrimary:.ctor () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/VisualElements/MenuPrimary.cs:22) EWDatabaseEditor:CreateGUI () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/EditorWindows/EWDatabaseEditor.cs:40) UnityEditor.EditorWindow:GetWindow<EWDatabaseEditor> (bool,string) EWDatabaseEditor:OpenWindow () (at Assets/Custom/Tools/DatabaseV2/Editor/Scripts/EditorWindows/EWDatabaseEditor.cs:28)
#

AH, it is meant to be this?

[UxmlElement]
public partial class PlayerDefaultWeapon : VisualElement {
#

Yeah that's not a straight swap

rough scarab
#

Yes, you were meant to look at the docs for the attribute, which also link to migration guides

#

Not just arbitrarily change the factory's base class

obsidian jungle
#

Fair, I'm a bit behind many of the UIElements changes I think

#

I heard there was a way to bind elements to properties of custom POCO classes now? Where can I find out more about that? I have a full system here where I'd implemented a massive workaround for that not being possible about 5 or 6 years back or something. Used to only work for MonoBehaviours or ScriptableObjects or something

rough scarab
#

?softban 458503201214300170 crypto scam

analog sorrelBOT
#

dynoSuccess killmeforfun was softbanned.

forest bloom
#

on screen radar

lilac mortar
#

somehow when i click on any visual element it counts as selected when checking if (EventSystem.current.currentSelectedGameObject != null)
on buttons i also set selectable to false, yet it also counts as selected.
this creates some annoying behavior when i click on a button and then want to catch keyboard input again, because now my keyboard input is blocked because a gameobject is selected.
is there any way to make button presses not select the object in the eventsystem?

lilac mortar
#

seems like no matter what ui element i click it grabs the input focus onto the ui.

lilac mortar
#

somehow when i press enter or escape in an input field it still remains selected in the "ui navigation", so it still counts as a textfield that is selected.
so i cannot check if the player is currently typing in the ui, because even if they finished typing into a field it still is focused.

#

man this drives me nuts šŸ’€

plush prism
#

should have it on every UI component I believe

lilac mortar
plush prism
#

should be in the inspector for the input field component?

lilac mortar
#

are talking about ui toolkit?

#

what i did now was to handle submit/cancel events and send them to the event system to deselect the ui when they are pressed.

plush prism
#

maybe there is a navigation field/property you can disable via code?

lilac mortar
#

i don't think so šŸ™ there's the focusController but it doesn't help.

hardy cosmos
#

USS Hot-Reload can sometimes be a Hot Mess Express. Spent an hour fighting with some niche complicated state issue when hot-reloading

ornate heron
#

how would i make a container that is designed for specific base dimensions say 1920x720 then stretch horizontally when it gets wider and stretch vertically when it gets narrower?

#

better yet if it could maintain base width instead of height below a certain treshold for example 4/3

merry dirge
#

Hello, I am new to Unity and I would like to achieve this one simple thing: I have created a menu with UI builder, this was very simple - I have three images and I would like to initiate animation from sprites for each image on hover. Is there any way how to easily run the sprite animation on hover?

merry dirge
#

Thank you, I will try that too. Also would like to ask about the approach how to do the menu in the best way, lets consider that I want to have MainMenu and Settings screens. I think it is better to have only ONE UIDocument that has two elements: MainMenu and Settings. Is this a better way to keep all parts of main menu together?

graceful carbon
merry dirge
zenith glade
#

hey all, has anyone ever seen bugs with ui toolkit when using a material on a visualelement? things like flickering, degenerate triangles, etc.?

#

i just recently implemented a tick shader that looks like this, but now i'm getting situations where this happens. it's happening reliably on multiple machines

#

happens for a single frame and then disappears, this is just one of the artifacts, there are many

zenith glade
#

really having trouble figuring out root cause of this. if anyone has any ideas, pls lmk. a bit at a loss here

lean horizon
zenith glade
#

i've removed all UGUI from my project and i've gone full UI toolkit with shadergraph. however now i'm getting these artifacts and it's driving me nuts

#

the biggest isuse is that i can't friggin catch them and pause the app so that i can take a proper frame snapshot through the frame debugger. if there was a way i could stop the app when i get these artifacts, it would be great but i don't actually know what's causing this, just have hunches about what it could be

lean horizon
zenith glade
#

actually on my 4090 i have render scale set to 100% so it's unlikely to be the root cause

#

is there a paid service for unity where you can get official support?

lean horizon
zenith glade
#

$450/yr for individual creators. might be worth it.

#

for now i'm choosing to ignore it since i was able to find some parts of the UI where i was doing NaN operations

#

ah crap i need a unity pro license. it's $2.3k/yr...

rough scarab
rough scarab
#

well, that fix is in 6000.3.5f1, so it may help at least

zenith glade
#

!!!!!!!

whole zincBOT
zenith glade
#

oh my god

#

i've spent so many hours on this

zenith glade
#

hmmm i looked at the bug and it's actually a worldspace UI. i'm using a screen space UI toolkit with world space calculations. so not exactly the same thing

zenith glade
#

sigh... unfrotuantely, it did not fix it.

lean horizon
#

thanks for heads up i was bashing my head on the wall last night

cerulean nova
#

Also, is the big ass triangle in the second image supposed to be there?

I’m assuming the big triangle with the alpha blending in the first image is supposed to be there? Is that one working as intended?

cerulean nova
#

I had a graphical bug once which took me a while, it was a non-Unity webgl app where only one of my devices would get an entirely black screen. If I remember right it was whenever the browser used d3d. The issue was due to a fragment shader outputting invalid colour values which caused d3d to just black out the screen (probably because it was rendering a full screen texture). The problem went away by forcing the browser to use OpenGL and it was fixed completely by clamping the values in the fragment shader to 0-1 or whatever. Thing is on OpenGL and on other devices like Mac and iOS browser there was no visible issue at all so it took a while to nail down ..

I thought it was an interesting issue but maybe it’s just because I hadn’t ran into it before

zenith glade
#

metal and directx share the same bug, which makes me think it's a code problem but i'm unsure what i tis

#

i stopped looking into this and took a break from game dev, getting back to it now

#

if only i could catch the frame, but it's been almost impossible. i can make the problem happen almost immediately when it's running at full speed but i've spent hours trying to get it to happen on a frame by frame basis and it doesn't happen

zenith glade
#

i believe i may have found the root cause because it's no longer happening. i was feeding bad positions to a health chunk feature that i was creating at runtime (when enemies take damage), specifically NaN, so that could have been why

zenith glade
#

goddamn it... i saw the artifact for a split second 😢

cerulean nova
cerulean nova
#

Also you could try purposefully putting NaNs into it to see if you can cause the problem to happen intentionally

zenith glade
#

i had to go through every single dynamically generated visual element and make sure i wasn't passing NaN, it was an absolute pain but i think i've got them all

#

and yes, i had a couple divide by zeros in my tick shader that i addressed last week but that was also a reason why i was getting artifacts

cerulean nova
dark vault
#

How do you change the color of the underline of the selected tab?

zenith glade
rough scarab
dark vault
rough scarab
#

that's not the selector you can see it uses in the debugger

dark vault
bronze iron
#

Can UIToolkit shaders sample the framebuffer? Can we finally have blurry backgrounds?

zenith glade
#

in general i'm finding that using materials with UI Toolkit really f'ing sucks

#

i had to disable my tick material because it was causing huge amounts of artifacts

zenith glade
#

i could potentially split off the nameplates into its own UI document but ui toolkit is really screwing me here with the material implementation

#

i'm just gonna have to drop to uGUI for the nameplates

lost cairn
#

i am learning unity and now i want to learn UI but there i have two options Unity IU or UI toolkit which one i go with ??

graceful carbon
lost cairn
cerulean nova
# zenith glade just a heads up that disabling the custom material i was using for resource bar ...

You need to figure out what makes them drop to zero, anything else has high chance of being placebo since you don’t have a good way to measure it

At some point in your project you will have added something that started causing it - try going back to that point (either with version control or just disable objects/scripts you added)

Once you’ve found out what you can remove to get the thing to stop entirely, you know that the issue must reside within the stuff you removed. Then you can keep adding things back in one by one and narrow down where the root cause of the issue is. If you figure out that the issue is some kind of ā€œin some situations this thing might be NaN but rarelyā€ try modifying it to always produce NaN and see if that reliably causes the same issue. Eventually you’ll figure out specifically what is causing it and then you can figure out what to do to fix it, which at that point will probably be simple

#

Also, sometimes you may think ā€œit wasn’t happening at the point in time when I did this partā€ when actually the issue was present by that time (you just happened to get lucky and the problem didn’t occur at the time), so you spend forever trying to figure it out because you’re working with an invalid assumption of which parts could possibly be the problem

#

I’ve had bugs before where the actual bug was some foundational underlying issue, but then features added later exacerbated it and misled me into thinking the problem was definitely within those new features - removing them makes everything seem better but doesn’t address the thing causing it.

Imagine something like causing a 1ms sleep in every object which does an Update, and you don’t notice because you have like 3 objects, but then later when you add a feature with 20 objects and your project grinds to a halt - you would have a hard time figuring out what’s wrong if you assume everything was fine before those 20 objects

#

Not sure if that’s helpful here but I’ve learned that 99% of the confusing bugs I find are caused by me assuming something else is working when it isn’t, so it’s the first thing I think of when I find some weird problem that doesn’t make sense

tough bear
#

Experienced with IMGUI and Canvas stuff and want to get comfortable with UI Toolkit; Just curious, is it productive/not psycho at all to want to avoid all the css esque programming and ui building tools and just handle everything through my own c# utils and data solutions?

#

The big appeal for me going to ui toolkit is just avoiding being tied to the canvas and gameobject/component based solution, the actual web based workflow that’s usually a benefit isn’t interesting to me currently

graceful carbon
tough bear
#

Rough but liveable

#

Tyty

fervent cloak
#

Hey, I'm trying to apply a custom font to a panel using a Panel Text Settings, but the font isn't applying. Am I doing something wrong anywhere? I don't quite understand, I expected the entire panel fonts to be changed to mine, but isn't

#

Is it because of the Path? Where the font asset is at is in "Assets/UI Toolkit/Resources/Fonts & Materials/Zen_Kaku_Gothic_New"

#

Is that Resources path correct? Or is it because its nested inside its own font folder instead of being right under Fonts & Materials?

#

According to the documentation:

You can edit the paths to store the font assets, sprite
assets, custom style sheets, and the color gradient presets. The paths must be a sub-folder of a Resources folder. Create a Resources folder if you don’t have one in your project.
Default Font Asset

After you create a font asset from a font file, you must place it in the path set to store all the font assets.
Property Description
Default Font Asset Default font to use when you create a new text object.
Path Path to store all the font assets.

#

Here, I just edited the ui real quick to show whats the font supposed to be, by directly assigning it to a label element

fervent cloak
#

Does this not work because the default USS overrides it?

#

I removed the import of the default USS and now instead of using the actual font its using the font asset...

#

However, you can’t change the default UITK Text Settings for Editor UI in the current release.
... I guess this is what's wrong

proper patrol
#

how do you set up ui buttons from ui toolkit to do actions?
like teleporting a player to scenes etc

crimson juniper
#

Why scroll view doesn't shrink to fit the screen?

shadow current
#

I've always avoided UIs but is it normal that I can see the entire canvas in the game tab even when the game isn't started?

graceful carbon
shadow current
graceful carbon
shadow current
#

so it's normal, thanks for clarifying

stiff talon
#

Is there a convention on how to make a pointer visual with UIElements instead of using the Cursor object?

stiff talon
graceful carbon
stiff talon
hazy vortex
#

running into this really weird issue where a particular period is causing my label to think it has another line

  1. with . there's a phantom newline
  2. without . there is no phantom newline
  3. with .. it creates a newline and also has correct bounding box. this is in 6.3
#

anyone know whether there is a fix for this?

unreal rivet
#

is there something equivalent to eventsystem's PhysicsRaycaster/2D in ui toolkit? i googled a bit but didn't find anything and made some dirty hack that sort of works for one event, but is duplicating this over number of events i need the "happy path" to do interaction with colliders in ui toolkit?

graceful carbon
unreal rivet
# graceful carbon There is a [Panel Raycaster](https://docs.unity3d.com/Packages/com.unity.ugui@2....

unless i misunderstood what it does- panel raycaster goes into the opposite direction - when the EventSystem wants to raycast into the ui toolkit panels, the functionality of PhysicsRaycaster was that a camera that you put the component on was now handling raycasting input events into 2d/3d colliders - you could put a collider+monobehavior that implements IPointerDownHandler and mouse clicks that didn't land on ui components would execute a callback on that interface, similar to what the snippet above does, so that you can for example click a cube and in the callback open a context menu

#

or is the idea that you run eventsystem together with the ui toolkit? šŸ¤”

graceful carbon
#

Are you trying to click through a UI visual element to a gameobject? or to click on like a worldspace UI

unreal rivet
#

click on worldspace objects, like click a cube with collider(trigger) -> the cube gets an event callback, in event system flow it was as simple as a physicsraycaster on the camera that does the raycast and a script on the cube collider gameobject, with ui toolkit i'm a bit confused as the docs are pretty slim, i tried cajoling ais to find a solution but they all suggest manual raycasting like in the snippet is the way to go (also they hallucinate non existent apis pretty badly in this part of unity)

#

although i should mention the issue isn't the manual raycasting, just the convenience of it - eventsystem handled filtering the event through the UIs first, so a click event on the object would be blocked by UI as a user would normally expect

graceful carbon
unreal rivet
#

no, in the other direciton, have the ui toolkit handle clicks, filter the event through it's event handlers, and trigger callback on the front most gameobject provided it has a trigger on it, the same as eventsystem does it, but i'm sorta convinced there's just no api to do it in ui toolkit

graceful carbon
unreal rivet
#

yea the manual part of it isn't the problem - the snippet above does it for 1 event, but i'd have to duplicate it a few times to handle the other events, which is super weird

rapid spade
#

guys im creating a online figma stylie unity ui toolkit editor, you can exports your design

tough bear
#

Not sure if this is a silly question but trying to learn UI Toolkit and wanted to setup a MultiColumnListView. The example in the docs uses Binding in order to populate stuff but right now my data is stored in a struct, Is there a way for me to set this up with just c# and the struct or do i need to involve a scriptableobject or something in order to create a serializedobject

#

the ListView doc example has you setup funcs and actions to do this kinda thing which would be more than fine for me

#

I think the 2022.3 version of the page is giving me what im looking for

#

amazing documentation

tough bear
#

With some extensions I've ended up with this which i think is pretty clean

        Vis_Project.AddSheet(proj.Songs).Add<ScriptableSong>
        (
            ((180, "Track Title"), (e, i) => e.AddLabel(i.PrimaryName)),
            ((50, "Object"), (e, i) => e.AddObject(i))
        );
#
public static void Add<T>(this MultiColumnListView input, params((int, string), Action<VisualElement, T>)[] values)
#

nested tuples a little cursed tho

tough bear
#

What's the equivalent of EditorGUI.indentLevel for UIToolkit stuff?

#

It's a Foldout šŸ˜„

zenith glade
#

has Unity announced any plans to bring UI Shader Graph to HDRP?

tough bear
#

i saw this example in the ui toolkit intro page, how would i actually make a dynamic pie chart?

worn vector
#

Hi,
Do you suggest to use SVG or PNG in UI Toolkit for creating in-game UI/UX ?

#

Also what do you suggest about the resolution ? For example if the reference resolution is 1080x1920, I should export them all in high resolution like 512x512 and after adding them to the canvas, reside them to the actual size on UI for better performance and overall size ?

sleek dirge
# worn vector Also what do you suggest about the resolution ? For example if the reference res...

If you have simple shapes svgs can be very beneficial because they size dynamically and do not care about resolution.
As for exports you have to take multiple things into consideration:

  • Which resolution can you optimize for? Many people now have QHD monitors (2560x1440), while 4k is niche and could increase file size for a tiny userbase
  • How big will your image realistically be displayed? A full screen intro logo needs a bigger export than that small checkmark you display on a button somewhere (SVGs dont care about size that much though because you can just scale them up without quality loss)
urban schooner
#

Is there a way to bind the height of this visual element to the width of the entire document, such that the visual element can be a square that resizes with the width of the document, but not the height?

worn vector
#

Hi,
Is there any way to access properties of custom UXML (template) after drag and drop it into the UI Builder ? (And don't break it by unpacking)
Or it is not a good approach at all ?

tranquil tangle
#

Im reviewing a PR for one of my developers about the UI toolkit, and something hes doing doesnt seem quite right to me. We need an animated icon that rotates to show that something is loading. Can someone confirm for me that apply a StyleRotate via the scheduler to the raw style is the best way to accomplish this? It seems a bit weird to me

rough scarab
tranquil tangle
#

So thats a fine way to do it? I was concerned that it should use the transition system or something else, as it seems odd to me to have the scheduler manually adjust the rotation of a visual element every frame

rough scarab
#

there's no continuous transition, so you'd have to constantly add and remove a class to achieve the same thing

tranquil tangle
#

Ah, gotcha. Then it makes sense

#

We hired a proper web dev to help us out with the UI toolkit stuff. Me and the other senior dev build some really nice infrastructure for him to work with, but some of the stuff he does seems insane to me

#

The product has never looked better though

graceful carbon
worn vector
graceful carbon
worn vector
graceful carbon
worn vector
fiery horizon
#

Hey guys! Really dumb question here but I'm a beginner with the UI toolkit: how do I make it so two elements overlap rather than share space?

I want the little 'front' semicircle to go on top of the speed-dial, both of them are on the speedometer-back, but I can't figure out how to get them to overlap

tough bear
#

Just wanted a vibe check on common practice, if I have this red rect and want the content to consume eg. half the space of it as it's doing, it's fine to achieve this by giving it a empty element as a sibling and messing with growth and basis right?

#

just not sure if it's common to use empties for padding or if ideally i'm meant to just play around with the settings in the red element or just the content element inside of it

solid notch
#

So I am noticing that on mobile all elements that are in a scroll view flicker when the scroll is moving via inertia. Anyone encountered this ?

wooden sigil
#

in worlview pannel seetings i can't click any buttons and cannot intract not even cs RegisterCallback<ClickEvent> works

fervent cloak
#

I'm looking around, for colors in UI Toolkit, is there only RGB? No other color spaces like OkLab. No way to define gradients either

fervent cloak
#

Well I was talking more about defining the colors and then using the colors mainly in text

fervent cloak
#

Oh I see, I forgot I checked this page 2 weeks ago. Thanks

worn vector
#

Hi,
Is there anyway to achieve outward aligned outline instead of UI Toolkit center-aligned outline for texts ?

worn vector
#

Hi,
Is there any way to get Canvas Size (Screen size) of root UXML inside custom control ?

worn vector
#

Hi,
I want to know if there is a way to set text of Label element inside template in UI Builder ? Or I have to write a script to do that ?

Another question,
Is there any way to drag and drop a template inside another template by UI Builder ?

Next question,
Is there any way to change selector order (precedence) ? Or choose specific selector for specific field ?

I would appreciate it if anyone could help me with them.

rough scarab
# worn vector btw, I could get it in this way, though I don't know if there is a better way. `...
/// <summary>
/// Gets the root of the current hierarchy.
/// </summary>
public static VisualElement GetRoot(this VisualElement element)
{
  if (element.panel != null)
    return element.panel.visualTree;
  VisualElement topMostRootContainer;
  for (topMostRootContainer = element; topMostRootContainer.parent != null; topMostRootContainer = topMostRootContainer.parent) {
  }
  return topMostRootContainer;
}
#

(the point is the fast-path through panel)

tough bear
#

jumpscared by untraditional for loop

worn vector
rough scarab
#

Ah, I don't use UI Builder, sorry

worn vector
rough scarab
worn vector
rough scarab
#

can you screenshot the element and its styles in the UI Toolkit Debugger

rough scarab
#

Yes, and expand Matching Selectors

worn vector
#

I want to use .button-label for padding instead of .unity-label

rough scarab
#

You've already got another stylesheet using the same precedence

#

perhaps you want to increase it by doing something like .unity-label.button-label {

worn vector
rough scarab
#

different how? In precedence?

worn vector
worn vector
rough scarab
#

Also note that some of your styles are inlined into the element

worn vector
rough scarab
worn vector
#

Hmm, it was typo

#

Sorry about that

rough scarab
#

There shouldn't be a space between the selectors

worn vector
#

But still with correct name, it doesn't work.
Still the same without the space

rough scarab
#

it should also be unity-label, still has a typo

worn vector
#

It works now. I was surprised why it doesn't work though as you can see I use the same approach above it.

worn vector
worn vector
rough scarab
#

Can you show it in the UITookit debugger, as that shows the precedence, and I have no idea what the builder does

rough scarab
#

You can see that it's at the bottom of the list, and has therefore is applied after the others

#

and it also has no mention of padding

worn vector
fickle perch
#

is there a way to find the associated VisualElement in a treeview given an item ID?

#

...oh wait it it the [] accessor on the TreeView itself?

#

(looks like no)

fickle perch
#

it seems weirdly difficult to navigate treeviews

#

I can't find a nice way to go from id to index

#

all the traversal functions seem to take in index rather than id

#

and the only conversion/traversal thing seems to be to get the root visualelement from an ID, but, visualelements are transient and can be null while off-screen right?

#

right now I'm looking for a GetParentIdOfId(int id) function but uuuuh idk how to even make one, beyond maintaining my own structure or doing a brute force search

#

is there something I'm missing?

willow dove
#

Working with ui tool kit, it looks/feels very much like early stages of javascript/html/css - and i saw there's a react-unity library for it, how well does it work ? does the added JS engine slows the game much ? is it noticeable ?

true cloak
#

anyone mix UITK with uGUI? im familiar with CSS, but a Unity beginner so im thinking of using .uss as the source of truth and having a mechanism/script that converts .uss files into scriptable objects for uGUI components. This is for layout/theming/typography stuff

zinc orbit
#

Me still struggling while UI Toolkit is not working with the Quest3 oof

shadow quartz
fickle perch
#

I'm using unity 6, but I could upgrade for this project

shadow quartz
fickle perch
#

ooooh okay so I go through the controller

#

didn't know that, thanks!

shadow quartz
#
treeview.viewController.GetParentId()
shadow quartz
# fickle perch ooooh okay so I go through the controller

No problem. The view controller holds a lot of the core functionality for certain views.
Mainly finding methods for ids, the index of the items in the collection and so forth. So most of the time if you are needing information about a collection in a visual element built into Unity the view controller has a lot of methods to help out with that.

  1. TreeViews
  2. ListViews.
  3. The new heiarchy in 6.3 has a newer set of functionality for them.

Edit meant to reply to the thanks part for the no problem comment.

fickle perch
#

gotcha!

proper hedge
#

I feel like I'm getting the hang of how UXML works. It's quite different to the old GUI, but the more I figure out, the more I start to like it.

#

I wouldn't have been able to put anything nearly as sleek into the inspector prior to this, nevermind the additional functionality.

tough bear
#

In c#, is there a way to style a basefield to how Unity displays it in inspector by default?

#

eg. this is a default object field vs. a propertyfield bound to a gameobject prefab

#

i want how the second one looks

#

(i don't want to use the propertyfield here because other ones have header and space attributes that i don't want to use)

shadow quartz
rough scarab
shadow quartz
valid prawn
#

Hello everyone

#

Does anyone know how to achieve the blur effect in ui toolkit

odd tapir
#

why is ui toolkit recommended for editor and custom editor windows

#

what would be the most important points to mention and what are the main advantages

tough bear
#

i know i can manually make correct fields per type but

graceful carbon
valid prawn
#

God bless you

granite zephyr
#

I can't create a panel text settings, the fonts don't appear in "Font Asset" field

#

I tried AIs / tutorials / Generating a font atlas using text mesh pro menu

#

any ideas ?

#

it's to fix a really nasty ui toolkit bug that sometimes my users don't have a font for the entire session because I change it using uss and apparently it can fail and there is no fallback

granite zephyr
#

seems like a bug to me, if you load a bad font it should default to a default font

  • {
    -unity-font-definition: url("project://database/Assets/TextMesh%20Pro/Examples%20&%20Extras/Fonts/BangersXXXXX.ttf");
    color: white;
    }
tranquil tangle
#

So I have a custom visual element Im working with that has a pool of children. When I return a child to the pool, it can rarely be reused in the same frame. Right now, I have an issue where the pseudo states (Hovered, Active, Selected, ect) are not being reset when the object is returned to the pool. When I scroll through said collection, I can end up with 5 or more elements in the hovered pseudo state. I probably forgot something simple to fix this, but I cant track down what it actually is

tranquil tangle
#

Perhaps removing it from the hiearchy and then readding it?

#

Can confirm that removing the item from the hierarchy when pooled fixes this problem.

granite zephyr
#

Doesn't feel like this channel has a lot of help ^^*

proper hedge
ornate oriole
#

VisualElement: need OnDestroy / single-fire cleanup callback

Hi i wonder if I'm only one person who finds lack of OnDestroy on Visual elements so annoying ? Whenever i write my Custom VisualElement and want this element to subscribe / unsubscribe from external events it is real nightmare. Only way to do it I'm aware of is AttachToPanelEvent DetachFromPanelEvent that are triggered multiple times (it is triggered many times while initlisation). Is there better way to do it ?

Example of code

public partial class ResearchTile : VisualElement
{
    public ResearchDefinitionSO Research { get; private set; }

    public void Initialize(ResearchDefinitionSO research)
    {
        Research = research;
        RegisterCallback<DetachFromPanelEvent>(OnDetach);
        RegisterCallback<AttachToPanelEvent>(OnAttach);
    }
    
    private void OnAttach(AttachToPanelEvent evt)
    {
        if (Research != null)
        {
            Research.OnUnlocked += UpdateVisual;
            Research.OnBecomeResearchable += UpdateVisual;
        }
    }
    
    private void OnDetach(DetachFromPanelEvent evt)
    {
        if (Research != null)
        {
            Research.OnUnlocked -= UpdateVisual;
            Research.OnBecomeResearchable -= UpdateVisual;
        }
    }
}```
novel trellis
novel trellis
hard pewter
#

I want to have a window/panel like visual element that grows in both axis according to its content/children, it has direction column. Then I want one label in that panel to contribute only to its parent height and not expand in width beyond its parent, but I cant make this label to wrap the text and it always grows horizontaly contributing to panels width. How should I set it up to work like that?

hazy vortex
#

what's the current status quo on getting bloom / glow to work with ui toolkit?

dark vault
frosty torrent
#

hi guys anyway to blur the background when a ui menu is open?

#

i know there's a builtin blur filter in 6.3, but right now it's either blurring my UI and not just background or if I move it in the hierarchy, it doesnt blur at all

woven hinge
#

all these variables show up as editor only (including my own variables); is linking to variables editor-only and I can't do this? or is there something I missed?
(unity 6000.3)

woven hinge
spare trellis
#

apparently, FilterFunction.AddParameter only support up to 4 parameters. I have a perlin noise shader that takes in 11 parameters, it's applied to a filterfunction that's attached with a material in the UI template's custom filter, is this the wrong way to supply values from the UI builder into the shader?

#

this filterfunction asset is used for debugging purposes, but eventually I'll still be sending values using filterFunction.AddParameter(new FilterParameter(myValue)), so it'll be met with the same error

#

I cannot for the life of me find any existing discussion online about FilterFunctions taking more than 4 parameters, I can't be the first person that tried to add more than 4 parameters to this right

glad drum
#

So how would I go about rendering Menu2 behind Menu1 without reversing the hierarchy?

hazy vortex
#

having a really weird issue where on macos, my ui document straight up doesnt render (tried and tested on windows, though). weird quirk: if i go to scene view, it then renders on my game view.

thereafter if i maximize my game view, the ui disappears again. anyone got any cleu?

narrow burrow
glad drum
narrow burrow
glad drum
narrow burrow
#

you need to use do it on the file and then just put those in a hierarchy if you need to, or you can adjust the Z-index if they're all in the same group

glad drum
narrow burrow
#

the uidocument

glad drum
narrow burrow
#

public void PlaceBehind(UIElements.VisualElement sibling); public void PlaceInFront(UIElements.VisualElement sibling); public void SendToBack();

glad drum
narrow burrow
#

lol, yeah, I'm looking at 700 ui elements right now like....nahhhhh

glad drum
narrow burrow
#

I'm making an entire periodic table

woven hinge
#

With a custom UI shader graph, is it possible to get screen space UVs instead of "element space"? The object and world transforms seem to be identical, and I can't find any relevant UI node in shader graph.

runic herald
#

where can I find good 3d models of space ships? Is for a space ship sci fi game

rough scarab
woven hinge
fervent cloak
#

Forgive me but I can't really find any code example on UI Shaders, only got this https://www.youtube.com/watch?v=xAOBBW9hsjA and the docs, which does not have a shader example in https://docs.unity3d.com/Manual/UIE-examples.html
Because I haven't used UI toolkit much before, and I have straight up never used the Shader Graph before, how would I go around making an occlusion effect where a UI World element gets darkened by the World, but its still visible? Using Scene Depth and Scene Depth Difference nodes? Also stencil?

With Unity 6.3 LTS, you can now use custom shaders in UI Toolkit. Watch this video to learn about how to create dynamic, interactive UI effects using Shader Graph. You’ll get the steps for building a reactive, glowing button from scratch and learn how to drive shader parameters with C# for high-performance, responsive interfaces.

What’s Cov...

ā–¶ Play video
#

I just cannot find anything regarding ZTests, Depth, Stencil, Multi pass rendering or occlusion effects

hushed cradle
#

does anyone know how I would add a draggable separator to dynamically space these two visualelements in ui toolkit? (between pined and recently accessed)

merry kettle
#

Hello there. Let's say I have 10 ui Toolkit elements, using a custom shader. Now I wanna change a property of one of them. How do I achieve that with creating a new material for each visual element? Like Materialblocks?

rough scarab
hushed cradle
# rough scarab Use a TwoPaneSplitView

Is it correct to say that the ui builder for ui toolkit doesn't include every piece of ui available(since I did not in fact see TwoPaneSplitView in it when I first built this)

rough scarab
#

No idea, I don't use the builder

kindred mountain
#

Is there any way for me to know if the property actually changed?

var prop = new PropertyField(nodeProperty);
prop.RegisterValueChangeCallback(OnPropertyModified);

or disable any events that call this valueChangeCallback when it actually hasn't changed?

For example, it calls the callback on bind, which doesn't make sense since the property didn't change.
I know of TrackPropertyValue, but sadly the regular intervals where it checks it changes? sometimes its really often, sometimes its not

#

Actually, nevermind! I see what the issue I was having before with the regular intervals changing. When I use TrackPropertyValue, there's two ways it can get called from:

The way it's really frequent, done by

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

And the not so frequent:

UnityEditor.RetainedMode:UpdateSchedulers ()

It changes doing the same action, can trigger the track property event from those two diferent points. Usually it changes when I do Ctrl+Z.

I want always to use the GUIutility processevent since it's faster. Is there any way to force that?

spare trellis
kindred mountain
spare trellis
kindred mountain
kindred mountain
#

If it was always called often

kindred mountain
#

Managed to fix it, it seems calling Bind() inside a schedule.Execute triggers something weird, making the binding not work properly

deft mist
#

Hi is there anyway tutorial for the use of SCROLL RECT, or SCROLL VIEW for a lobby list in a lobby system?

graceful carbon
deft mist
#

So would it be hard coded then?
That would be easier

graceful carbon
deft mist
#

Yes that what my plan is but because I’m implementing the lobby UI as a pop up from a main menu I had to use UITK legacy UI would be easier.

rose violet
#

I want to center the "Ayarlar" text in the Top visual element while keeping the button aligned to the left. Roughly speaking, I made the "Ayarlar" text absolute, gave it 30% spacing from both the left and right, and centered the text within itself. However, I’m wondering if there is a more professional way to achieve this, or if this method is sufficient.

Also, should we make our template responsive to all screen sizes from this screen, or is it enough to adjust it from the Panel Settings section? Does the layout here not matter that much?

ornate cliff
#

Not a place to advertize

willow dove
#

Sorry found the section forgot to remove here

rugged steeple
#

I'll be honest that i cannot understand how the UI Toolkit world space UI Input works. I have the required raycasters on the camera, the event system component, and the raycaster/event handler component on my UIDoc.

Even with these things, I have no clue how the event handler sends event data. It doesnt seem to do it with event callbacks that you would register with on an visual element. It also doesnt seem to provide any public ways of registering/ recieving events.

I looked at the Script for event handler; and all it does is call sendEvent(eventtype, pointerdata) (with no accessable base class). i have no way to see where these events go, as registering the event callbacks on a UI element on the worldspace UI have no effect.

#

I can create my own raycaster and event handler, and publish events for my ui manager script to use the events that are on screen, but that wont work for more advanced usecases, without creating a robust api that completely bypasses the event system (and not use the ui events you would normally use for UI Toolkit).

Could I please get some help on how your supposed to be able to get/respond to the events created/published by the panel raycaster and paneleventhandler object?

rugged steeple
#

yes, ive set that up completely. what is supposed to happen with those components? when it sends a event, is it to the ui's event system? i just have no clue about the intended target, so i cant debug

#

i can bypass the components to create my own input processor, but how should i recieve the input/events from those components?

graceful carbon
#

You'll need to switch to the Input System UI Input Module if you. Haven't already

rugged steeple
rugged steeple
#

Alright, figured out the problem, abiet i have no clue how to fix the solution. if you disable the automatic input configuration when you have autoredirect on for the event system, you need to configure / add panel raycaster/panel event handler yourself. Thats completely fine.

However, unity doesnt ever explain how you are supposed to do it. based on the code, all i can do is just set the IPanel of the raycaster and event handler. Neither uIDocument.runtimepanel or uidocument.rootvisualelement.panel seem to initialize the components. both options set the panel asset to non-null and registers callbacks for the dispose event, but nothing else. these panels seem to recieve input, but they always get event data created by a physics raycaster, rather then a worlddocumentRaycaster (unless i disable the physics raycaster, then they dont recieve input at all)

Do i need to have the panel components under the event system when i create them? i cant seem to find any data about "How" to manually assign the components. (i want to manually assign some, because only a few worldspace ui actually wants to get events, and for the other ones, i dont want them to interact with the event system at all.)

rugged steeple
#

(noted, spawning the gameobjects under the eventsystem on awake doesnt work, seems like i have to register it with the InputSystemUIModule somehow)

blazing lagoon
#

hey guys, im having this issue where i have a rescalable health bar but the health fill portion of it wont resize properly, the way i made it, they both change width the same way so im not sure what the issue is, I have them both as 'sliceable' sprites and they should have the exact same slice points (they also have the same dimensions and import settings

rugged steeple
# rugged steeple (noted, spawning the gameobjects under the eventsystem on awake doesnt work, see...

whatever is wrong, it just seems like i cannot win. i cannot edit the eventsystem class to debug why the worldDocumentRaycaster never gets priority over the physicsraycaster (even though it does give a correct raycast result when debugging its methods). the panel Raycaster never ever gets called, even with valid runtime panel assigned. the panel event system gets called, but its always passed a physicsraycast object (no doc), so it fails. Theres no documentation on how to register a panel raycaster/event handler, or how to add it to the RaycastManager class. Theres also no scripting code that you can read on how the InputSystemUIModule autoconfigs the worldspaceUI.
Second update, allowing the autoconfig of the panels ONLY allows input to the screen space panels, the other panels never get any input, and if you disable all the screen space ui, no ui gets raycasted against. I really dont know how they want us to do worldspace.

blazing lagoon
blazing lagoon
neat nebula
#

Just shared a futuristic concept in #ui-ux, what do you guys think of using this style for mobile interfaces in Unity

fallen relic
#

Hello im making a billiards game and i would like to create a simple display of which balls are left to pot on the top. I have ball texture jpgs and i would like to make it so there are circles each with its own texture on the top how would i do that. Here is the image of my setup

#

THing is i want it to only take the center parto of the jpeg piicture and i want it to not be stretched like it is now

fallen relic
#

thank you

hushed cradle
#

Does anyone know how to bind sorting methods on click to headers of MultiColumnListView, version 2022.3, I couldn't find it on the unity documentation. I've tried the headerbinding and registering a click event to the header visualElement but found no success

vague sandal
#

Hello guys

#

Anyone knows why I'm having this difference

#

from game screen and preview screen?

#

game is all blur

#

seems SDF not working at all

vague sandal
#

When I zoom in the UI builder it's all crispy but when I zoom in game mode it's crappy

rough scarab
vague sandal
rough scarab
#

It scales to any resolution now, just increase the game view resolution

#

instead of the zoom

vague sandal
vague sandal
rough scarab
#

UITK does

vague sandal
# rough scarab UITK does

Well, not using the game mode zoom, I understand that it should work on the resolution however TextMeshPro also works with any resolution and zoom

rough scarab
#

UIToolkit and Text Mesh Pro both use the same Text Core backend, if your text has problems at high resoutions when using either then the font asset hasn't been properly set up

vague sandal
bronze iron
#

Does worldspace UI Toolkit support backface culling?

vague sandal
#

Whats the recommended way to add ui having multiple game objects with UIDocument or a single one and handle it adding the templates into a single UXML?

lunar rain
# bronze iron Does worldspace UI Toolkit support backface culling?

I cannot seem to find it anywhere at least. Custom UI shader graph shaders don't have a culling option either and also manual culling with Is Front Face is not possible with UI shaders. If I slap the default Unlit shader to a UI element, it does seem to cull though it obviously doesn't render the UI element properly. It still makes me think it might be possible with custom HLSL shader but the UI shader graph doesn't seem to be an option. I can try if the generated code from shader graph with the culling modified would work. Don't know why culling isn't supported so far so (the shader graph seems to be more so useful for overlay UI so that might be why) even if it worked, I don't know if that is solution that will work on different platform builds and stuff

#

@bronze iron Using the generated code from a UI shader graph and just turning on culling on the shader code seems to work in the editor at least so that might be pretty much the only way. Of course one option would also be to do a C# script culling where you disable the UI elements that are facing away from the camera

lunar rain
#

If by blurriness you mean pixelated, I don't honestly believe TMP could make any difference, no method of rendering a font can introduce pixels where there aren't any

slow crest
#

so what is the actual proper way to hand off a data source chain to a custom visual element?

e.g. i have this struct "RangedSpawnParameter". it has an enum "mode", a min and max float value. but when i set the data source path to my custom element to point to this property on the parent it doesn't seem to pass it down automatically to the custom element. what does it take to accomplish this? (i am not using the serialized object/binding system, i'm using the data source approach). i can't seem to find a good resource on how to do this the cleanest and easiest way. anyone know?

img #1: this is the custom element, and the data source path points to the expected property on the parent data source
img #2: The scriptable object that is the data source of the parent editor ("rate" is what we're focusing on)
img #3: the custom element (UxmlBoundElement is my own abstract that just handles all the binding to the UXML doc).

i need to figure out how to have the data source pipeline give me a way to access the parameter internally. i've been beating my head against walls trying to find a solid resource on this specifically.

vague sandal
#

Anyone know how to tint a svg when hovering it using uss ?

#

Tried this:


.icon-image:hover {
    -unity-background-image-tint-color: rgb(255, 0, 0);
}

Doesnt work

hushed cradle
#

Does anyone else's style sheets not enforce some properties correctly sometimes (i.e. button radius and border widths among other things, sometimes even width percentages) and only works when you set styles inline? They reflect on the actual components when you add the style, but when I go to actually display the UI it does not display

vague sandal
#

I can't even edit hover background color from ui toolkit, this is so

#

Isnt it supposed to work?

rough scarab
rough scarab
vague sandal
rough scarab
vague sandal
#

I can see there is hover and focus

rough scarab
#

expand the Matching Selectors

vague sandal
#

where?

rough scarab
vague sandal
#

Oh

#

thanks

vague sandal
# rough scarab

Why do we have the Image component if we can use a VisualElement and in the Background set an image to it?
I couldn't change the tint-color for the image when hovering but I can for the VisualElement so I had to use it

rough scarab
#

I don't know, I don't use the Image component

vague sandal
rough scarab
#

Yes

vague sandal
#

Ok, so I'm on the right path, thanks

brittle furnace
#

Hi all, I am working with UI Toolkit data bindings for the first time. Why is it that the ListView displays 'List is empty' when I manually reload the contents of the Scriptable Object list?

Calls for opening and closing the pop-up with the list view

/// <summary>
/// Opens a file, updates the beatmap from the selected file, and refreshes the editor.
/// </summary>
private void HandleOpenClicked()
{
    UpdateBeatmapListSO();
    m_BmPop_ListView.Rebuild();
    m_BeatmapPopup.style.display = DisplayStyle.Flex;        
}

/// <summary>
/// Opens the file from the selected popup entry.
/// </summary>
private void HandlePopupOpenClicked(System.Object item = null)
{
    var active = item == null ? m_BmPop_ListView.selectedItem as string : item as string;
    if (active != null)
    {
        UpdateBeatmapFromFile(active);
        ClearMap();
        UpdateEditor();
        HandlePopupCloseClicked();
    }        
}

/// <summary>
/// Closes popup view and returns to the main editor interface.
/// </summary>
private void HandlePopupCloseClicked()
{
    m_BeatmapPopup.style.display = DisplayStyle.None;
}

Call to reload the contents

private void UpdateBeatmapListSO()
{
    m_BeatmapListSO.Beatmaps.Clear();
    m_BeatmapListSO.Paths.Clear();
    var res = GetBeatmapList();
    m_BeatmapListSO.Beatmaps = res.Item1;
    m_BeatmapListSO.Paths = res.Item2;
}
#

Before the refresh

#

After the refresh

#

Checking my SO and through the locals in the VS debugger, the data is still present in the list, successfully deserialised from the refresh. Just that the binding doesnt see it anymore.

#

I found the fix.

I must re-assign the itemsSource
m_BmPop_ListView.itemsSource = m_BeatmapListSO.Paths;

rose violet
#

I’m currently trying to use Unity UI Toolkit. I’m still a beginner, but I want to do things in the most correct way and learn best practices.

At this stage, could you first help me understand how to solve this problem?

I have a "top" visual element, and I want to place a scroll view right below it. However, I had to set the top visual element to absolute because when it is in relative mode, it covers the entire screen (as shown in the second image), and it creates a strange layout. When I try to change its size, it still occupies the whole screen.

When I switch it to absolute and give it a height of around 5%, it looks correct (as in the first image), and the scroll view starts from below it as I want. However, in this case, the scroll view overlaps the top element (as shown in the third image).

If I set the top value to 5%, then it works visually, but I’m not sure if this is a correct or professional approach. I feel like there should be a better and more proper solution.

What would be the best practice for handling this situation?

hushed cradle
#

How do I draw the defaul inspector for KeyCombination? Would I use a propertyField?

#

To be clear I want to embed the default property drawer for KeyCombination class in another custom UI Document

rough scarab
#

The scroll view would need to be flex grow 1 to fill the remaining space

rose violet
#

When I add a VisualElement inside a ScrollView and set its width to auto, the background color does not appear. However, if I give it a fixed pixel width, the background color becomes visible.

How can I solve this problem? I want this element to take up 100% width, but in that case the background color is not visible.

I think this is happening because the parent does not have a defined size, but I cannot directly modify the unity-content-container. So how can I handle this?

rose violet
#

I figured it out — it was happening because I set overflow to hidden. However, I actually want to keep overflow as hidden because I don’t want the content that extends beyond the bottom of the main screen to be visible. How can I handle this?

spare trellis
# rose violet I figured it out — it was happening because I set overflow to hidden. However, I...

This is a layout issue, and is not likely related to overflow even though it has some effect when Align Items is not set to stretch. You probably set Align Self on the parent scroll to flex-start which causes the scroll view container's width to be intrinsically 0. Either set it back to AUTO or use stretch

If you're stuck again in the future, right click bold changed fields and click Unset to debug from a clean slate

mint turtle
#

Hello, who can help me))

I cant find sort order, why? (World space UI toolkit).

echo bough
#

I'm having a problem and can't get the 9-slice to work properly. Any ideas?

mint turtle
hushed cradle
mint turtle
mint turtle
#

I used Sorting group before but its a terrible solution

mint turtle
#

Well, what does that mean? Unity's latest thing is just for fun. I'll have to do it the old way with sprites, at least I know how to render and batch things.

spare trellis
mint turtle
tranquil tangle
#

Does any one know if the UI Toolkit has any known issues with touch screens? Im having some odd behaviours...

feral onyx
#

Yes there seem to be some issues, but nobody has ever specified what they are.

opaque shore
#

Does UITK not support gaps for flex items with a single property?

hushed cradle
#

How do I add a property selector for KeyCode, or any other type in ui toolkit? Is it through the propertyField?

If so, how do you do it? I'm finding the documentation surrounding propertyField to be very confusing, and I have no idea if I should be using Binding for it

halcyon path
#

Hey y'all does anyone know how to apply a shader graph material to only the background of a button? This is what it looks like when I just straight up apply the material to the button:

#

Looks like the label gets obscured too

halcyon path
#

If anyone has the same problem use the Render Type Branch node, just learning this now.

#

You need to add that. If your colors are messed up use a colorspace conversion from linear to RGB.

mint turtle
#

Hello! Is there something like a canvas group that would allow everyone to set the picking mod = ignore ? Going foreach all the elements that are no longer needed isn't a very good solution.

tough bear
#

How can I replicate default drawer behavior?

public abstract class WithRarityDrawer : PropertyDrawer
{ 
    public override VisualElement CreatePropertyGUI(SerializedProperty newProp)
    {
        if (Settings.CustomInspectorsEnabled == false)
            return ();
    }

if this bool is enabled I just want default behaviour like there is no custom drawer but calling base leaves me with the "No GUI Implemented" result

#

If vertx is reading this I did try looking at the unity huh how website but I don't think your page for "No GUI Implemented" covers this

rough scarab
tough bear
#

I can turn the bat signal off now šŸ˜„

#

I think i'm still getting no gui, do i need to bind it or anything else?

#
    public override VisualElement CreatePropertyGUI(SerializedProperty newProp)
    {
        if (Settings.CustomInspectorsEnabled == false)
        {
            PropertyField defaultField = new PropertyField(newProp);
            return (defaultField);
        }
rough scarab
#

Are you sure that code is running?

tough bear
#

Oh hm, good shout I made a bad assumption. It's not but I don't know what to do in this situation because i assumed that either

A. it's not running therefore I get default behaviour
B. it is running and im explicitly returning default behaviour

#

Settings.CustomInspectorEnabled is being set via a MenuItem, I just want a nice global way to turn all my custom stuff off. Is there a better way to do this?

#

oh maybe it's because it's being drawn in an inspector where I'm doing this and it's a similar issue?

[CustomEditor(typeof(SelectableLevel))]
public class SelectableLevelEditor : Editor
{
    public override VisualElement CreateInspectorGUI()
    {
        if (!Settings.CustomInspectorsEnabled)
            return (base.CreateInspectorGUI());
    }
}
#

ah i think i found a forum thread confirming this

#

ty for the help, showing how to do default drawing on both of these might be a cool thing to add to your very helpful website šŸ˜„

tranquil tangle
#

Is there a particular reason the panel's focus controller doesnt have a FocusChanged event or delegate? It seems like something that would be really useful, especially because the focus events dont always fire

wooden sigil
#

how to change line spacing in label becuse it is not found in UI Builder

wooden sigil
#

what about this what is the best way to remove those spaces instead of resizing the icon

vernal folio
#

Hey I'm trying to put this to text on an image for a button prefab but I can't put them on top of each other?
Image

fervent cloak
#

Hey, really dumb question but I want to kinda confirm and hear from someone that has more experience, I've created a bunch of UI with UI Toolkit by now and I've come to the realization that most of the time I really really really only have one single gameobject with the PanelRenderer component. Is it OK and realistic to just kinda create the entirety of the UI through code? Given that it only requires the UXML being assigned

#

Because it really seems a sensible thing to do, unlike with ugui

graceful carbon
merry delta
hearty hatch
#

Hi there. I'm trying to understand how this (see attached 1) works : i put a binding by type of my c# class (plain class, system.serializable, that's it)
From what i understand, i selected a type of object i can put in my datasource, in my object, and then i can, at runtime, put an instance of my class as the datasource via script.

However, i'm getting spammed with warnings (see attached 2) that my datasource is empty and that unity can't bind it ? This is making me think that i cannot do it that way, or that i'm misconcepting how it works. Anyone might guiding me to ressources on this topic specifically? I sadly did not find anything on the docs for that.
Then, as a test, i did add a contextmenu to my start function to be able to execute it out of play mode, and the warnings stop. Though when i open my UIBuilder back up they come back and my datasource is set at empty. I supposed we're not supposed to do this out of playmode.

#

(please ping me whenever u answer to my message dw bout me :) )

hearty hatch
#

On another note, the bigger problem for me seems to be that my world space text isn't showing and i have no idea why. Is it bc i'm in HDRP? Here's what the debugger is telling me :

#

Here's my uibuilder preview

#

Here's the uxml code

<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
    <ui:VisualElement style="flex-grow: 1; background-color: rgba(106, 106, 106, 0.81); height: auto;">
        <ui:Label name="Title" text="Title" style="-unity-font-style: bold; font-size: 48px; -unity-text-align: upper-center; -unity-text-auto-size: none; flex-grow: 0;">
            <Bindings>
                <ui:DataBinding property="text" data-source-path="LocDisplayText" data-source-type="App.Localization.DisplayableLocalizedString, Assembly-CSharp" binding-mode="ToTarget"/>
            </Bindings>
        </ui:Label>
        <ui:Label text="Desc" name="Desc" style="-unity-text-align: upper-center; font-size: 31px; height: auto;">
            <Bindings>
                <ui:DataBinding property="text" data-source-path="LocDisplayText" data-source-type="App.Localization.DisplayableLocalizedString, Assembly-CSharp" binding-mode="ToTarget"/>
            </Bindings>
        </ui:Label>
    </ui:VisualElement>
</ui:UXML>
honest nebula
#

I'm a bit confused with ui toolkit around how we are meant to make custom components (like you would int he web world with vue/react etc) . The info online seems to indicate we should inherit from Visual Element and in the constructor do Resource.Load the uxml file then clone the tree into itself which seems really odd and I thought unity was trying to move away from Resource.Load.

Is there a better way to represent a components logic, styling and uxml without doing this? I want to keep things self contained, reusable and consistent ideally

pure prism
#

does anyone knows how to put animated sprite in ui toolkit? afaik theres no built in way

fervent cloak
#

Animate it through code or a shader, also had to do that in ugui iirc

hybrid badge
#
private void OnEnable()
    {
        inputReader.onPlayerMenuTogglePerformed += ToggleMenu;
        var root = playerMenuUI.GetComponent<UIDocument>().rootVisualElement;
        Debug.Log($"Root found: {root != null}");
        var scrollView = root.Q<ScrollView>("SlotScrollView");
        Debug.Log($"ScrollView found: {scrollView != null}");
        if (scrollView != null)
        {
            for (int i = 0; i < slotCount; i++)
            {
                var slot = new VisualElement();
                slot.name = $"Slot{i}";
                slot.AddToClassList("Slot");
                slot.style.width = 40;
                slot.style.height = 40;
                slot.style.backgroundColor = Color.red;
                slot.style.flexShrink = 0;
                slot.style.flexGrow = 0;
                scrollView.contentContainer.Add(slot);
            }
            Debug.Log($"Slot count after add: {scrollView.contentContainer.name}");
        }
    }

is this the correct way to add VisualElement at runtime?

crimson juniper
#

Is it possible to add effects? I'd like to add an outline highlight effect to a visual element when it is displayed

hybrid badge
crimson juniper
#

I mean like an outline around the element which appears and then fades out

hybrid badge
#

just fade out color alpha

fervent cloak
#

I haven't used SVGs yet, but is there a list anywhere of what they do support? ex. coloring, shaders, etc.

rough scarab
#

What version of Unity are you using?

lunar rain
#

You seem to have anti-aliasing (AA) on the SVG so you must be on 6.3 or newer where AA support was added. I have tried it on 6.3 and the anti aliasing looked horrible. I ended up rasterizing all the SVGs into high quality textures and enabling mipmaps which looked wayyyy better than the SVG stuff. Luckily those vector image sites usually offer tools to choose colors and export high quality PNGs.

SVGs were useless without AA but even now they have been totally unusable with the poor rasterization engine. Anyone let me know if the quality of SVG rendering has improved since 6.3, I haven't seen that talked anywhere at least. If you find solution to this, I'm very interested, maybe there is some setting somewhere that I'm not aware of.

lunar rain
#

Surprisingly the "proper" SVG support in 6.3 has been talked very little about from what I can see. Not enough to even find any reference images to compare against. If it worked well, SVGs would have a potential to become a default way to display UI icons. In the current state (in 6.3 at least) I don't see any upside to using them

rough scarab
#

I'm on 6.3 and mine look fine

#

Default is fine, imported as Antialiased Arc Encoding

lunar rain
#

Especially small images look very bad. Even with larger scale some parts of the edges look much too sharp to my liking, a texture based one looks simply nicer

#

I should add that this was using the same AA Arc Encoding, the AA is clearly enabled but just doesn’t do very good job

lunar rain
#

Wait why did you remove everything?

hearty hatch
hybrid badge
#

I’m having an issue with the vertical scrollbar. I can change its color using the :hover pseudo-class, but not with :active or :focus while I’m dragging it.
If anyone knows how to fix this or can point me to the relevant documentation, please let me know.

fast escarp
hybrid badge
#

I will try

compact lichen
#

Hellos i was wondering if the Dragon Crasher sample is still the best one sample to gain the best knowledge on how to make a good UI toolkit structure both that work vertically and horizontally?

patent anvil
#

When using world space UI for player nameplates, do you need one panel (or panel settings) per nameplate?

graceful carbon
eager hemlock
#

Any good resources on using gamepad with UI toolkit?

#

I had to resort to so many hacks/workarounds that i dont think im doing it right

#

The hover/focus property works poorly so i had to manually listen to navigation events and add/remove custom classes

eager hemlock
#

I want to be able to show the user the selected button (by changing a color or size or something) but only on gamepad, if i use focus it has this problem when using a mouse

dense vector
#

Kinda stuck right now with implementing a ListView that can bind to a typed collection from the parents binding.

I've looked at several forum posts, read the guide provided here https://docs.unity3d.com/6000.3/Documentation/Manual/UIE-runtime-binding-list-view.html and yet, it still does not work.

The farthest I've gotten is the list will render the appropriate amount of Visual Tree Asset templates assigned to the LIstView template attribute, but the bindItem itself seems to not be working, as the templates are not recieving the binding data...

#

Almost all these examples online show using Object binding, with ScriptableObjects, I'm trying to use TYPED binding...

#

I'm honestly just trying to find the idiomatic way of doing runtime Typed binding with UXML ListView... like, this shouldn't be so hard, yet, its just not working as one would expect...

dense vector
#

Welp... figured it out, I was using ObservableCollection, switching to List fixed everything

#

Amazing stuff guys

twilit socket
#

is there any way to have curved text?

lunar rain
# twilit socket is there any way to have curved text?

I don't think the default text component can be curved by itself. Would a texture of curved text be an option or do you need it more dynamic? One option that I could consider is to render the text to a RenderTexture and then put that on a curved surface (curved mesh, could be curved via vertex shader)

twilit socket
lunar rain
twilit socket
#

But the text changes its an input field

#

I thought of the other way u suggested but dunno if its gonna be reliable

#

Or even worth it tbh

lunar rain
# twilit socket But the text changes its an input field

Yeah sure, then a premade texture is obviously not an option. Unity does not support curved texts I don't think so you would have to do it yourself. I agree the RenderTexture option can be quite bit of work to get working but that's the easiest solution I could think of. Shaders would be something potentially worth experimenting with too but I'm not too confident it would even work since the UI Shader Graph doesn't support vertex manipulation and therefore it could be a huge problem trying to add extra padding around the text to fit the curved one (adding actual padding could work though I don't know whether it actually scales the mesh rendering the text)

#

Yeah no I doubt the UI Shader Graph will be much of help

#

custom HLSL shader perhaps (probably vertex manipulation allowed too)

twilit socket
#

ok ill try some things and update, maybe others need it to in the future

sullen bay
#

I just created a TextField and it's clearing when I press escape. Is this default behaviour or is something wacky going on?

(sorry if this is the wrong place to ask, not sure why it's under "artist tools")

shadow lintel
#

Hello everyone!

I have an issue with a transition i'd appreciate some help with.

See i have an element with a set size (h and w) and a transition all. I add a class to this element when clicked that applies a different size, however the animation is not taking effect. I added a color change for debugging purposes.

This is a component so I'll add the element C# class here, know that the USS class is applied because i can see the color and size change, just not the transition

Materials:
UXML and USS -> https://pastebin.com/qAR0K3bE
C# Element -> https://pastebin.com/kP62iCe5

Expected:
Size and color change and animate

Result:
Size and color chanes (class aplied correctly) but it does NOT animate.

Thoughts:
Maybe the re-parenting affects this? If so is this expected or a bug?

Please ping if you need any more info.

shadow lintel
blazing musk
#

Hey quick question. Are custom controls usually implemented in other templates via template or just directly?

Example: I have a CustomControlThingy.cs. Should I put those in a .uxml to implement the control somewhere else or should I just use the custom control directly (but then it lacks any styling afaik)

spare trellis
umbral sonnet
#

Hello,
in my game I have horizontal scrollview, which contains buttons. Scrollview is filled via itemTemplate.CloneTree() function in script. When player click on some button I want to clear existing buttons and give it new offer - so I am cleaning scrollview via *.Clear() function. and adding new buttons via Add() function.

My problem is, that after addding new content to scrollview it is randomly scrolling to one side. I tried to use:

sc_Selection.schedule.Execute(() =>
            {
                sc_Selection.horizontalScroller.value = 0;
                sc_Selection.scrollOffset = Vector2.zero;
            }).ExecuteLater(0);

or geometrychange event, display.none. But nothing solved this randomly scroll :/

How would you make the scrollview start on first element without scroll animation after loading new content? Thank you! ā¤ļø

blazing musk
#

Anyone know how I force a refresh in the ui builder? it happened multiple times now that it doesn't recognize a chnage and I can press ctrl+r as much as i want. (Hot Reload off/on tried already).

#

well i guess i can just change another value to tell unity again smth changed

outer flame
#

is there a way to bind class property to material property in UI builder?

#

like ... is there way to bind only certain material props(float, vector4, etc)? or do I have to bind the whole style.unityMaterial thing

strange hill
#

Why my runtime PointerDownLinkTagEvent always return evt.linkText as "test"

outer flame
#

UI Builder keeps crashing for some reason šŸ™

outer flame
#
                    <!-- <Bindings>
                        <ui:DataBinding property="enabledSelf" data-source-path="Display" binding-mode="ToTarget"/>
                    </Bindings> -->

so this is crashing unity for some reason...

outer flame
#

Okay I had to split visual elements and pass in classes from there. Weird thing is it worked fine. It only blows up when I made change in UI builder

lapis nymph
#

I think this is the right channel. I came from roblox studio, and one of the things that hit me like a truck was the fact there's no uicorner and other built in tools in unity. Are there any plugins that expand the gui component/option segments for this

graceful carbon
lapis nymph
outer flame
graceful carbon
outer flame
#

it's in border

graceful carbon
#

or with Masks if you want any other arbitrary shapes

sterile terrace
#

how to get visualelement by binding path?

#

c#

sterile terrace
#

nevermind VisualElement.Querry<PropertyField>().Where(p => p.bindingPath == "_name").First();

summer ice
#

I'd like to ask some general questions about UI toolkit.

#

I am building software for machine simulation, something like Powermill but more specialized. I started it on C# WPF with thirdparty library for collision detection, but I am hitting limits and thinking about moving to Unity

#

I do know something about MVVM and bindings, but in WPF

#

Does UI Toolkit use MVVM too?

#

Does it rely on Microsoft.CommunityToolkit.Mvvm package and INotifyPropertyChanged or it runs on its own library for bindings?

graceful carbon
noble oxide
#

Guys, What in button's properties in ui builder that changed when the button is clicked ? I want something that bindable
Like value of slider , it change when the slider is adjusted, and it is bindable
I want somethings similar in button, anything, i just want to get the the signal

summer ice
#

Nice example, but does UI Toolkit really require dependency injection?

 base.OnConfiguringApp(builder);

        // Register pages as Transient services
        builder.services.AddTransient<MainPage>();
        builder.services.AddTransient<AnotherPage>();
        builder.services.AddTransient<SettingsPage>();

        // Register ViewModels
        builder.services.AddTransient<MainViewModel>();
        builder.services.AddTransient<AnotherViewModel>();

        // Register other services
        builder.services.AddSingleton<IMyService, MyService>();

I did not really use this and it feels overengineering

edgy prawn
#

ListView i need the vertical scroll bar to be on the left of the container not on the right. HOW? google doesnt know.

#

@graceful carbon is there an alternative in AppUI?

graceful carbon
edgy prawn
graceful carbon
#

changing the flex on the container of the scroller might work too

fast escarp
#

you cant find it from ui builder

#

selectors are kinda complex

#

use ui debugger

#

matching selectors on the right side

outer flame
#

does vector/svg in UI toolkit get rasterized when imported/used?

rough scarab
#

No

outer flame
#

okay, that's awesome. thank you

#

more reason to move more stuff from UGUI lol

lunar rain
outer flame
outer flame
#

is there a way to change individual shape colors in unity/ui toolkit vector/SVG on runtime?

rugged steeple
#

is it possible in UI toolkit .uss classes to define a set of properties in a var / function, and then when you create styling for a selector, you just say the variable name to apply those properties., eg:

var specificStyles {
    width: 80%
    height: 80%
  }

.class-selector  {
   using specificStyles
}
rough scarab
#

Not without a third party package like the few that let you write SASS

rugged steeple
#

is that more of me wanting to use uss in the wrong way, or just hasnt been looked at for UItookit yet?

blazing musk
#

Anyone know if there is a maintained plugin that combines uxml, uss and a cs file similar to Vue Single-File Components?

cold tapir
#

Hi all , can anyone tell me what is problem ???? my screen : 1280 by 720 but even I reach the edge it say 802

Debug.Log($"H: {Screen.height} , W: {Screen.width} , POS:{new Vector2(evt.position.x , Screen.height-evt.position.y)}");

outer flame
#

check anchor?

cold tapir
vocal hound
outer flame
#

anchor of the visual element. sorry, I meant transform origin

#

maybe the origin is on the left/right edge of the element?

cold tapir
cold tapir
outer flame
#

this is UI toolkit

#

in UI builder

cold tapir
#

I never touch that

outer flame
#

also go to Window -> UI Toolkit -> Debugger and then click on Show Layout. maybe that will help a bit

cold tapir
#

Thanks

outer flame
#

npp

cold tapir
#

Fixed from change from Constand Psychical Size to Constand Pixel Size from panel setting:

mint moth
#

Been trying to figure this out for most of today, the UI in my Scene View is pretty crisp and looks good; but in Game View it looks very deprecated, specifically at 1920x1080 resolution - on my normal monitor which is 3860 x 2160 it looks great.

Any suggestions? The Canvas Scaler is set to 1920x1080 on the UI Canvas, I don't really understand why it is happening at the default canvas size

#

easiest way to show is in images, first image is in build at 4k, second is in build at 1920x1080, third is game view at 1920x1080 and fourth is scene view at 1920x1080

outer flame
#

not sure if it's related but SVG mask tends to do that in my case:

mint moth
#

I'm not using SVG's I imported the UI at a much larger scale than it is in order for it to appear as close to vector images as possible

outer flame
#

then idk sorry x,x

mint moth
#

It's all good!

blazing musk
#

Anyone know how to set up global variables in one uss file so its available in any other? I set a variable in the GlobalArcadeGames.uss file on the :root, but I can't access it in the ScreenUI.uss

#

Okay you can actually, but only directly in the .uss file. Unity will tell you it can't resolve it even tho it can.

outer flame
#

I don't think aliasing is SVG issue... I created a shader that masks in hex shape and it's kinda doing the same thing too šŸ™

lunar rain
outer flame
#

aww

opaque shore
# outer flame aww

Hopefully smoothstep or fwidth can help?
https://www.ronja-tutorials.com/post/046-fwidth/

outer flame
#

tyy

#

I use shader graph and there's ddxy node so I might play around with that a bit

cold tapir
#

this part should find center of the button I don't know why it not work for me

outer flame
#

use transform translate instead so it preserves the position?

#

just do something like:

if it's focused then translate to the right by 4 px or something?

cold tapir
outer flame
#

this in an update loop right?

#

my guess is that it keeps drifting and updating since you use resolvedstyle? but just a guess

cold tapir
#

Thanks

tidal charm
#

HI, I'm new here. Where can I find the salon to ask anithing related to Unity problem's ?

#

about one of my project

outer flame
#

is it a good or bad idea to put everything in one UI document?

cold tapir
pallid abyss
#

Hi guys does anyone why the scripts "On-Screen Stick" and "On-Screen Button" blocking touch inputs on android?

opaque shore
pallid abyss
frail mulch
outer flame
#

I separated things into template anyway s:

blazing musk
#

Its pain to open a template and you cant go back maybe im missing smth

#

Tabs would be the dream here

#

ohhh found the 'open instance in context' THIS HELPS SO MUCH

shadow quartz
#

Anyone else really enjoying all the QOL stuff being worked on for the inspector when working with Visual Elements. Glad to be able to filter out data I don't want to focus on and be able to see only the css values I want to look at currently.

stray magnet
#

Does anyone know who to stop highlight text when typing in the unsigned integer field?

fast escarp
#

is that in hierarchy directly?

#

looks great tbh, current debugger sucks

shadow quartz
fast escarp
#

I am on 6.3 I think they both dont exist

shadow quartz
#

Oh you have a setting you flip on to activate it

#

Unity 6.3 was when the new hiearchy was introduced.

#

The search filter for attributes was introduced in 6.5.

#

note to reference visual elements into inspector fields you need 6.5 as well.

fast escarp
#

oh thanks, where do they introduce this though... Seems pretty important and I missed it even though I am using uitk a lot

shadow quartz
shadow quartz
fast escarp
#

I meant like where do they announce these new features, if they do it at all

#

thanks again for showing

#

where did you find these out?

shadow quartz
#

Currently they are showcasing the new Panel Render which enables Animation support for UI Toolkit.

#
Unity Discussions

Not sure if this is possible, but what about going to a similar route of the Physics Core 2D module PhysicsEvent with the interface. Example the IContactCallback can just be implemented on non-monobehaviors. I literally just use it on pure C# object such as structs and classes that inherit from nothing. Just make a IUIReloadedCallback and have ...

shadow quartz
#

I am currently making a set of videos for UI Toolkit new features for Unity 6.4, 6.5 and 6.6.
Note 6.6 is still alpha and major new features are still being add.

fast escarp
shadow quartz
#

It also inherits from the base class for all Renderers which make custom shaders and a lot more other graphics related features start to be possible with it.

fast escarp
#

Oh I see, sounds nice. I have a uitk focused tool, seems like most of the stuff will get outdated soon. I try to close the gap vs ugui with custom solutions. For example made a transition animation tool for simple effects, it uses uss transitions but it is only for combining basic effects like scales, opacity etc

#

For shaders, I made some experiments, have a long message where I summarize them, it is long so will send in thread

shadow quartz
#

Due note Unity 6.4 and 6.5 added a lot more support for Shader related stuff./

#

With the Panel Renderer introduced in Unity 6.5 inheriting from the base renderer class it now has support and access to a lot of SRP features.

fast escarp
#

I added some fancy stuff but my main goal was css gradients and shadows

shadow quartz
#

Culling, shader data like screen position, SRP batching, and a lot more.

shadow quartz
fast escarp
#

animating? when did we get gradients lol

#

I go into more detail in thread but I have to find a workaround to shaders as I couldnt optimize them and cant do batching as far as I know(uitk filters)

#

seems like tons of updates are coming though, nice to hear

shadow quartz
shadow quartz
#

The gradients even work with shadows and outline on font.

fast escarp
#

these are great but leaves me in weird situation šŸ˜„ uitk updates are so slow so I create custom solutions, they will become obsolote later but I also need them for my game

shadow quartz
#

Oh sorry they aded animation support for the background position and repeat, but not the background gradient.
my bad, but there is a gradient tag for ATG for UI font stuff and there is a way for gradients on the background property.

shadow quartz
#

Also half the engine moved their windows and editor to UI Toolkit recently.
They had to help with that which slowed down progress a lot as well, but not anymore.

  1. Rendering Debugger Editor and Runtime UI to use UI Toolkit.
  2. Animation Editors use it now and Timeline 6.6 and Animation Rigging 6.6 came out officially.
fast escarp
#

these sounds dope thanks for all the info again, it puts me in weird position as I also have this tool on assetstore but my solutions are like best case scenario for 6.3 lts so I guess thats fine, I will update & replace with official solutions as they come
One more question, Is there anything for playing particles on UI? Because even ugui doesnt have official solution for this right? everyone uses the package on github

shadow quartz
# fast escarp these sounds dope thanks for all the info again, it puts me in weird position as...

Sorry I keep mentioning the Panel Renderer, it just happens to be the answer to your questions.

First there were a couple things Unity had to finish first before implementing that.

  1. The new VFX Graph Compiler update needs to be completed. This introduces new API for GPU Event support.
    This was actually merged yesterday for 6.6.
  2. Unity now has to implement the last set of SRP stuff for the UI Toolkit which they already started doing.

So with the Panel Render inheriting from the base Render class it opens up a lot of new SRP related stuff.
This was a requirement for particle support in UI Elements. I am not sure if they have a plan for them in Unity 6.6 or 6.7 yet

#

Edit: I hate Discord for embeeding the GitHub preview.
.....oh Discord embeds the face of the GitHub user that created the merge request....sorry roland

fast escarp
#

Thanks again, learned lots šŸ˜„ are you an unity developer? you are following everything with detail

shadow quartz
# fast escarp Thanks again, learned lots šŸ˜„ are you an unity developer? you are following ever...

Sorry had to think what I was allowed to say for a second lol.

I am not an employee for Unity, but just someone that helped find a lot of bugs in the engine and tracked them down. Also Unity has feedback sessions where they meet with devs and studios for asking about new features, current feature states, and more. I was part of the UI Toolkit one when Unity 6.2 was in beta.

Right now I am giving feedback for Unity 2D features. Tilemap, Physics Core 2D module, 2D renderer related things.
Unity gives credit to users on their website for helping with alpha and beta testing.
I am on the 6.4 and 6.5 credit list.

https://discussions.unity.com/t/unity-6-4-alpha-beta-special-credits/1718319

Unity Discussions

šŸ‘‹ Hey everyone, Unity 6.4 was released in March, and although we’re a little late to the party, we still want to take a moment to thank everyone who used Unity 6.4 during the alpha or beta phase and shared feedback with us. We’d also like to extend a special thank you to the following users who submitted bug reports during this time and ...

shadow quartz
outer flame
#

I really want to use the experimetal animation ... but I'm scared to include it in my project lol

shadow quartz
outer flame
#

we will just be able to install a new version right? my project uses 6.3

outer flame
shadow quartz
outer flame
#

sometimes making change/binding using UI Builder will break UXML structure that I have to fix manually

#

6.3

shadow quartz
#

Also do you have the ATG settings turned on. There are known crashes with certain labels being renderer with ATG after a mouse hovers over them.

Going to be honest on 6.5 and 6.6 I haven't had a crash yet related to the UI Toolkit with the most recent last two patches for both.

#

Oh wait found a couple open reports of corrupted files when selecting objects for data bindings in the UI Builder in Unity 6.3 that is being investigated right now.

outer flame
#

what's ATG?

shadow quartz
# outer flame sometimes making change/binding using UI Builder will break UXML structure that ...

There are multiple bugs like you described being worked on right now.
One of the open reports could be what you are running into.

Link to the public bug reports of just a couple. There are a few more related to data binding and the UI builder other than these two.

https://issuetracker.unity3d.com/issues/select-scriptable-object-window-freezes-and-becomes-unresponsive-when-currently-opened-uxml-template-is-selected-for-bindings-data-source

https://issuetracker.unity3d.com/issues/uxml-file-gets-corrupted-and-assertion-failed-errors-when-selecting-incompatible-asset-with-advanced-object-selector-in-ui-builder-data-source-object

#

Advance text generation - option in the project settings.

outer flame
#

ah

#

it crashed before I had it ATG on

#

šŸ˜‚ I even has a counter on my stream as a joke

shadow quartz
#

Depending on what you are doing turning it on might also fix your problem.

outer flame
#

hm.. I turned it on recently. but I haven't run into anything much. but then again I haven't worked on UI for a couple days

#

I'll keep an eye on it and test around then. thank you

shadow quartz
#

Not sure if you have the crash log text file but if you have the line it crashes on that could help.

#

But yeah, Unity had done a lot of reworking the UI Toolkit stuff starting from 6.4 and newer so things are easier to fix in them than Unity 6.3

outer flame
#

šŸ¤” I wonder how hard it's going to be to migrate 6.3 LTS to... 6.4?

#

is that the one with better version support?

shadow quartz
#

So it depends on your project actually Unity 6.4 and 6.5 started removing legacy features making less bloat in the editor.
Usually the LTS is the best option which current one is 6.3.

Depending on the project going forward from Unity 6.3 to 6.4 or 6.5 should be easy and quick unless you are using one of the legacy features being deprecated.

Warning Unity 6.5 is still a beta. So version control your project before updating if you decide to test stuff out.
Mainly for UI Toolkit though the Unity 6.5 version is the one with the most changes.
It introduced the panel renderer.

outer flame
#

what's the legacy feature being removed?

shadow quartz
# outer flame what's the legacy feature being removed?

Unity is removing quite a bit of really old stuff. Don't use the UXML Traits basically.
Unity 6.4 deprecated them and fully removes them in 6.6.

So use the attributes like UXMLElement instead.

For other stuff out of UI they completely removed the old Render Graph compatibility mode now.
I would also avoid the old legacy input if you plan to update.

outer flame
#

normally I created UIElements from UI Toolkit and I'm not sure if I use UXML Traits before

shadow quartz
#

Reason for the old legacy Input they officially removed the UI Toolkit set input backend method and UIToolkitInputEvent components already.

#

UXML Traits is for creating your own custom types of UI Elements......thank god they removed it and made a literal on word attribute to replace no joke 20 or more lines of code.

#

Note the complete removal wasn't done till the 6.6 alpha, but the alpha with it removed is already published.

outer flame
#

ah gotcha. I've been using the new input system so we might be okay in that regards I think.

outer flame
shadow quartz
outer flame
#

did they add a way to bind listitem in the ui lol

shadow quartz
dark blade
#

how to prevent that element pushing other element beyond the container?, the left side is a textfield, and right is button and button, they are child of visual element with flex direction row,

opaque shore
outer flame
#

set max width?

edgy prawn
#

Question. I currently have this. Setup. each GO in the UI has a UIDocument and a relted Bootstrap script on it. And the planes are made like on the image. Basicly all share the setup. Now i kinda want to move to a one UIDocument system. Do i move it all to one panel using template or do i just copy paste from the #panel into the new UIDocument.

edgy prawn
#

Is this ok?

opaque shore
outer flame
#

Fair xD

pale pulsar
#

New to Ui toolkit. I am wondering what it is best for? When is a good time to use it over canvas stuff? When is it better to use canvas instead of ui toolkit?

outer flame
#

I'm new to it too, but one thing I like a lot better than canvas is they support shader graph shaders a lot better

tough bear
#

The biggest value of UIToolkit for me is that it's not neccasarily GameObject/Component based, Which allows way more freedom in how you want to develop your UI based code

cloud nexus
#

UI Toolkit can save "UIElements" as "Prefabs" or something like that right?
Say for example I have an interface to Edit the data of a Characters List, and each character is the be represented by an UIElement card with their info such as Name, Class, Exp and so on, so I could create new cards dinamically by hitting "Create new Character", this is possible, right?

cloud nexus
rough scarab
#

(Or a combination of both)

pseudo sentinel
#

and the most annoying thing about UGUI for me is the giant canvas in the scene that I have to keep enabling and disabling

#

Once they add navigation customization from the builder I will move over

edgy prawn
pseudo sentinel
# edgy prawn Navigation customization?

yeah to be able to navigate the UI with arrow keys or joystick, currently you can't customize that trough UI builder you have to do it from code which is pretty painful

edgy prawn
#

The GridView from AppUI package how easy is to add drag/drop to the slots? I have a template of the slot. And each "slot" is a entry in a SO array that is binded to GridView source

graceful carbon
pseudo sentinel
dark blade
# outer flame set max width?

max width is work, but i intent to add another more button there, so currently i need to calculate manually the size of textfield width, each added new button, is there any better way?

outer flame
#

ah, you can set shrink/grow

#

set textfield width = grow so it will expand to fill the horizontal space

#

then set the buttons shrink/grow to 0 so it always stay the same size

dark blade
#

ill try it

dark blade
outer flame
#

okay let me try something

dark blade
outer flame
#

is that a clear text button?

dark blade
#

currently setting the width or max width of text field do the job, but as i said, if i need to add another button to it, i need to manually set the size of textfield

#

yes, so VisualElement(flex grow 1, dir row) has 2 child, text field(flex grow 1) and button

outer flame
dark blade
outer flame
#

ah

dark blade
#

see if textfield are pushing the button

outer flame
#

right now it just clips

#

just set width to auto then shrink 0 grow 1

#

(for text field I mean

#

here's the structure

dark blade
#
.input-field__field {
    flex-grow: 1;
    width: auto;
    flex-shrink: 0;
    height: 26px;
}``` i dont know what make mine different then
outer flame
#

are the 2 buttons inside text field?

dark blade
#

no, its supposed to be the same as your, they are child of visual element as container

#
_mainContainer = new VisualElement();
            _mainContainer.AddToClassList(ussClassName + "__main-container");
            hierarchy.Add(_mainContainer);
            
            _textField = new TextField(){label = "", isDelayed = true};
            _textField.AddToClassList(ussClassName + "__field");
            _textField.RegisterValueChangedCallback(OnValueChanged_TextField);
            _mainContainer.Add(_textField);

            _clearButton = new Button(iconImage: AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/File Creator/Graphics/Asset 17.png"), OnClick_Clear);
            _clearButton.AddToClassList(ussClassName + "__clear-button");
            _mainContainer.Add(_clearButton);
outer flame
#

ah I'm not in editor

#

is this for editor or runtime?

dark blade
#

its for editor

#

are they behave differently?

outer flame
#

yeah šŸ˜‚ my bad

dark blade
#

šŸ˜–

#

so still no easy solution -_-, im still need the recalculate width if added another button to it,

outer flame
#

give me a min lol

#

when the text is really long, do you care if the button covers the end of the text. I know a quick workaround but I can look more into this lol

dark blade
#

if possible, im expecting while its still on focus, the visible text is from the last text, then when lose focus it's either clip or ellipsis the last text, just like a normal text field does

#

while still respecting the width of button'

outer flame
#

almost there lol

dark blade
#

its respecting the container size?, does its no longer try to take more space where its shouldn't?

outer flame
#

it's not but I'm working on a fix

dark blade
#

go for it brother, im already giving up, i can just easily put it on the bottom, but the style just "ugly" for me

dark blade
#

what u did?

outer flame
#

textfield: width 100% width padding right button width x 2 = 50
button: wrapper position absolute right = 0

dark blade
#

i just found a more easy fix

.input-field__field {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    height: 26px;
}``` setting min width to 0 somehow do the job
outer flame
#

šŸ˜‚ wow

#

welp that was fun lol

dark blade
outer flame
#

"it just works" - todd

dark blade
#

thank's anyway

outer flame
#

no problem šŸ˜‚ I didn't do anything. credit's all on you

fast escarp
#

anyone knows if its safe to add class to PanelRootElement?

#

I wanna use it like global style switching like dark/light mode for example, or different font for japanese for example

#

not sure if there is better way, ui themes? ui themes doesnt really seem good solution to me, if I want multiple global styles for difference concerns they would get messy I think

#

it would be nice If I could just switch one uss file of a theme during runtime

opaque shore
fast escarp
#

yes I will give it a try, if it doesnt work I will have to add these to root element of each ui doc. UI Themes are what docs suggest for this as far as I know but not being able to edit them at runtime is deal breaker

opaque shore
#

Yea setting up styles with a single one to change it all works

fast escarp
#

but I have multiple global features so I would have to create combination, ui theme file for each combination

outer flame
#

love UITK šŸ˜„ I just moved dev UI out from game window to editor window pretty painlessly

fast escarp
#

@shadow quartz Hey sorry for ping but I am testing 6.6 and I have some questions like setting initial state from code for simple animations(like start opacity from 0 from code when uxml doesnt have it) (this has been a problem with ui document too)
also is it possible to do srp batching yet?
is discussions go to place for these? should I create new thread there?

shadow quartz
# fast escarp <@207684904379482112> Hey sorry for ping but I am testing 6.6 and I have some qu...

Going to start with the SRP batching question.

The new Panel Renderer inherits from the base Renderer class which is the main reason it has so many more features and benfits.
This does indeed allow for SRP batching for UI. Due note you can actually open up the Render Debugger now and the UI on a Panel Renderer should display all the information now allowing you see to the full information.

#

For the Animator thing Yelmond mentioned they are landing the animation support in pieces through out 6.6 alphas.
So some animation stuff you are looking for might not be out just yet, but coming over the next few weeks.

For animation stuff there is a flag in the project setting under the UI tab you have to set. Once that is set to true than animation for UI Toolkit is enabled.

#

Note after checking the enable UI Toolkit Animation checkmark you have to hit save and restart the editor for the new Animation tools to be enabled.

shadow quartz
fast escarp
# shadow quartz Going to start with the SRP batching question. The new Panel Renderer inherits ...

Thanks again!
I'll test Render Debugger but my custom USS filters drive per-element data via MaterialPropertyBlock (per the applySettingsCallback API for PostProcessingPass), which usually breaks SRP Batcher compatibility.
Is my approach wrong? I dont know too much about shaders so I did this mostly by vibe coding, of course I planned and go back and forth with uitk documentation.
Is there a path that works for filter shaders specifically?

shadow quartz
#

Doesn't look like the Panel Renderer has had RSUV support added yet.

fast escarp
# shadow quartz Here is a small clip showcasing that you can alrerady animate visual elements li...

I will also test animator window but not sure if that fits my usage.
My problem in short:

  • uxml element doesnt set opacity 0 but I wanna do uss transition from 0 to 1 when ui opens(has transition: opacity 0.5s ease-out on the element)
  • Code sets element.style.opacity = 0 then element.style.opacity = 1

I guess because settings 0 and 1 happen at same time, the 0 gets ignored, element shows opacity 1 without transition.
my solution: just delay setting "element.style.opacity = 1" a 2-3 frames but would be better if there was a better solution

I could set initial value manually in uxml but opacity is just an example, sometimes there are more like scale so I dont wanna set initial state to uxml manually for each

shadow quartz
#

Just sent a message for the UI Toolkit team about when RSUV for the UI ITself would be supported and same for custom filters.
Edit: Did it on the public forum for Panel Renderers for anyone also curious.

fast escarp
#

Thanks a lot šŸ˜„

shadow quartz
#

I am assuming you are just using USS Transitions correct for the opcaity

fast escarp
#

yes, I just wanna trigger it from code but setting 0 then 1 in same frame doesnt work, it stays 1

shadow quartz
#

Is this in C# code or the actual USS style file

fast escarp
#

c# code
the flow:

  • delete uss transition from element(or just make duration 0) so next set is instant
  • set opacity to 0
  • add transition again
  • set opacity 1
shadow quartz
#

Is this a custom visual element or a built in one.

fast escarp
#

built in

#

usually just the root element

shadow quartz
#

Oh are you getting the root element from the Panel Renderer

fast escarp
#

yea, register PanelRenderer.RegisterUIReloadCallback and use the rootElement

shadow quartz
#

Which version are you using for the Unity Editor.

fast escarp
#

6000.6.0a5

shadow quartz
#

OKay just making sure it wasn't the version with a certain bug.

fast escarp
#

the double attach event? I saw that on discussions, its not on this version?

shadow quartz
#

Which of the two UIReloadCallback callllbacks are you using.

There is one with three parameters and one with two.

fast escarp
#

The 3-param versioned one — (PanelRenderer renderer, VisualElement rootElement, int version)

shadow quartz
#

Okay so not that issue either. I can try it in my project and see if I can get it to work.

fast escarp
#

its been like this on older versions too
This problem is only on first attach, as next ones we already set opacity to 0 so opening it again works fine
just the initial attach, I cant set initial state/styling from code

#

I guess best solution would be if I could dive in and edit uxml before it loaded?

shadow quartz
#

I can do some testing after I finish some work stuff. I got to get ready for a work meeting, but I got a couple ideas to test out after the meeting.

fast escarp
#

okay thanks a lot, no rush šŸ˜„

shadow quartz
#

Most cases would be just have the default style start the opacityat 0 with a style sheet and set the default transition duration there as well.

#
opacity: 0; 
transition-property: opacity;
transition-duration: 1s;
fast escarp
#

I just want the comfort of just coding and forgetting, if there is no solution I will do this
like as developer experience, everytime I animate something I will have to manually add a uss class to that element to fix initial styling

blazing musk
#

The docu mentions I can use Monobehavior derived classes and bind them in the UI Builder. But I can't find it, it only gives me (Scriptable Object) or via Type I find it but the value is always empty.

Am I getting it wrong and it only works via script or uxml directly?

#
using UnityEngine;

namespace Code.Scripts.Arcade.Snake
{
    public class ArcadeGameState : MonoBehaviour
    {
        [SerializeField]
        int Score;
    }
}

All I want basically is using this as a binding via UI Builder (as long as UI Builder can do that). Otherwise I just do it in the class it self

fast escarp
#

My bad missed that you already know SO binding

blazing musk
#

No worries

fast escarp
#

I think this is it

#

you then just have to provide runtime instance from code

#

uielement.dataSource = instance

#

it can be done in parent too, I think all child elements get the same datasource

#

I dont use it much but remember experimenting a few months ago

blazing musk
#

Thanks!! I hoped it would be possible just from UI Builder but I guess it makes sense to give the source at runtime.

fast escarp
#

Still lots of small problems that hurt the experience, but basic stuff works nice and I hate uGUI. Making my game fully on UITK + releasing the solutions on asset store. My main workarounds so far:

  • Shaders/perf: no batching, so I bake static stuff (gradients, shadows) to textures. Shader at runtime only for elements I actually animate — gradients, outer glow, etc.
  • Transitions are fragile: not just initial-state collapse — they also die mid-flight when PanelSettings internally re-attaches the panel root. Fix is delay/prime initial state AND animate on inner content elements, never the PanelRenderer's wrapper directly.
  • No native animation/keyframe system: had to build my own sequencing on top of CSS transitions. The 6.6 alpha animation feature might help though, havent gave it a try yet.
  • UI particles: render texture + camera pooling.
    Committing early to 6.6, hoping it stays stable so I can focus on the actual game once the migration work is done.
outer flame
#

Cant you just subscribe to on transitionend?

fast escarp
buoyant isle
#

i cant align them can someone help me?

outer flame
outer flame
fast escarp
outer flame
#

I don't think they use the experimental stuff though

#

so might not be what you are looking for. but they have some UITK support stuff if you don't want to write things from scratch

cloud nexus
#

Should I have a different UIDocument for each part of the UI? One for the Player Health and stuff, another for the Inventory, another for the Dialogue, etc...?

#

I think this was the intended use for the old Canvas and UI in general, right?

#

So I assume it is for the UIToolkit as well

fast escarp
buoyant isle
graceful carbon
outer flame
#

That's what I meant, sorry

#

Main visual element = vertical. Then the 2 buttons in the same element= horizontal like the above said

tawdry sonnet
#

Hey, is ui toolkit ā€˜ready’ as a replacement for ugui? It looks like they intend to replace ugui with it at some point, so i’m hesitant to start making a long term project using ugui, but at the same time it doesn’t feel like there’s a really ā€˜good’ solution for some things you can do with ugui.

For example, a large skill tree. It’s a big window you can click & drag to move the view around (in one way or another, end result is it looks like the user is moving their view. Lets not get hung up on the specifics). It seems a bit ugly to do with UIToolkit… and to top it off, you can’t really make any tools to help with that. I.e. i’ve made an editor window that helps me place ugui elements in the scene view so everything feels correctly spaced, much faster to iterate this way than manually placing things by hand.

I guess my question is, should I be trying to use UIToolkit for this? Most of the game will be UI, so I feel like I should, but it also feels like its missing a lot of parity with ugui. And if I should be using UIToolkit, how so?

outer flame
#

scrollview?

tawdry sonnet
#

I mean there’s still the fact i’m not going to be able to make any sort of custom tooling to help speed up development

And I know that scroll view exists, but it still seems excessively ugly to manipulate this through UIToolkit, doesn’t it? I’ll have to be populating a list by getting elements through their names or through their assigned classes, both of which are strings. And it’s discouraged everywhere to use strings to grab references to things… except the UIToolkit? This would be to set different buttons to enabled/disabled, etc.

outer flame
#

I mean you can probably use both. I think UI Toolkit is better with data binding and materials but there's some place still for UGUI.

you can also maybe mix and match? xD

opaque shore
#

And in 6.5 with the new inspector we can start to serialise references to elements themselves!

fervent cloak
#

Is there a way to see what is causing UXML to not compile? I'm having errors everywhere, including in built-in Unity Editor UXML

fast escarp
cloud nexus
#

I've been hitting my head against the wall since yesterday trying to follow a tutorial and make a Pause menu that hides and shows itself
I finally managed to make it work like this

public void OpenEscMenu()
{
    //root.visible = true; // This kinda works but the buttons remain totally visible the same
    //root.style.visibility = Visibility.Visible; // This kinda works but the buttons remain totally visible the same
    //root.SetEnabled(true); // This kinda works but the buttons just get greyed out
    document.rootVisualElement.Q<VisualElement>("Root").visible = true; // Only this one worked

    Debug.Log($"Root is called {root.name} and it has {root.childCount} children.");
    Debug.Log($"Real Root is called {document.rootVisualElement.Q<VisualElement>("Root").name} and it has {document.rootVisualElement.Q<VisualElement>("Root").childCount} children.");
}
public void Resume(ClickEvent evt)
{
    //root.visible = false; // This kinda works but the buttons remain totally visible the same
    //root.style.visibility = Visibility.Hidden; // This kinda works but the buttons remain totally visible the same
    //root.SetEnabled(false); // This kinda works but the buttons just get greyed out
    document.rootVisualElement.Q<VisualElement>("Root").visible = false; // Only this one worked
}

The Debugs give me this:
Root is called Esc Menu Toolkit-container and it has 1 children.
Real Root is called Root and it has 3 children.
It seems to me that rootVisualElement does not return the object I think it does, is it the UXML? And why doesn't the other commented instructions work? The first one was from the tutorial and it worked there, it's only from 5 months ago

fast escarp
#

you should use styling, idk what visible is though

#

also SetEnabled is just a state

#

doesnt effect visibility, you cant click on button for example

#

_parentElement.style.opacity = visible ? 1f : 0f;

#

_parentElement.style.display = visible ? DisplayStyle.Flex : DisplayStyle.None;

#

first one doesnt affect layout

#

second one does

cloud nexus
#

document.rootVisualElement.Q<VisualElement>("Root").style.visibility = Visibility.Visible;
document.rootVisualElement.Q<VisualElement>("Root").style.visibility = Visibility.Hidden;
This worked as well, what's the difference between them and this though?
document.rootVisualElement.Q<VisualElement>("Root").visible = true;
document.rootVisualElement.Q<VisualElement>("Root").visible = false;
If someone could explain to me that's be cool
Also what object document.rootVisualElement actually is, I still don't know

fast escarp
cloud nexus
# fast escarp dont know about visible, styling opacity one just changes element opacity while ...

Tried both of these
document.rootVisualElement.Q<VisualElement>("Root").style.display = DisplayStyle.Flex/None;
document.rootVisualElement.style.display = DisplayStyle.Flex/None;
None of them worked

The only ones who are working are these
document.rootVisualElement.Q<VisualElement>("Root").visible = true/false;
document.rootVisualElement.Q<VisualElement>("Root").style.visibility = Visibility.Visible/Hidden;

cloud nexus
#

Why is it that when I add padding to an Image it also afects the Image itself? Wasn't it supposed to be only its internal components? Do I need to create an empty Object inside of it just so I can affect only its children?

fast escarp
fast escarp
pale bloom
#

I'm trying to figure out toolkit, and I'm struggling with getting a container to fill the whole screen without shrinking towards the top if the window gets too tall and narrow.
I've tried every combination of size (4K px size, 100%, auto) and flex (1, 0 grow, 1, 0 shrink).

Except for setting the size to 3840 x 2160, the visualElement (the red) doesn't show up in the game view (or build).
Using that size however, breaks the fill if the window is resized as mentioned above (there's only that one visualElement in the ui doc).

The panel settings are set to match width with reference resolution set to 4K. Stretching the window making it long and thin doesn't cause any problems.
Is there a way to let the red visualElement fill the screen in all cases?

pale bloom
#

I should mention the purple is the :root, which does fill the screen correctly.
It's confusing me why an empty visualElement doesn't fill it as well with 100% w/h (doesn't show up at all)

fast escarp
#

maybe it have other styling like max-height or smth?

#

did you check with debugger?

pale bloom
#

and background colors

fast escarp
#

maybe try just flex: 1; but from what you say it should work already

pale bloom
#

if that's the case I did try both already

fast escarp
#

it also sets flex basis to 0

#

can you send screenshot of ui debugger?

#

showing styling of that element

pale bloom
#

the problem is that height is being set to 0 somehow

fast escarp
#

yes but you are only showing inline styling

#

check this part

#

if anything else is effecting style it's here

pale bloom
#

there's no styling as I said

#

(the .tss is empty)

fast escarp
#

the parent is also taking full height? if so idk, never had this bug myself

#

100% height doesnt mean screen, it means parent's height

pale bloom
#

the panel does, the root element also is being set to 0 height

fast escarp
#

check it on debugger?

pale bloom
#

yep.
Setting it to flex-grow 1 looks like a fix

#

but that is not an element I placed myself, and there don't seem to be anything letting me see it in the ui builder

fast escarp
#

thats normal, if parent doesnt have any styling it will have zero height unless content has fixed height

fast escarp
pale bloom
#

the width is full sized

#

it's just the height being squished

fast escarp
#

I am on 6.6 to test new features, by default it has this styling for full screen

pale bloom
#
:root
{
    flex-grow: 1;
}

doesn't seem to have any effect on it

fast escarp
#

yes flex direction is one side only

fast escarp
#

when you do flex-grow 1 it grows in one direction only depending on flex-direction

pale bloom
#

flex direction is column

#

so it should be correct? I think?

#

but I'm not sure how I would apply the style to the root
:root doesn't seem to do anything

fast escarp
#

does it have any uss class unity adds by defualt?

pale bloom
fast escarp
#

I think you might be able to use this

#
UIDocumentRootElement {

}```
pale bloom
#

I think I've figured it out (or at least looks correct in game view now)
by giving style to .unity-ui-document__root

pale bloom
#

Yeah it looks fine in a build with weird window sizes as well now

#

thanks for the help, appreciate it a lot

fast escarp
#

npnp, what unity version are you using btw?

pale bloom
#

6.4

fast escarp
#

oh thats annoying lol I though it was older since this is just too simple to not solve

#

at least it's solved in 6.6, i guess they are just now focusing on runtime uitk stuff

pale bloom
#

it's probably a combination of me being generally ass at web-like ui and not using the default unity styles but a blank one

fast escarp
#

ohh

#

yea I have this

#

i just override unity styles but getting them from debugger was annoying work

pale bloom
#

should have mentioned I was using a blank one lmao
I had wrong assumptions on how the default works

fast escarp
#

I have 2 theme files