#📲┃ui-ux

1 messages · Page 10 of 1

honest belfry
#

I have the following code which should take a rect transform and align one of its corners exactly with the corner of a target rect transform (vertTargetTransform). When I run this code the rects are close to each other but misaligned... When I debug the xDiff and the yDiff they both say 0 even though the rects are clearly misaligned. I am doing this on a Screen Space - Camera canvas. Any ideas why this isnt working?

    {
        Vector3[] corners = new Vector3[4];
        Vector3[] corners2 = new Vector3[4];
        myTransform.GetWorldCorners(corners);
        vertTargetTransform.GetWorldCorners(corners2);
        corners[cornerToMatch] = canvasTransform.InverseTransformPoint(corners[cornerToMatch]);
        corners2[cornerToMatch] = canvasTransform.InverseTransformPoint(corners2[cornerToMatch]);
        float xDiff = corners[cornerToMatch].x - corners2[cornerToMatch].x;
        float yDiff = corners[cornerToMatch].y - corners2[cornerToMatch].y;
        Debug.Log(xDiff);
        Debug.Log(yDiff);
        Vector2 targetPosition = new Vector2(myTransform.anchoredPosition.x - xDiff, myTransform.anchoredPosition.y - yDiff);
        LTDescr tween = LeanTween.move(myTransform, targetPosition, moveDuration);
        tween.setEase(LeanTweenType.easeOutExpo);```
sturdy quail
#

Which anchor points? Min or Max?

primal heron
dense hornet
#

How do I add some text in that textbox in the prefab? if I add a TMP it gives me that huuuuuge canvas thats supposed to cover my screen but I just want the text to be in the little prefab and follow the prefab as it moved along. it's supposed to display the player's username

primal heron
sturdy quail
#

Ok.

rapid ferry
#

if that is the case, the only other problem that can cause it to not work is that there may be some other UI item that is blocking the button

#

try putting that button thing in the lowest of the heirarcy of the canvas, or maybe disable raycast target of all other panels that may block the button in that said canvas

restive umbra
#

so the scene is extremely basic

#

@rapid ferry

rapid ferry
#

looks alright yea

restive umbra
#

yeah, it doesn't get more basic

rapid ferry
restive umbra
#

the inspector i assume

rapid ferry
#

looks fine as well

#

but can you try chaning the render mode to camera

#

then drag your main cam

restive umbra
#

that didn't do anything

#

here is what the inspector for the play button looks like

rapid ferry
#

I tried copying the setting, works for me, probably a bug

restive umbra
#

delete the scene and try again?

rapid ferry
#

you havent tried making a new scene yet?

restive umbra
#

no, i figured it was something i was doing

rapid ferry
#

try that then

restive umbra
#

Doing that now

#

still doesn't work, I opened a different project where i had a button and it worked fine in there, same version of unity

rapid ferry
#

you have any script that interacts with buttons?

#

and even eventsystems

restive umbra
rapid ferry
#

not that, that is safe

restive umbra
#

you can see i tried to use listeners as well

#

that's all i have in this project that works with buttons

#

i did see that if you use the new input system you need to add mouse support which i did

rapid ferry
#

hmm if it is new input related, I guess I couldnt help there, but at least now you have a lead

#

try comparing the new input system on the new project you made to that project with error

#

if the new project didnt work with new input system as well, it would pinpoint the problem

restive umbra
#

yeah i have compared them already and there are no differences in the input systems

restive umbra
#

Ok for anyone who wants to know how to get this to work, you need to add "Input System UI Input Module" to the canvas object

soft sail
#

ah, right I remember I ran into that problem originally. It removes the original event system but you can use a combination of both I believe.

#

ah, rather it changes the standalone input module

vestal drift
#

Hi everybody, is there a way to have a grid layout but with elements of various width and rows of various height?

#

For example here, I'm displaying a list of jobs in a grid manner.

#

Some jobs will have a long name and other will have a short name. I'd like the jobs to stack horizontally first like normal text then stretch vertically if too many.

sinful oyster
#

Hi, how can I put a 3d mode onto a canvas? im making an player inventory and am trying to put 3d models inside of it

low pike
vestal drift
#

A row could contain two jobs with long names and another one could contain 4 jobs with short names

low pike
#

What's the problem there?

#

Also, press T and use the UI tools

vestal drift
#

The number of "cells" in each line is variable and changes dynamically

#

I'd need a way to know when the number of elements fills the row completely then add a new row

#

The menu is generated via code

#

Isn't there a way for the horizontal layout to simply wrap and extend vertically when elements reaches max width?

low pike
#

In the case you need a new row, you just add it via code.. have the horizontal layout parent as a prefab to spawn

gentle kelp
#

what are some (relatively easy) ways to add wireframe UI elements/sprites? for example, a square lock-on icon.

supple basalt
#

@queen tartan picking that up in here, it's possible that the font just has too much detail to render nicely at that small of a scale

queen tartan
#

like a "too high resolution" font kind of thing?

supple basalt
#

actually, is that font freely available? i wanted to try it myself, but I see a few different flavors of "american typewriter"

queen tartan
#

I think it is but I would have difficulties telling you were exactly we got it from (was quite a while ago :/)

#

I could send you a zip with the font directly if you want to try it out

supple basalt
#

yeah, that'd help

#

i don't think the regular "American Typewriter" font is quite what you're using

#

maybe the bold flavor

#

okay, that was the right one

#

picking SDFAA_HINTED instead of SDFAA in the Font Asset Creator might help you here

#

the bottom text's font asset was created in that mode

#

although that could just be placebo

queen tartan
#

it does look slightly better on your capture, i'm trying that right now

queen tartan
rapid ferry
#

my font alignment is really fucked, how would i go about fixing this?

#

i've got the debug tool on and i know i need to change the font settings here but i'm not sure how

timid forge
#

TextMeshPro non canvas looks like this in my case... Why does it? It looks shitty :/
If i increase the textmeshpros gameobject Y scale it looks more decent. But than i can not use it in layout groups properly anymore...

#

It just looks incredible stretched for some reason. But its scale is 1,1,1

#

So it shouldnt be stretched... any ideas?

supple basalt
#

A parent is probably scaled.

#

Check the hierarchy.

timid forge
jagged monolith
#

You shouldn't use scale at all when it comes to UI

timid forge
jagged monolith
#

Oh non canvas, sorry

timid forge
#

Yep :/

jagged monolith
#

But how are you using layout groups then

timid forge
#

On the button itself.
I wanna make that button increase its width to fit its content

#

But thats not working properly...

The backplate is a mesh. It should fit its content, the Textmeshpro.
However, the mesh uses a scale. If i remove that scale it looks shit.

The button is from MRTK3 a microsoft VR toolkit... so i do not have that much choice here

#

Isnt there a way to alter the font stretch? Than everything could stay as it is

supple basalt
#

You should not scale anything. The UI system can already handle this kind of stuff

#

For example, if you put a Content Size Fitter on the parent, it will adjust its size to fit its children

#

let me wire something up...

timid forge
#

Here an example

jagged monolith
#

This is a custom setup that is difficult for anyone else to chime in on

supple basalt
#

ah, I see

#

is this from something with documentation?

#

(i hope it is, lol)

timid forge
#

We have the damn button... its backplate is scaled. Its a mesh.
I wanna make the button as a whole fit its content (the tmp text). So it needs to be a child of the backplate (which is scaled).
Doing that works, but makes the text strecthed

supple basalt
#

also, one option would be to make the button and the text siblings

#

scale the button, don't scale the text

timid forge
timid forge
supple basalt
#

don't make the text a child of the button

#

make them siblings with a common parent

timid forge
#

Hmm... but then the button will not fit the size of the text right?

supple basalt
#

You could probably measure the size of the text and scale the button accordingly

#

that does seem a little wonky

timid forge
#

Any oder idea? :/
Its funny, i bet someone else had a similar problem. However... i can not find anything related to this topic

rough halo
#

my tmpro text isnt showing in game view, any common issues?

mortal robin
#

In scene view: select the Rect tool from the toolbox.
Double click your canvas in the hierarchy

#

Observe the rectangle of the canvas in scene view

#

and check where your text is in relation to that

#

The center of the big canvas rectangle corresponds to the center of the screen in game view

#

Likely you've positioned it waaaaaaay down in the bottom left

#

and made it tiny

#

that's what people usually do wrong.

rough halo
#

ohh okay, so instead of putting it where the main camera is, im putting it on the top right of the canvas?

mortal robin
#

Yes - screen space overlay canvases render on top of everything

#

they ignore cameras

#

they're just overlaid on the screen

#

In scene view unity draws it as 1px == 1 meter

#

so it ends up looking huge in scene view

#

If you open scene view and game view side by side you can see what it will look like in the game window

rough halo
#

okay thx, following a tutorial, but wanted to use tmpro instead bc legacy text was being weird, but encountered a bunch of other things lol

#

yeah that fixed it, thanks so much!

mortal robin
#

this is a general UI thing

rough halo
mortal robin
#

and again that has nothing to do with how UI elements are laid out on a canvas

#

legacy text will have worked the same way

gray wharf
#

Im trying to get the edge of a sliders fill rect but no matter what the slider value is at the fills AnchorPosition stays at 0,0. I assume this has to do with my anchor/pivots but I cannot move those as the slider is dependent on them to keep the fill within bounds of the background. Can anyone advise on this?

#

I mocked up what I am trying to do in below image. As the bar progresses, checkboxes appear. I wanted them to instantiate and set location to the rightmost edge of the fill rect as the slider val increases

sterile wedge
# gray wharf

is this an actual slider that you need to interact with by dragging?

#

if not, it might be easier if you just used an Image with the type set to Filled

#

slider anchor points are wonky

gray wharf
#

Unless is there something exposed where I can grab the edge of the images location?

sterile wedge
#

the anchor

#

at this point just delete the slider image and create a new image

sterile wedge
queen tartan
#

Do you know a way to change the font used in every TMP Text in the project without changing manually (scenes+prefabs)?
I tried Project settings > TMP > Default Font Asset but I think it only changes if it was on the default one before the change (which makes sense)

gray wharf
# sterile wedge the anchors of this is currently messed up

I deleted the objects and started over with just an image. I set the image type to fill. I was hoping as fill was adjusted it would change something in the rectTransform that would allow me to pinpoint the edge of the fill bar and instantiate something at it (shown in the 2nd pic).

#

2nd pic I want to grab the position at the red arrow

sterile wedge
#

alternatively you can put an empty gameobject with a recttransform that's anchored to the right side of your fill and you can get the position of that empty game object

#

do you just want to know when the fill of the bar has reached the checkmarks?

#

why not use math? i'm assuming your checkmarks are at certain percentages of your bar

#

use the fill amount/1 to get the fill percentage

gray wharf
#

Issue resolved, I was using the Rect.AnchoredPosition rather the Rect.Position. AnchoredPosition was returning 0,0 but Position was getting the values I wanted. Should've tried that first, I need to understand more wtf is going on in the canvas lol

#

pretty hacky but that is tomorrows problem, thanks

mild raptor
#

Im not sure if this falls under UI, but I'm having this weird Issue in Unity where the game scene randomly zooms in (I'm not in play mode) when I move hover my mouse around.

mortal robin
#

Check the camera orthographic size

mild raptor
rapid ferry
#

Hello there
I'm not sure if this is the right place but I have a problem with the rec transform of my image
I've set the width to 600 and wanted to stretch it to fit the screen, but when I did that it didn't stretch or do anything as shown on this image here

mortal robin
#

you've cut off a lot of important details here

#

you also seem to be using the scale tool

#

which is usually inappropriate for UI - the Rect Tool is what you want generally want to use for UI

mortal robin
#

and the hiearchy?

#

Better to just screenshot the whole screen with all this stuff at once

#

rather than piecemeal

orchid vale
#

for UI Builder, is there a way to just click and drag the UI into position?

rapid ferry
mortal robin
# rapid ferry

ok so yeah this is properly set up to stretch vertically.

#

but it will only stretch to fill its parent object

#

so you'd have to next look at the "FindRoomMenu" object

#

that is what will be determining the height here.

rapid ferry
#

so what should I do to make it stretch vertically?
cause I am very confused and I've been trying to find a fix for hours now

mortal robin
#

it will stretch vertically to fit whatever the height of FindRoomMenu is

old blaze
#

why does this not work

#

i mean that the color gets highlighted when i clikc the button/ hover over it

mortal robin
# old blaze

all of those transition colors are multiplicative

#

since your base color is black (aka 0, 0, 0) you will always just get black

#

because anything * 0 always gives you 0

old blaze
#

hm

mortal robin
#

You should instead make the base color white

old blaze
#

okay

#

thank you !

rapid ferry
old blaze
#

like this?

#

still doesnt work :/

#

maybe its good to know that i have a background image

mortal robin
#

what are you expecting to happen here?

old blaze
#

I want the button to be highlighted when i click/hover over it with my mouse

#

highlighted COlor/Pressed Color

mortal robin
#

but your colors are all very similar

#

so it might be hard to tell

#

(also make sure there's an event system in the scene)

old blaze
#

OKK

#

OHH

#

i deleted that one

#

But now it works

#

Can i theoreticly also highlight the text?

#

not a box

rapid ferry
#

How to make grid UI like this? Idk how to automate grid adjusting in runtime

rapid ferry
velvet dome
#

i've seen threads from 2014 calling out this issue where when someone has a canvas set to world space or screen space camera the UI moving with the camera is flickering and not static. some say set it to overlay but i need it to be in screen space camera because the Post Processing needs to affect the UI. Is there a way to fix this? internet cannot help me and even chatgpt is lost💀

mortal robin
velvet dome
#

i've completely turned off my postprocessing just now to try it and it still does like that

velvet dome
#

Yeah looked further in threads but nothing helped. The sad part is that this is the last 'perfection change' i need to make for my game i've been working on for the past 4 months💀 cant really release it without this being fixed.

mortal robin
#

That's your problem

#

There's no need for that

devout silo
velvet dome
velvet dome
old blaze
#

why does this button not work

#

I dont understand it, its supposed to disable a gameObject but it doesnt

sterile wedge
old blaze
#

wdyn

sterile wedge
#

and does the button get darker when you click it? like it looks clicked?

#

i dont know what you just said

old blaze
#

No it doesnt

#

i cant click it

sterile wedge
#

do you have an EventSystem in your scene

old blaze
#

Yes

#

It works on the other buttons

sterile wedge
#

is this button being blocked then?

frosty pewter
sterile wedge
#

check out that link, Zappel

old blaze
#

Its enabled

#

yes

sterile wedge
#

i think the troubleshooting overlaps part needs a picture, vertx

#

did you just skim over the bottom part, read it Zappel

old blaze
#

i red it

sterile wedge
#

did you check the Event System then

frosty pewter
#

Seems like they skimmed the whole thing as they came back saying "it's enabled" which is meaningless

sterile wedge
#

yeah, only read the raycast target part

old blaze
#

The thing is, it worked, its just a normal button like i have them all over that scene and they Work

#

just that one doesnt

sterile wedge
#

doesnt matter that it worked before

#

it doesnt work now

old blaze
#

i deleted it and recreated it

sterile wedge
#

please check the Event System

#

first 2 sentences of Troubleshooting overlaps. Read

old blaze
#

did

sterile wedge
#

ok good. you should know what you're clicking on then

#

something is blocking the button

#

there's nothing more I can say here

old blaze
#

hm

sterile wedge
#

show what your eventsystem says?

old blaze
#

wait

#

it sais nothing

frosty pewter
#

Show what you are looking at

old blaze
#

im looking at this

frosty pewter
#

that is not the preview panel of an EventSystem.

old blaze
#

idk what that is

frosty pewter
#

Maybe you should have read what we've repeatedly told you to read and you might have the slightest clue

sterile wedge
#

the next time you dont understand instructions, just say so

old blaze
#

To troubleshoot cases where other UI is blocking input, select the Event System and hover/click the UI that's failing. The preview pane2 at the bottom of the inspector should list the gameobject that received the event.

#

that is what i was doin

#

nothing happens

frosty pewter
#

Great, so where is the screenshot of your preview pane

old blaze
#

what is the preview pane

frosty pewter
#

select the Event System
The preview pane at the bottom of the inspector should list the gameobject that received the event.
Clicking the header of the preview pane expands it, and right-clicking it pops it out as a new window.

#

it's a pity I have no projects using the built-in input system, so it's hard to get a screenshot myself

old blaze
frosty pewter
old blaze
#

its blocked

#

but idk by what

#

its the only element atm and its not being recognized

sterile wedge
#

can you show your canvas object inspector as well

old blaze
#

it sais its blocked by the background

sterile wedge
#

yeah

old blaze
#

but even if i remove everything else

sterile wedge
#

show your hierarchy

old blaze
#

i cant click it

sterile wedge
old blaze
#

is it from left to right?

#

i thought it was from top to bottom

sterile wedge
#

the lowest one in the hierarchy is on top of the others

old blaze
#

OHHH

sterile wedge
#

there is no left to right in the hierarchy..

old blaze
#

okay

#

i meant putting objects in another object, then its more to the right

#

but okay

sterile wedge
#

there is no left to right

#

only children

old blaze
#

k

sterile wedge
#

anyway, that's how to see what you're clicking on. using the eventsystem. for future reference

old blaze
#

okay thank you !

#

Now it works thanks

nimble sequoia
#

Hello So I have a issue with my slider

#

How do I create a slider which would fill in that shape.

#

My best option is to make the octopus form around the default UI?

#

How Do I fix this?

#

Can I use custom UI shape?

low pike
#

Put a mask on the parent

#

also, press T to use the UI tools

fiery compass
#

user circle as shape with slicing

low pike
#

And NEVER change the UI element scale... always leave it at 1,1,1. Use height/ width to change the size

fiery compass
nimble sequoia
#

How do I stop the Slider from starting outside the bar

#

I've got it working when the bar is full

velvet dome
#

also @mortal robin thanks for helping too

timid forge
#

How do i make one element use the remaining width in an layoutgroup to fill it?

E.g. i have a toggle. Left is the toggle itself, right is the text.
I wanna use them in a hori. layout group, the toggle should be exactly 24x24 big and the text should use the remaining size.

#

Currently it looks like this... The Toggle is positioned correctly, but the text on the right does not use the remaining space correctly.
Instead i need to set it manually.

#

How do i make this work automatic?

low pike
#

put a 'layout element' component on it.. I'm not sure what settings that would need off the top of my head though

mortal robin
#

and/or you might be able to do it with min size / preferred sizes?

#

Like give the toggle a min width of 24 and then give the text a flexible width? Just play with it 😉

timid forge
#

Alright thanks! ^^ That worked

timid forge
#

I lately read that you should use multiple canvases to make UI more performant.
How would you split this ui up?

E.g. that bottom sheet contains a scrollview where i add dynamically loaded stuff like pictures or text.

How would you split that ui above in canvases? ^^

devout silo
# nimble sequoia How Do I fix this?

A trick I often use is instead of using a slider I use a standard UI image with its fill mode on fill, and the fill direction on horizontal so you dont get that weird issue where your slider stretches when its value is 0

devout silo
timid forge
#

So the whole background is basically a button, its attached to the parent.
However in fron of that stuff is a scrollview, its a child in the hierarchy.

When interacting on the scrollview it still triggers the button.
I dont want that, interacting on the scroll view should block input.

Is this possbile?

brave mist
modest vale
#

So i have four buttons on a quiz, once you press one it no longer highlights. how fix

rapid ferry
modest vale
#

thats the hierarchy for my buttons

mortal robin
modest vale
#

yeah i realised

velvet dome
#

im adjusting some ui for my game with icons in a font and in the Scene view it looks fine but in the game view the alpha is not set correctly or something

#

anyone knows how to fix that

devout nimbus
#
  • Hey, my problem is going to be rather trivial. I want my main object (the one that contains all other ui elements) to change its size to fit all of them inside. So that if a layout group enlarges after i increase spacing in it, it reflects on both the group's size and all its parents. Is this possible at all?
glacial granite
#

I currently have a sprite which is the parent for an input field game object, and I want to make both interactable. I have some code to make both objects draggeable but its stopping the input field from being of use. Does anyone know how I might use a sprite with an attached input field? the small bit of code im using to make it draggable can be shared if needed.

tidal silo
#

Hey when I have the simulator open and set to play focused, when I play in the editor the UI stretches out wider than should be. But if I play it unfocused and then manually focus the simulator, the UI proportions are correct. Is that just a thing with the simulator?

tidal silo
# glacial granite I currently have a sprite which is the parent for an input field game object, an...

I'm not sure how what it looks like you want would work - if you have an input field covering the entire object, how are you going to distinguish between a drag to select text and a drag to reposition? I don't think that is possible without another degree of freedom.

So you need a key press or right click or something to signal the kind of drag you are performing.

Once you have that, you can pretty easily write code to work around ignoring the drag and keeping the input active, or deactivating the input and doing the drag..

You only need the sprite to be draggable - I assume you have made the canvas attached to the sprite a word space canvas...

Are you working in 2D?

glacial granite
#

I figured out that once the dragging is done, I simply select the input field programmatically. It seems to work well enough

tidal silo
#

So once you drag and the input field becomes active, what happens if you click in it again to select text? It still works, or it starts dragging?

glacial granite
#

it drags, but the caret is always put to the last line when dragging stops as a second step before selecting the input field

#

you can't really highlight I guess but eh its ok

gilded path
#

Some rogue script is creating an immediate mode gui button in my scene and I can't tell which one it is.

rapid ferry
#

How to properly use this?cs ItemOptions.SetActive(true); LayoutRebuilder.ForceRebuildLayoutImmediate(ItemOptions.transform as RectTransform);Everytime I use this, I need to do thiscs ItemOptions.SetActive(true); yield return null; LayoutRebuilder.ForceRebuildLayoutImmediate(ItemOptions.transform as RectTransform)I want it to instantly update the layouts as soon as the gameobject setactives

tidal silo
# rapid ferry How to properly use this?```cs ItemOptions.SetActive(true); LayoutRebuilder.Forc...

I don't think you can - I believe the child sizes of the layout need to be recalculated and that happens, I think, in the repaint phase near the end of the entire frame loop. That's why you have to wait one from for rebuild to work properly.

Maybe you can write your own layout component and do all the calculations there - set the child sizes & positions for the next repaint... seems like it should be possible....

rapid ferry
tidal silo
#

I've done a layout component from a tutorial and customized it... it is a bit of work but not too bad.

devout nimbus
rapid ferry
devout nimbus
#
  • I set it to min size. It turns out i had to add these filters down below the hierarchy despite the warning box to make it work how i want
rapid ferry
devout nimbus
rapid ferry
#

I've got no clue how things are set up in your editor, but just this rule is enough to understand how to autohandle object resizing

indigo smelt
#

does unity support stretch resolutions?

hasty agate
#

im using the new input system with player input component, i press E to show a button and switch playerinput action map to menu controls, the event system has the e button as submit for menu controls, so opening the menu instantly submits the first selected button, how do i prevent this?

glacial granite
#

I have an inventory bar, and it has some basic functionality. The item is nested to the slot, and will re-appear in the slot when dragged away from the bar. However I want to extend this functionality to include moving to a new slot using the observer pattern. Which means using Unity Events. Thus I want to call some amount of code using events and 2d colliders as a trigger, but I can't seem to get the colliders to actually trigger, as my debug messages aren't firing.

#

I have the UI canvas set to worldspace, and the UI object is tied closely to an ingame object (its sort of point and click).

#

hence the diegetic UI

#

any thoughts?

violet arrow
#

Does anyone know where I can find spites like these to make rounded corners for ui elements that don't round every corner like the default sprite?

violet arrow
#

Any critique / suggestions for this UI layout?

long snow
#

How can i make my ui accurate to mu game's pixel per unit setting?

violet arrow
#

Why are these greyed out?

rapid ferry
#

I'm not really sure about the UI, what do y'all think?

violet arrow
#

But the main menu layout looks really nice

rapid ferry
#

and i'll look into the font size a bit, thanks!

#

that looks like this

weary flare
#

Hey, does anyone know how I can get this world space canvas to appear through other objects? It's a contextual tooltip when near interactable objects and I want it to show through environment objects so it's always visible.

rapid ferry
#

Can you use sorting layers, and put the contextual tooltip on a higher layer?

devout nimbus
#
  • I instantiate ui objects at runtime, and i want to anchor them properly relatively to their new parent. However i can't modify anchors directly because of the layout group. How else can i make an instantiated rect transform stretch with its parent?
mortal robin
devout nimbus
thin creek
#

Hey, i have a question. Is there a way to display the keybind for each gameobject that has a keybind to interact, like close to the gameobject, I wanted to use canvas world space, but i cannot have multiple canvas world space, that costs a lot of performance :/

devout nimbus
# mortal robin Set that anchor preset in the prefab

- It turns out that this exact settings is responsible for the object's flipping on instantiating. As soon as i set it back to center, the flipping problem is gone. But this doesn't let me resize the object. In case you're willing to help, what else do i need to tell/check/change? nvm, i seemingly managed to fix it

carmine vessel
#

How can i do this with my own Button. Or can someone sell me what the name used for this that i can go google

weary flare
carmine vessel
#

ok i get it

weary flare
#

Is that what you meant?

rapid ferry
# carmine vessel How can i do this with my own Button. Or can someone sell me what the name used ...

🎁 Support me and DOWNLOAD Unity project: https://www.patreon.com/posts/46642383?s=yt
SECOND PART (Button OnClick events): https://youtu.be/Ky-bzQFxV2U

This tutorial/guide will show you how to create great buttons in Unity UI (GUI) system! You will learn:

  • How to create Unity button
  • How to add rounded corners to button
  • How to create button ...
▶ Play video
#

it is in this video

sand geyser
#

how can i make something truly transparent. You can see a difference here (darker side is the object)

craggy gyro
#

the ui isnt getting bigger, how do i fix this?

obtuse needle
#

I am not a designer and when it comes to UI its ass 🤢
what are the things i need to consider to make not so ass UI?

devout nimbus
#
  • I've got a very simple hierarchy, image -> tmp text. I want this image to expand to contain the text in it. Size fitter works fine for the text, but as soon as i add this to the image, it shrinks and stays at 0 size. What did i miss?
lusty plaza
devout nimbus
#
  • Yes, that's when it shrinked. It turns out i had to add a layout group for some reason, then it worked
lusty plaza
#

Yeah, the layout group supplies information about preferred, minimum and flexible sizes of its children

dusk hearth
#

Slider UI gets more pixelated when I scale it. What can i do?

dusk hearth
lusty plaza
#

I have a menu system similar to clash royale where you can swipe between menus and also scroll down in them. But problem is the vertical scroll blocks the horizontal one, is there any way I can get callbacks (or make a scroll rect work) for both of them?

wide locust
#

Hello ! I have a scroll rect but that scrolls up or down the content only when my mouse is over a content. I wish I could scroll from anywhere on my screen.

median iris
wide locust
#

I don't think there is an option for that

#

Actually I can scroll. But only when my mouse is on a content

median iris
# wide locust I don't think there is an option for that

What I meant is, could you just make the ScrollView Fullscreen?
You can only scroll inside the ScrollViews ScrollArea afaik.
If it's not an option to make the ScrollView Fullscreen, because it would hide something else or whatever, then you'd have to manually send scroll inputs to the ScrollView if the mouse or touch is outside the ScrollArea

Oh, or, maybe, did you accidentally disable "allow raycast" on something?

wide locust
#

I've solve my problem. I needed to put an image component on my scrollArea.

frosty wharf
#

I have a question about using an empty image. Is it alright to not use a sprite for an image? will it appear as invisible on any devices, or will it continue to be a square/rectangle on any device?

glad sentinel
#

I'd like the Horizontal and Vertical buttons to take up the same/similar amount of space on the background GUI. Right now their positions get resized but not scale.

glad sentinel
#

I have brain damage

mortal robin
frosty wharf
mortal robin
#

What do you mean by that

rapid ferry
#

Why do I keep getting this warning now? I didnt have this before

#

ahh I see.. it was italic in an unedittable field and it doesnt want it, very fun...

carmine sage
#

hello. I am trying to make a UI for my 2D combat system and I have issues with the scaling of a canvas. It seems upon changing the resolution, the dialog box (a image) falls out of the canvas. What could cause this?

#

hm, I think I got it... but now the dialog box is much thicker and looks weird.

sterile wedge
#

you probably havent set the canvas to scale with screen size

#

or anchored your UI properly

carmine sage
#

This is the dialog box.

And the second image is how it looks now.

#

And yes, the asset was limited in terms of scaling (aka the boarders and the yellow are disabled from scaling)

sterile wedge
#

what is it supposed to look like?

carmine sage
#

I figured the borders wouldnt scale at all and would be almost invisible?

sterile wedge
#

you need to slice your texture

#

just watch up till the UI image part

carmine sage
sterile wedge
#

yeah but did you set the image to sliced

#

show the inspector of the image

carmine sage
sterile wedge
#

show how you sliced the image

#

and then show the inspector of the image

sterile wedge
#

the inspector of the image

#

not the texture

#

the one in your scene

carmine sage
sterile wedge
#

How to effectively scale your UI's for different resolutions in Unity, using canvas scaling. We'll look at what you must look out for and how to overcome some of these issues in your Unity UI's.

🎁 Get OVER 160+ Scripts, Projects and premium content on my PATREON HERE:
➡️http://bit.ly/SpeedTutorPatreon

········································...

▶ Play video
#

you might have not set the canvas to scale with screen size yet

#

check either one of those

carmine sage
sterile wedge
#

means you didnt anchor your image properly?

#

you should anchor it to the bottom it seems

carmine sage
sterile wedge
#

that's up to you to figure out

carmine sage
sterile wedge
#

how you set the anchoring and stretching of your image defines how it reacts to the canvas being scaled

carmine sage
#

(the canvas)

maiden iron
#

hi

#

I'm new here

sterile wedge
maiden iron
#

No you don't need to

weary flare
#

I'm still having trouble getting this world space canvas to show through 3d world space objects. Sorting layer doesn't seem to do anything. I guess as the canvas is in world space.

jagged monolith
weary flare
weary flare
#

Posted code adjustment to work with TMP on that forum post.

exotic depot
#

Does anyone else feel overwhelmed when trying to do UI? Every chunk of text being a gameobject with several options in the inspector that need to be lined up manually. So many variables makes consistency sound like a pipe dream. I'm much more comfortable working in code, which makes GUI.Label look appealing. But people seem to hate working with that. And I would be giving up any easy way to do 3d effects on the letters. How do you all maintain consistency and keep the project and scene from getting out of control?

rapid ferry
#

how do people make UI look so nice without having custom made sprites?

mortal robin
mortal robin
rapid ferry
#

ive seen some very nice UI with out art and uitk then i look at mine and think what in the abomination have i just made 😂

proud sandal
wind wagon
#

looking at something that seems to be a TextMeshPro bug, idk if anyone's had this

#

I can't change the material preset on a TextMeshProUGUI in the inspector; it shows a list of presets in the dropdown, but when I click one the value doesn't actually change (or possibly it changes back immediately)

#

This only happens with TextMeshProUGUI and it seems to be happening regardless of the font or materials in use. World-space TextMeshPros behave normally

vagrant isle
#

Need a little help with something. Is there any way I can make it so when the text is on the white, it displays as transparent, while also being white when it's not over anything? I'm not sure if I need a shader to accomplish this or some sort of trick?

#

Right now, "HEALTH" is just black to kinda hint at what I'm going at

vagrant isle
#

This is what I'd like to achieve

sterile wedge
vagrant isle
#

But I'd like to make it the background because the background does change

sterile wedge
#

What?

#

You're going to need to elaborate

vagrant isle
#

Well, my goal here is to make it transparent so that the background color shows through the text. None of my background will be near white, but, if I do the approach you said, it'd be a different color than the scene

sterile wedge
#

So the text won't necessarily be purple

vagrant isle
#

Correct

sterile wedge
#

It'll be easier if you just set the color of the text to match the background then, in code

#

The background could be white, and you tint it in code

#

But I only suggest this because I don't know how to write shaders

#

And it seems to make more sense to me to do this rather than wait for a magic shader that will solve everything

vagrant isle
#

I'll think about it

sterile wedge
#

Okay. I suggest you consider thinking of it in another way besides it being "transparent"

sweet stag
#

Are you using a slider for this? Or an image? Or something else? Do you have the transparent "text hole" working by itself (without the white text)? And does the text need to be dynamic, or will it always say "HEALTH"?

minor zenith
#

Hoping this is the right channel for this.

I was hoping I could get some advice on how I should go about creating a UI in Unity with 3D models? I know this might sound strange but I'm working on a Uni assignment where we have to make a functional prototype UI and my theme over the entire assignment has been very tactile and diegetic ui.

The idea is like an industrial sci-fi computer panel that is controlled with tactile buttons and levers. Similar to like 60's control panels. I've attached a couple of high-fi wire frames I did up while concepting but these are by no means reflections of my final vision, just limited by my artistic skill.

I'm by no means a traditional artist but I am a 3D artist so I'm hoping I can avoid doing UI art and instead make 3D models for this UI because 1. I can do it much faster, and 2. I feel it would fit the theme much better.
I want to create all the elements of UI in 3D, so 3D levers, buttons, etc.

If anyone could please give me some advice on how I should approach this or link me to a tutorial or article that could be helpful I'd be extremely appreciative.

sterile wedge
minor zenith
sterile wedge
#

It's not really any different from moving objects around and making stuff happen when those objects reach a certain state

#

Not sure what you're concerned about

#

Like what are you worried about? How to make text appear on a 3D model? How to make levers?

minor zenith
#

I just wasn't sure if using 3D models on a UI canvas was something you can easily do in Unity.
So it's basically done the exact same way as traditional 2D ui but with 3D elements instead? There's no extra steps I should be worried about when it comes to implementing the elements?

vagrant isle
sterile wedge
#

Just because it's UI doesn't mean you have to use canvas

#

You're stuck on that thinking

#

It's just objects in the scene

minor zenith
#

Ohh okay

#

Okay cool

#

Thank you for explaining that to me, I didn't realize

sweet stag
# vagrant isle Using a slider. The second screenshot is a mockup of what I want I did in photos...

I was thinking maybe creating two images with transparency the width of your slider. One a white rectangle with the word "HEALTH" transparently cut out of it, the other inverse with "HEALTH" white and the rest transparent. Make them sprites and add them to the Fill and the Background of the slider respectively. Make the Image Type of the Fill Horizontal. Except... The Background blocks the transparency. Looks like you'd need to make the background fully transparent or disable it for the other to be transparent. And then maybe add a similar right to left slider with the other image, place it behind, and tie the two values with code? And this doesn't allow for the dynamic text on the right.
If the user doesn't need to slide the percentage but you are doing that in code, you might be able to do something with masking instead? https://learn.unity.com/tutorial/ui-masking#
I don't know. New territory for me.

thick sundial
#

So I have multiple nested Vertical Layout groups and I'm having issues in getting them to scale dynamically as I add more elements.
The content size fitter doesn't seem to like it when the parent is a layout group.
But I have no idea how to dynamically get the size to change otherwise.
Any tips?

sterile wedge
thick sundial
#

@sterile wedge

sterile wedge
#

put a content size fitter on the object that is meant to stretch, and set the direction you want to be dynamic to preferred'

thick sundial
sterile wedge
#

ignore the warning

thick sundial
#

it's not working

sterile wedge
#

what do you want to expand

thick sundial
#

I want the contents of "Sub Group" to be ordered in the top level Vertical Layout Group "bars". I want the whole structure to dynamically size itself correctly when I add new elements to any vertical layout group.

sterile wedge
#

so then why is it a child of GFAP

thick sundial
#

If I unparent it, then add a content size filter it to (and set it to vertical = preferred size) then I get a warning but it does sort of order itself

#

but when I add new elements it doesn't update the size

#

Actually it's even worse in playmode.

#

Added and removing elements just completely messes it up.

#

So I assume the warning is there for a reason.

sterile wedge
#

nah, the warning means nothing

#

try ticking the child force expand options

#

it's hard to help because your setup is complex, and i cant tell what is what

#

a video might help

thick sundial
#

I want to do this

#

So how new elements come in and the others shift down?

sterile wedge
#

that seems like exactly what you want

thick sundial
#

I'll give this a watch, thanks.

thick sundial
#

Fuck the warning I guess >_>

sterile wedge
#

you're welcome

sterile wedge
#

but only for this UI case

thick sundial
#

Unity's UI is super solid in some cases

#

and super not solid in others

sterile wedge
#

yeah, but I suppose it's difficult to cater for every case

#

since UI can be done many different ways

#

glad you got it sorted

thick sundial
#

Not sure how I'd animate this really. I guess it would have to be a more manual process.

#

Calculating the total height and then tweening the size directly.

sterile wedge
#

yeah, use DOTween if you don't already do

thick sundial
#

I do

#

pog plugin

#

I don't really start a Unity project without importing DoTween and Odin Inspector

thick sundial
#

Is the new UI Toolkit any better or nah?

sterile wedge
#

no idea. havent used it because it's not in full release yet

wind wagon
slate sluice
#

Is there any way to extend the size of a Content Object in a Scroll Rect to the right and prevent the Content of centering????

#

I want to put the squere (content) left vorder with the scroll rect left border and foreach prefab I create, expand it to the right

sterile wedge
#

or a grid layout group

#

grid would be easier if you want it to not center. I think you can align to the left

slate sluice
#

But the scroll rect is centering the content. Anyways I'll try later bc Im in school rn

#

Thx

thick sundial
#

What's the code equivalent to moving these Rect tool gizmos to the right?

#

I do want to reduce the width, but specifically by moving the left anchors (or whatever they're called)

stone flint
#

Hey everyone 🙂
I have a noobish question 😄
On these pictures theres a sprite below three buttons which are supposed to be on a specific position in regards to the sprite (picture 1)
However ive been playing around with the UI Scale Mode and whenever i change the screen size in the editor neither option seems to work with my set up/ how i want it to look
am i looking at the wrong UI options?

strange otter
#

Hello

#

I'm trying to do a clicker game and added a button that changes the text in a counter on screen, but when I press play, the text doesn't appear on screen. I checked and the layer my TMP text is on is visible. I'm a beginner, can someone help please?

sterile wedge
strange otter
#

Sorry for the late response @sterile wedge, it isn't I put a number there so I can see if the text is displayed and it's not

sterile wedge
strange otter
sterile wedge
strange otter
#

ahhhh

#

got it

sterile wedge
#

is this a screen space canvas?

#

or world space

strange otter
#

screen space

sterile wedge
#

your text is waaay too small

#

size 1? the height and width is too small too

strange otter
#

should I upsize everything?

sterile wedge
#

if someone tells you something is too small, what do you think you should do

strange otter
#

ok thanks

sterile wedge
# stone flint Hey everyone 🙂 I have a noobish question 😄 On these pictures theres a sprite b...

This tutorial/guide will show you how to resize your Unity UI canvas, GameObjects, text, button and images. You will learn:

  • How to fix Unity UI for every resolution
  • How to adapt UI for mobile devices
  • How to change Unity UI canvas scaling

💜 Join our Discord: https://discord.gg/hNnZRnqf4s

Timestamps:
0:00 - Intro
0:20 - Fixing main UI
3:23...

▶ Play video
strange otter
#

Idk what I did wrong

sterile wedge
#

show me the inspector in play mode again

#

and in playmode, double click the text in the hierarchy, and show me what you see in the scene

strange otter
#

inspector in playmode

sterile wedge
#

are you setting the size in code

#

in play mode, set the font size to 28, and the width and height to 500

#

then show me your scene

strange otter
#

ok

#

ok that worked

strange otter
sterile wedge
sterile wedge
strange otter
exotic depot
#

I'm using IMGUI and I want to put it on a render texture. Is there a way to do that? I'm having trouble figuring out if it is possible.

exotic depot
#

That or I need to be able to do Graphics.DrawTextureWithCoordinates(). But for some reason that function only exists in IMGUI.

mortal robin
#

UI elements?

#

Sure - render them with a camera (screen space - camera canvas) and render that camera to a render texture

exotic depot
# mortal robin you want to put _what_ on a render texture?

I'm rendering my GUI with immediate mode GUI in OnGUI, not with UGUI elements. The specific element in question is a 9-sliced sprite. Things rendered with the Graphics class can be sent to a specified render target. So I was trying to find a way to edit my 9-sliced sprite function to be able to render it on a render texture.

However I just reread the Graphics.DrawTexture docs again after getting some food and it does have a parameter for texture coordinates after all. It just called it something else. Problem solved.

lavish tapir
#

because my Plinko balls are below my ballspawner, i expect the balls to spawn behind my pipe but they dont as seen on this screenshot, any ideas on what to look for?

#

The ballspawner has a script that spawns them and sets the PlinkoBalls as its parent

#
    public void spawn_ball()
    {

        GameObject b = Instantiate(ball, transform.position, transform.rotation);
        b.transform.parent = plinko_balls_transform.transform;
    }
lavish tapir
#

nvm, the awnser was sorting layers

errant brook
#

This might be a stupid question, but how do you set an animation to not play when it starts even if it is the default state? Up until now I've just been creating an animation with nothing in it and setting that to the default state but there must be a better way to do this right?

errant brook
#

Tyyyy so much <33

rustic parrot
#

why i cant change the size of the canvas

lavish tapir
rustic parrot
lavish tapir
#

in the canvas component u have render-mode set to - Overlay which i believe sets it to that value

#

i personally prefer to match it to camera and attach ur main camera to it

rustic parrot
lavish tapir
#

It kinda depends on what ur goals are

#

what are you trying to accomplish ?

#

FYI, if u set it to world space, then u can move it around

rustic parrot
#

when player dies i want to show a text press any button to spawn again

rustic parrot
lavish tapir
#

2d game ?

rustic parrot
#

yes

lavish tapir
#

what is the sorting layer of that blue stuff ?

rustic parrot
#

map

lavish tapir
#

u created an extra sorting layer for that ?

rustic parrot
#

.

lavish tapir
#

If u change the the bottom layer to something like Popup overlay

#

and assign that layer to the canvas

#

it should be on top

rustic parrot
lavish tapir
#

yeah if you use all of those

#

I have created a sorting layer UI which always is above everything else

rustic parrot
lavish tapir
#

it needs to be at the bottom

#

u can use that = left to 'Layer 1' to move it

rustic parrot
#

so the bottom layers is the top layer?

lavish tapir
#

yes

#

which is kindof confusing

rustic parrot
#

😄

lavish tapir
#

that works ?

rustic parrot
#

it took me two days to figure it out

lavish tapir
#

rofl

#

i didnt know about sorting layers untill today

rustic parrot
#

yes

lavish tapir
#

so i was trying to make this work using layers and the hierachy

lavish tapir
rustic parrot
#

well ty

lavish tapir
#

np mate!

hallow lodge
#

hey guys, is there anyway to have a stationary text box or image that rotates based on with the player is so the player can always see the front of the text/image

near kraken
#

Hey there I'm having a problem where my water shader overlays the TMP text and I was wondering how I could make it so that the text renders above the water but other objects can still cover it.

hallow lodge
hallow lodge
#

i did it

#

how do I make it so when a audio clip is played, people nearby can hear it. but the farther they go away from the sound, the less they hear it, until once they are far enough, they cant hear it

mortal robin
#

Check the 3d sound settings on the audio source

hallow lodge
#

i did it

#

im doing mobile controls r

#

rn

tawdry ferry
#

how to make this Panel be same with backgroud (not black one) when changing the screen size?

sterile wedge
# tawdry ferry how to make this Panel be same with backgroud (not black one) when changing the ...

This tutorial/guide will show you how to resize your Unity UI canvas, GameObjects, text, button and images. You will learn:

  • How to fix Unity UI for every resolution
  • How to adapt UI for mobile devices
  • How to change Unity UI canvas scaling

💜 Join our Discord: https://discord.gg/hNnZRnqf4s

Timestamps:
0:00 - Intro
0:20 - Fixing main UI
3:23...

▶ Play video
tawdry ferry
#

I think I should make the background UI too

tawdry ferry
#

everything works perfect in "Free Aspect", but not in 16:9. Is it ok?

sterile wedge
#

means you didn't anchor it properly to stretch

#

or you didnt set the canvas scaler to match screen size?

tawdry ferry
#

oh, I see the problem now, thank you

short fox
#

I cannot work out why my particles are not visible in game view, they are set to loop but only become visible when I am close to them in scene view. Do particles not work in UI on canvases? I am using 3D URP and cinemachine for my camera

humble bluff
#

How can i make a slider non--dragable

rapid ferry
polar pivot
#

anyone knows where i can find all sorts of cool ui parts, like health bars, stamina bars, menus and such?

sterile wedge
polar pivot
#

k thx

rapid ferry
#

anyone know why the button on the right is being clicked and not the one im trying to click?

tawdry ferry
rapid ferry
tawdry ferry
rapid ferry
#

yup yup 😄

polar pivot
#

why for a image canvas it doesn't let me to put as the sprite a png i got in the assets?

rapid ferry
#

texture type needs to be Sprite 2D and UI

polar pivot
#

i didn't

#

i banged my head 1 hour for this xd

rapid ferry
#

xDDD np dude 😄

marsh escarp
#

i started using the pixel perfect camera for my rpg game because i want it to be pixel perfect, this however means cropping the screen. i am fine with the cropping but was wondering if it was possible to somehow put a backgroudn image behind it to fill it with something.

what i have tried so far was adding another canvas that won't be scaled to the camera, however then that canvas will cover everything because i can't figure how to change the "order in layer" of a "screen space - overlay" canvas

many thanks!

small grove
tame elk
#

how can i recreate this in unity the ball covers up some of the ui

marsh escarp
small grove
tame elk
#

oh that makes sense

fossil prism
#

Guys Why is the Scroll Rect so trash ? ?

#

(╯°□°)╯︵ ┻━┻

small grove
tawdry ferry
#

does somebody know what's that?

fossil prism
#

Text doesn't scroll if it's a certain length

#

it just snaps back

small grove
#

oh

fossil prism
small grove
#

wait, does it not fit the whole text?

fossil prism
#

the only way around it rn I found is not to make the text a whole TextMeshProUI and have to instead use LayoutGroup

#

then Stack individual texts objects

small grove
#

try content size fitter

fossil prism
#

Yeah I did that it didn't work

small grove
#

0_o

#

did you make the rect transform of the text the actual size of the text?

fossil prism
#

it works if the legnth is like that

#

but obviously don't want extra space

small grove
#

yeah that's quite odd

fossil prism
#

I could probably script it so it might shift sizes of rect transforms but I shouldn't have to do that if unity provided good UI tools

#

gotta look into UIToolkit and see if the alt exists..

small grove
#

yeah, that's true

#

which ver of unity are you in?

fossil prism
#

2021.3.14f

small grove
#

yeah that's lts, I found that 2022 has a much better ui implementation but idk if they fixed that

tawdry ferry
small grove
somber sundial
#

wondering if anyone can help me i want to display a live 3D URP scene on my UI and i was wondering how i would do it as there is no target texture variable on cameras in 3D URP

buoyant hull
#

canvas help needed. I have a canvas utilizing screen space - camera, and I can't seem to get the canvas to match the camera size at a certain distance. here are some of my settings:

mortal robin
buoyant hull
mortal robin
#

Perhaps you are confusing the canvas itself with some UI elements inside the canvas?

tawdry ferry
small grove
tawdry ferry
#

quite strange and not really convenient though

small grove
#

I mean it kinda makes sense

tawdry ferry
small grove
#

surprised that there is no layer field

small grove
# tawdry ferry not really

I mean a renderer.can't know what's in front and what's not, it just renders in a certain order if I am not wrong

tawdry ferry
#

yeah, that's strange. They should be ordered by distance from camera I guess. It would be easier then

small grove
#

layering is the thing that forces is to well override/not override some pixels

#

don't take what I said here for granted because I have no knowledge about it whatsoever

small grove
#

this is just something that somewhat made sense to me and allows me to work with UI.
If I am incorrect feel free to correct me

tawdry ferry
#

so the StopPanel is nearer to camera (Z pos)

#

and if I change something there, It gonna break the game

#

how disappointing 🙄

small grove
#

yeah, I think there is a component that allows you to force order things or something but I really can't remember what the name was

small grove
# tawdry ferry how disappointing 🙄
you add the canvas component to the same object as your image. Then change the sorting order of the added canvas. Basically you are using the canvas component just to add sorting functionality, but it will change nothing else

Source:
https://forum.unity.com/threads/ui-image-sorting-layer.470896/

#

this is a valid workaround

#

everybody in the comments seemed to like it and there were no complaints

tawdry ferry
#

so you need to add your own sorting layer, actually

small grove
#

no

small grove
tawdry ferry
#

specially for canvas ??

tawdry ferry
small grove
#

smaller the more it is pushed back

tawdry ferry
#

I cannot change the order lawyer of other UI Components in this way

small grove
tawdry ferry
#

oh

#

I see

#

this Canvas is different

small grove
#

you don't need it on every component, just the parent panel I think

tawdry ferry
#

you add the canvas component to the same object as your image

small grove
#

then if an object disappears, change it's order layer to the canvas it is a child of's order in layer, it being a child will rake care of the rendering priority then

small grove
#

you are having issues sorting a panel, not because the panel is not being sorted but because it's image isn't being sorted

#

if you click on the panel you'll notice that it has an image component attached to it

small grove
#

so, what I'd try is having a canvas on the panel and then setting every single one of it's child objects's order in layer to the same order layer as said canvas

tawdry ferry
#

so that's the thing that should be changed

small grove
#

if the component on a child object contains the said function ofc

small grove
tawdry ferry
small grove
#

even tho this workaround would work, I highly advise you to structure your ui in a proper way because it's waay less likely to cause issues in the long run.

tawdry ferry
#

working in inspector can be sometimes even more challenging than writing the scripts

small grove
onyx ruin
#

my UI and button becomes invisible in the game view, though the text does not

sterile wedge
buoyant hull
near kraken
#

Well, there is a way! For anyone else who has this problem you can change the sorting order of the text, I'm not sure how this works with code since I'm using Visual Scripting, but that would be the way to do it.

mortal robin
#

you just need to set the rect transform anchor preset to full stretch

buoyant hull
normal hollow
#

Hi,

I need some help about UI.
The first screenshot is the desired layout.
But when I change the resolution (2nd and 3rd screenshot), the layout is broken.
The TMP have auto size font. I left all the other settings at default.

Help please!

mortal robin
normal hollow
buoyant hull
mortal robin
#

it's the children of the canvas (your UI elements)

buoyant hull
mortal robin
#

as the canvas will be the size of the camera

#

can you show some screenshots of how your stuff is set up

#

what you're explaining doesn't make sense

#

show the canvas, the UI elements, the hierarchy, the inspectors, etc/.

buoyant hull
mortal robin
#

make it scale with screen size

buoyant hull
mortal robin
buoyant hull
mortal robin
#

e.g. the panel to start

#

also why is the canvas a child of the camera / player? That's generally not a good idea - it may be getting scaled by that too,

buoyant hull
#

well i dont have too much of an issue with the canvas elements. they appear to fit the canvas no problem as seen here. but the canvas appears to be the thing that is too small. my canvas isn't a child of the camera, just a gameObject I call cameraspot.

#

it is however a child of the player, which I was under the impression I would need since its a multiplayer game and when the player gets instantiated, each player needs their own camera

mortal robin
#

my guess is it's getting scaled because you made it a child of the player

buoyant hull
#

it is

#

lol

#

0.5

#

@mortal robin is the GOAT

#

any tips on making a 'screen space - camera' camera show the canvas over everything else?

mortal robin
buoyant hull
#

gotcha. thats what i figured. i usually see overlay used in that context. just wasnt workin correctly for me with photon pun2 but imma just reduce the plane distance

rapid ferry
#

any reason why my text is appearing not crisp? im using textmesh pro however the edges are just well kinda disgusting

#

like this

marsh escarp
#

not sure if this is ui-ux but how does anyone know how games like undertale get fullscreen working without weird stretching even though they are always at 640x480 just scaled up?

marsh escarp
#

but because it's pixel art it will get some weird stretching

#

one "pixel" may be 3 pixels wide and another 2

#

huh may just be a coincidence that 320x240 scales nicely to exactly fit some monitors height

#

does that for mine at least when i build and run

naive dune
#

How can I get the Source Image from a Image component in parent, then copy it to the current object Image component's Source Image (with script only)

sterile wedge
naive dune
# sterile wedge do you know how to do the first part?

I'm trying this
`
private Image _copyFrom;
private Image _target;
private Sprite _mySprite;

void Start()
{
    _copyFrom = GetComponentInParent<Image>();
    _target = GetComponent<Image>();
    _mySprite = _copyFrom.sprite;
    _target.sprite = _mySprite;
}

`

sterile wedge
#

nothing wrong with that

naive dune
sterile wedge
#

also are you getting any errors?

naive dune
naive dune
sterile wedge
#

before playmode

#

and after playmode

naive dune
naive dune
sterile wedge
#

can you put a Debug.Log inside the Start and tell me if it prints?

sterile wedge
#

please Debug.Log _copyFrom, _target, _mySprite and _target

#

then show me your console

#

all inside the Start method

#

what you can try is instead of using GetComponentInParent, directly reference the QuestPanel Image by assigning in the inspector

naive dune
#

Solved, thank you.

`private Image _copyFrom;
private Image _target;
private Sprite _mySprite;

void Start()
{
    Debug.Log("Hi");

    _copyFrom = transform.parent.GetComponent<Image>();
    _target = GetComponent<Image>();
    _mySprite = _copyFrom.sprite;
    _target.sprite = _mySprite;
}`
#

The problem was that GetComponentInParent tries to find the <Image> component on the current object before moving on to the parent, for reasons unknown.

naive dune
#

Things need to be decoupled

loud egret
#

hi my UI didnt render when using anti aliasing (World space UI for VR in URP), but when i turn it off the UI did render, does anybody know how to fix this (untiy 2020.3.3 LTS)

winged onyx
#

hi, would anyone spare 5 mins to help me with my buttons? its 1 simple error i couldnt solve

rustic moat
#

unity, why is my content in viewport in scroll view not scrolling all the way down

tiny topaz
#

Why does the grid not work in 2d on ui

#

im trying to make my ui like simetric and nice looking for android map but everything is activated yet it still doesnt work

lusty plaza
lusty plaza
#

...
Will disabling the canvas raycaster on an already disabled canvas improve performance?

sterile wedge
small grove
brazen sphinx
#

I tried myself but since it s using an

rapid ferry
#

I have a canvas that has this Image as a shader material but when I hit play its visible until it loads properly and then it disappears?

#

can someone please help im confused

#

its still visible in the game scene when running

low pike
#

show a video of the issue

#

Is it actually UI?

rapid ferry
#

its weird cuz it only has this issue with this material, like other stuff works fine

low pike
#

It helps to record the entire screen, not a snippet.. you're cutting off information that could be useful

rapid ferry
#

alright 1 sec

#

what do you want to see

low pike
#

Entire Unity window, with this image selected, so it's visible in the inspector

rapid ferry
#

gotcha, 1 sec then ^^

#

is this better?

#

thats the same vid pft 1 sec

#

@low pike here lol uploaded last one

low pike
#

side issue - keep UI at a scale of 1,1,1 - You'll run into weird things If you don't

#

Select the camera, show me a screenshot of the inspector

rapid ferry
#

also did the other thing :))

low pike
#

you have lots of things on the camera minimised..

#

look under Rendering -> Culling Mask

rapid ferry
#

it's set to everything

#

weird thing is that i used to not have this issue, idk what changed

low pike
#

change the material back to a default one

#

if that shows up, it's a shader issue which I can't help with and you'll need to ask in #archived-shaders

rapid ferry
#

yeah if its an empty Image or such it'll show

#

alright thanks for your help

#

it works if its a normal image

tiny topaz
#

Im using neither, im using the built in grid snap thingy in unity but it doesnt work

tiny glacier
#

how do i change the color of a single letter in my non text mesh pro text object through code

stiff lance
#

I'm using text meshPro and i got this weird bug that I don't understand, so basically I'm cloning an object, and when the cloned object is spawned the text is behind the bubble in my game view, but works completly fine in the scene view
scene view:

#

Game view:

small grove
stiff lance
#

This is the object I'm cloning:

#

And it works fine in the game view

small grove
#

not sure you understood what I meant, in the hierarchy(all the way left by default), try reordering the 2 objects

#

if it's a prefab then do that inside of a prefab

stiff lance
#

Like this?

small grove
#

yeah, see if that changed anything although I think it won't work now that I am seeing the hieradchy

stiff lance
#

No it works sometimes?

#

lmao

small grove
#

ok, can you select the empty ones while the game is running and show me the inspector of the text

stiff lance
#

yes 2 sec

small grove
#

that one doesn't display the the text?

stiff lance
#

Only the right side of the screen works

stiff lance
small grove
#

that's quite odd but there most likely is a good reason for it

stiff lance
small grove
#

I am not on my pc now and I've never encountered such an issue, I expected it to be something simple such as ordering it in hierarchy

#

I recommend you wait for somebody with more experience to take a look at this instead of me wasting you time

stiff lance
#

Lol

#

Thank you tho

#

I appreciate it

#

If I move the Camera the text appear, so only the right side of the camera works

#

I made it work

#

I changed the camera from perspective to

small grove
stiff lance
#

Aight I'll try some different things with camera then

nimble orbit
#

Performance question...

I have a terminal window that can have any number of rows and columns. Let's say it has 132 columns and 43 rows. I use TextMeshPro to render the text of the terminal.

Since it's a terminal, any cell in any row can change at any time. The text needs to be updated to reflect that.

I could have one giant TextMeshPro text object for the terminal's entire screen, or I could have one for each row inside a VerticalLayoutGroup. Which is faster?

#

With the first approach, the entire text mesh for the entire screen would need to be updated even though only one character has changed. With the second approach, only the mesh for a single row needs to be updated when a character on that row changes, but then I'm relying on auto layout to stack each row vertically...so there's an autolayout pass involved.

tiny topaz
#

Is ui tool kit used to like, actually align stuff in your app? I feel like it might be too much for a first app

#

My friend told me to use vertial layout groups, and it kinda destroyed my whole ui but i finally fixed it... i just feel like im doing it all wrong

spice grotto
tiny topaz
#

The item is like a button, an image and a text under

#

Ui is really slowing me down tho, ive done nothing productive it feels like

gaunt lake
#

How can I make the Purple Outline on this text include the red underlay?

#

I'm using Text Mesh Pro

fiery lance
# gaunt lake

I believe that isn't possible in unity the way you described.. I'd just go into some photo editing software and make that text there

gaunt lake
#

i've seen it done many times before

fiery lance
#

But have they used tmpro as well? Or went into a photo editing software

gaunt lake
#

it's done within unity

#

right here

#

see

fiery lance
#

Hmm, no clue how that could be done

fiery lance
# gaunt lake

I think that could be achieved by just doing the text as normal, then copy-pasting it and making the clone completely black (or whatever outline color you want). Then you put that new clone behind the underlined text and just scale it up until it looks good.

This is a cumbersome way though, and long sentences would probably take quite a long time to do that for

gaunt lake
#

yeah I want it to be on one text component

fiery lance
#

Then I think you're out of luck, atleast from me

low pike
#

It's probably a custom implementation, not possible with TMP by default

gaunt lake
#

or is it possible to edit the tmp shader

low pike
#

If it were me, I'd be on the asset store looking for something that does it

gaunt lake
#

ok

unreal marsh
#

I am using URP and camera stacking (main camera on picture 2). but the buttons on my canvas (picture 1) are not functioning properly anymore (video, only when the button is lighting up black it is registering the mouse).
Does anyone have an idea what could be going on? I'd be greatful for any kind of hint.

ashen robin
#

does anyone know how to fix this? im unity 2023 btw

mental monolith
#

how would I go about making custom button hitboxes?

#

say I have a skewed rectangle shaped button

mortal robin
#

(e.g. the parts of the image outside the button are transparent)

indigo robin
#

How could I have a vector image background

mortal robin
#

or use a shader

clear forge
#

Does anyone have any experience using noesis gui? Any thoughts or opinions on the workflow?

ashen robin
#

does anyone know how to fix this my dropdowns wont close and my slider is doing whatever that is

rigid prawn
#

Just checking but is there any need to generate mipmaps for images for UI that's just overlayed on the camera?
You'd only want it for world space stuff I'd guess?

mortal robin
ashen robin
hexed pulsar
#

anyone have tutorial with pooling scrollview elements? aka have only 10 enabled at time even if there are 1000 elements in list.