#πŸ“²β”ƒui-ux

1 messages Β· Page 14 of 1

sterile wedge
#

Glad it worked!

low pike
#

For the image, what value are you changing? And what are you setting it to?

quasi parcel
low pike
#

Right, so the β€œvalue” is the sprite field on the image?

#

The sprite just looks the same and the only difference in the 2 is the position. So.. just use 1 sprite and animate the pos

quasi parcel
#

right but its easier to do with an animation. So youre saying I can't animate an image with the animator window, because its hard to find an answer on this.

low pike
#

You can animate the position..

quasi parcel
#

im aware but id have to set up a tween path with proper speeds

#

seems like a pain and I would want to be able to animate UI anyway when later a sprite might change in its animation

low pike
hallow quiver
#

how do you use a camera to render background without it being the base camera? (URP)

low pike
mortal robin
craggy fiber
#

My UI has begun to break in all my games after updating to unity 2022
Any idea how to fix it?

low pike
#

2022.3.4? or lower? It helps to be specific...

craggy fiber
low pike
#

It's a bug, which was fixed in 2022.3.5

craggy fiber
#

Ah... Will this issue be forever?

#

(will updating fix the ui)

low pike
craggy fiber
low pike
craggy fiber
#

Why is unity lying to me...

low pike
#

I've no idea where you're looking, but it's available through the hub, where you should be looking..

low pike
#

Don't use that Β―_(ツ)_/Β―

craggy fiber
#

Alright

low pike
#

You install new versions through the hub, then set the project to open in whichever version you want it to

craggy fiber
#

Ok

quasi parcel
#

ty for the help so far btw lol

low pike
#

I'd do it with code

vivid quest
slim hatch
#

How can I set my Canvas up so that I can adjust the opacity of the Inventory Screen object, and its opacity will effect the opacity of all its children?

#

GOT IT!

#

Nevermind my question

#

Canvas Groups exist

honest saffron
#

Has nobody really had this problem? (OnEndDrag being inconsistent - sometimes not called at all when a drag is ended)

quasi parcel
#

how do you animate UI Images with different sprites? I cant seem to find a clear answer on this

#

not just tween movement but the sprite actually changes

mortal robin
#

same way you do it with a sprite renderer

#

that was supposed to link to the "creating keyframe animation" section

quasi parcel
#

i tried that and it didnt work, ill try again

mortal robin
#

so scroll up to that πŸ˜†

#

possibly, depending on your assets and your game's needs

quasi parcel
# mortal robin You can set the sprite as a keyframe in the animator

so I have a little hand cursor that doesnt actually change the sprite it just moves 1 pixel over, for 2 frames and resets. But it wont animate the single pixel move over. (I know I could animate the movement with unity animation properties but I want the movement i specified in the animation)

#

why cant it simulate when my sprite moves

mortal robin
#

are the two sprites actually any different?

quasi parcel
#

yeah they are 1 pixel over here ill send a video

mortal robin
#

Are the pivots correct?

#

they look the same in the dopesheet

quasi parcel
#

it works normally just not when i put this animation on an image

quasi parcel
#

I would just do screen space camera

quasi parcel
reef hill
#

Hey any thoughts on why this sprite is rendering oddly on the screen? Is it being cut correctly?

sterile wedge
reef hill
#

Ok thank you!

reef hill
sterile wedge
#

Just slice according to your texture

reef hill
low pike
#

because the curve ends in the middle of the sprite

reef hill
quasi parcel
mortal robin
low pike
# quasi parcel

I dunno how sprite renderes work, in regards to pivots. But the UI won't use the pivot you set in that, so they're all just going to be in the same position in UI.

quasi parcel
#

Ok ty

#

Thats weird

low pike
#

it's not

#

UI elements have their own pivot, that's what would be expected to be used for alignment

quasi parcel
#

so if I added empty space on the left of the cursor sprite I could simulate the movement i think

turbid plume
#

When I switch menu screens, all buttons are highlighted and dropdowns are...dropped down. It's like everything is selected all at once. Why?

#

I just activate and deactivate different screens (such as images with children on the same canvas or different canvas alltogether - same behavior)

mortal robin
#

you want to change it to whatever it needs to be to make it the desired size in the game world

#

let's say it's a 64x64 image. If you want the character to be 1x1 in the game world you'll want PPU of 64

quasi parcel
elder tangle
#

Hey there people! just wanted to ask if anyone had any idea how to make a UI button do an anmation whenever we mouse hover over it?
i know there is the option to setup button transitions to animations but i basically want them to keep the color tint options on top of having a little animation for the button when you hover over it with the cursor

sterile wedge
mortal robin
elder tangle
#

Dotween is really a game changer for ui

low pike
#

It's unlikely anyone here is going to have a solution to a possible bug in 2019.4

If you can't update away from 2019.4, can you update to a later version (the last?) of 2019.4?

crisp coral
#

I want my render texture to have UI, how can i do that?

mortal robin
#

or world canvas

low pike
#

Can you make it interactive though ?

mortal robin
#

with a custom raycaster you can

low pike
#

"think" isn't good enough bud, go check and make sure

low pike
#

Probably fixed in 2020 and not back ported

quasi parcel
#

how do I make pixel font text align its pixels with my canvas, I know it will have to be a certain size to match the pixel size but how do I know what size to make it? Do most devs just not bother matching the text to the surrounding pixels it does seem pretty hard.

late wigeon
#

any reason why the shop png isn't showing up in the editor?
it shows up in the game
but for some reason I can't see it
I wanted to add more interactions but I need the image as a reference to know where the board and black border for options
ping me if replies
thx in advance

sterile wedge
#

And press T to change to the Rect tool to see the borders of the image

quasi parcel
sterile wedge
#

Or just double click the image in the Hierarchy

#

You should be looking in the game view, not scene view, when you're working with UI

late wigeon
#

and the borders are stretch out and matches

late wigeon
#

also this game is entirely 2d so it's not goign from 3d to 2d if that's what you mean

late wigeon
late wigeon
mortal robin
#

Where's the canvas?

late wigeon
#

okay wtf I'm actually so confused now. I was experimenting with the UI and now the gameplay is affected and my character just clipped through the ground

late wigeon
#

wait leme check

#

the InGameUI has the canvas

mortal robin
#

But you said that only had an Image component above

late wigeon
#

I disable it just in case

#

yea in the shop gameobject

#

it only has the image component

mortal robin
#

Ok show the inspector for the ingameui object

late wigeon
mortal robin
#

Looks fine? Maybe you hid UI in scene view?

#

Idk

mortal robin
#

Look at your hierarchy

#

You hid those objects

#

(the eyeball)

late wigeon
#

eyeball?

#

you mean the checkmark?

#

I did that intentionally in that pic

#

but with the box check, it doens't show up

late wigeon
#

but it's a mystery how the UI is missing

#

just adding another gameobject with the same image helps??

#

yea okay I think I'll just go with the new one

mortal robin
mortal robin
#

In the hierarchy

#

The eyeball in the margins

late wigeon
#

oh that's prob it

#

clicking it now def hides it

paper coral
#

I'm using Unity Editor 2021.1.6f1 and I'm using Text Mesh Pro. I created a text, added a font and polished the text. But every time I save it, it disappears. Help anyone? atwhatcost

mortal robin
honest saffron
low pike
#

All games that encountered the issue will have had to fix manually or update

honest saffron
honest saffron
#

how would i fix that?

mortal robin
#

open your TextMeshPro component in the inspector and look through the properties

#

font size is one of them

quasi parcel
#

How do I match a fonts pixel size to the games pixel size. It not easy to find anything on this, and its very important to me.

peak cedar
#

simple

#

make your own font

#

ok but fr i know little to nothing about fonts but from what i know you can just use a vector font

quasi parcel
# peak cedar ok but fr i know little to nothing about fonts but from what i know you can just...

yeah no, thats not how a vector font works, also while I could make my own how would that fix the problem? It seems insurmounatable to find all the proper settings that will make my fonts pixels line up with the game. Heres one persons explanation that I have no clue if it would even work. I would be interested to know how consoles like SNES, and NES did their fonts. (ill google that just spitballing a bit here)

quasi parcel
#

ideally should all my canvas have scale to screen size?

sterile wedge
quasi parcel
#

ok ty

shy iris
#

What's the perfect resolution to export a Sprite Sheet for a game whose canvas size 4k Portrait?

#

We tried using 5k x 5k res and it is still blurry 😭

low pike
#

Sure you're not just zoomed in or something? Because that doesn't sound right

shy iris
#

The UI Breaks on IPAD

low pike
#

That scale isn't set at 100, because it can't fit on screen

#

It won't look good like this

shy iris
#

Mine is on Fit on Screen

#

And I am running on Simulator, not game

low pike
#

Yes, I know.. and that is why it doesn't look good

#

move the scale to 100

shy iris
#

It's even bigger than my screen 😭

low pike
#

sigh obviously it is

#

but that's the quality of it

shy iris
#

Yeahhh but

low pike
#

and that looks right

shy iris
#

I have another issue

#

The quality one got fixed

#

But but

#

AS you can see, the UI arrangement breaks when I go to IPAD

#

From Iphone

#

The main centre panel overlaps the top one

#

If anything, it's actually the other way round 😭

low pike
#

anchor things better

#

use layout elements better

shy iris
#

Yeah I tried everything.

#

From some Unity Forums, I saw that people say to have different UI Layouts for Vastly different Aspect Ratios

#

Meaning that I will have to make 2 different layouts for Iphone and Ipad since there is a massive change in resolution.

low pike
#

Yep, it'll be the best way

mint pine
#

How can I make UI images be affected by Directional Light and Global Volume?

#

in URP

#

but only two images

#

not the other UI elements

heavy egret
#

When programmatically creating canvas elements, i need to set the rect transform to specific values, is there a specific order they need to be set in order to work properly, like anchors pivots then position? or pivots anchors then position? does it even matter?

#

Basically, how can I recreate this programmatically. Because I've tried setting the anchoredPosition and the sizeDelta to match along with the anchors, just the l/t/r/b always seem to never set to what i am passing into it. I give it 3 11 3 11 for l/t/r/b and it sets it to 1.5 -16.5 -4.5 5.5?

sterile wedge
# heavy egret Basically, how can I recreate this programmatically. Because I've tried setting ...
#

I googled
how to set left right bottom top recttransform

heavy egret
#

I asked ChatGPT and it gave me the same solution but it didn't change anything. Perhaps I messed something up. I'll find out when I wake up later ig

inner dagger
#

This may not be the exact place to ask this, but I have a question regarding the Pixel Perfect-ness of a UI Canvas marked as "Pixel Perfect" when the Canvas Scaler Scale Factor is set to any integer other than 1.

The Canvas is pixel perfect in that the position of UI objects is always exactly snapped to 1 pixel, but when the Scale Factor of the Canvas Scaler is a different number than 1, let's say 3, it would be expected that the positions would also be scaled such that the ratio remains 1:1. In the case of 3x Scale Factor, this would mean 1 pixel would be counted as a square of 3x3 pixels, and positions would thereby need to be scaled by 3. The image demonstrates this issue, where "subpixel positioning" is allowed where this should not be the case. Am I missing a setting that corrects this? The Scale Factor is set relative to the resolution of the game as the target resolution is 640x360 px, which scales nicely at exactly 2x for 720p and 3x for 1080p.

#

Changing the Canvas Render Mode to "Screen Space - Camera" has no effect on this issue, and I am not exactly sure why the canvas pixel perfect mode would not take into consideration the canvas scaler scale factor in this way.

inner dagger
#

So it appears that "Pixel Perfect" mode for the UI Canvas only cares about Screen Pixels and not the size of "pixels" that get scaled by the canvas. Is this by design?

grizzled tiger
#

I'm having my own issues with pixel perfect in the UI too..

meager quartz
#

Plan rn is to have a tooltip show up like in the video when youre nearby
but also a blue glow and blue flames

but i feel like the reminder text rotating like this just seems unprofessional and weird

honest saffron
#

as if it was 2d

elfin pendant
#

Can anyone help? I want to select a 'resume button' on my 'pause menu' by default but it doesn't apply the highlighted effects until I either select another button and come back to the resume button or unpause and pause again.

It says its selected, which is why I don't understand why its not working.

#

This is what I want it to look like (this is after unpausing and pausing again)

quasi parcel
#

when I scale my canvas it mismatches the pixels, everything works fine at base 320/180 but when I got 1080p it misaligns them why does this happens heres what my canvas scaler looks like

#

theoretically everything is being scaled so i dont see how one object scales differently than the other

quasi parcel
#

I dont mean to sound dramatic but from my perspective unity is broken. Ive doubled checked everything pixel related I know of and have seen online it just wont align.

#

(just letting people know I am desperate for help on something I might have missed)

wispy niche
#

is there any way to get rid of the "selected color" from button

#

i have buttons that dont like turn things on/off and are just clickable many times

#

so i would prefer having only a normal color, highlighted for when its hovered, and pressed when its clicked

#

oh i figured it out

#

making selected color the same as normal color and disabling navigation fixed it

honest saffron
#

theres a pixelperfect property on the canvas

#

shouldnt that be the only thing you need to do?

#

and on all your images set texture type to "point (no filter)"

quasi parcel
#

But no ive done that its not the solution to my problem at least

rapid ferry
burnt radish
#

anyone know why my UI element's y pos are NaN when I first open the project?

#

actually all of my UI elements have positions NaN

#

@finite iris hi were you able to resolve your issue?

rapid ferry
#

curved like Italic?

twin shard
#

Why do some Filled images have Fill Amount starting from the beginning on an image and others have in starting from the beginning of a non-transparent part?

#

For example I have this image, which is still visible with very low values and an image that disappears completely even at 0.034

#

It seems like it depends on the scale of the sprite image. The second image is 260x29, I've made it 780x87 and now it works like in the first example. How does it work and why?

rapid ferry
#

guys, any of you have a good idea how should i do the UI display on kills seem very rewarding for a zombie game?

#

im really bad with the UI

bold bone
#

When working with UI how do I make a parent fit the size of its children if it doesn't have a layout group? I don't want to use a layout group because I want the children to change its position according to their anchor and pivot presets and layout group IMO doesn't allow such functionality.

twin shard
bold bone
#

How do I make elements of layout 1 cling to different sides of layout 1? So that if layout 2 (which is parent of layout 1) expands layout 1, children of layout 1 cling to sides of layout 1's GameObject as if they were anchored to the sides?
The whole reason for using layout groups in this case is to expand all things in layout 2 when layout 1 changes in size. There will be many instances of layout 1 under layout 2.

bold bone
rapid ferry
#

i believe that you want to create a shader, something like this one https://www.youtube.com/watch?v=VQxubpLxEqU

Unity Shader Graph - Vertex Animation of a Goldfish Tutorial

We are going to see how to make this cute little goldfish wobble and wiggle with Shader Graph. This shader will be mostly focused on Vertex Animation.

Goldfish: https://www.blendswap.com/blends/view/90712

Hey I'm making a game, check it out: https://store.steampowered.com/app/176386...

β–Ά Play video
#

but you will have to modify it to ur needs

#

i dont think there is simple solution for that, you will have to code it out

ionic beacon
#

Nobody can tell what's the best solution for you. Obviously people who have posted to the forum threads and blogs think that their solution is the best one so you'll have to try them out and see how they work for you.

rapid ferry
#

well there is no best solution, as long as you can work it out its good, and if u can find a better one for yourself , use it

#

i just used google to find those solutions, u should use google aswell and see if u can find a more simple code aswell, training how to use google for what u need is really good, to master the algorithm for your questions to get really good answer is really usefull

sonic geyser
#

anyone know how to put particles on a unity UI? i tried a few weeks ago and the default solution the internet kept saying did not work. anyone got any adivce?

runic coral
#

Is there any clever way, within this canvas, to have this box properly fit to the "cooldown bar" over top of this image, even if the screen resizes?

#

The parent image object is configured like so, for automatic resizing:

#

and that image is inside of a Horizontal Layout Group with padding and whatnot, so the outline you see in the first pic is the box it has been given to fit to automatically whilst preserving aspect ratio

#

Or am I pretty much stuck using a script of some kind of manually calculate the X/Y offset and height/width of the bar?

mortal robin
#

they're the missing other part of the whole layout group thing that you probably never realized is there

runic coral
#

Layout Elements are integer values though, not %s

mortal robin
#

nope

runic coral
#

wait is there a way to make em %s?

mortal robin
#

flexible width and height are floats

#

and they're all releative to each other

runic coral
#

oh, gotcha

#

that should work then

mortal robin
#

if you have one element with flexible width of 1 and another with flexible width of 2, you'll get 33.3% and 66.6%

#

it's about their relative weights

runic coral
#

Though, is there instead a way to do like, flexible padding from Parent -> Child?

mortal robin
#

to define the empty space

runic coral
#

that kinda feels gross but I guess that works

#

lotta extra overhead for what is just a single int D:

#

I just wish I could do a LayoutGroup with % padding

mortal robin
#

in UIToolkit you probably can?

#

This is how UGUI does it

runic coral
#

Yeah I tried UI Toolkit but it just was super poorly documented and so much stuff was missing

#

and it felt pretty buggy as I worked with it

#

Like Im a web dev and Im quite familiar with FlexBox when it comes to css, and it definitely seemed to be a fair bit "off" with respect to how flexbox behaves normally

mortal robin
#

I'm not a web dev and CSS is frightening to me

#

so I just... don't πŸ˜‰

runic coral
#

haha, one of my projects I maintain effectively is my own custom language I made that is a remake of css (but with my own variables and values cuz it does other stuff)

#

now I gotta sit and count pixels to get everything lined up @_@;

#

hrmmm

#

If I have A -> B -> C, and B's are set to evenly distribute across A as a layout group, and I want a C to completely fill the B without expanding the B, how do I do that?

#

Cuz right now, the 5 images you see are the "Bs" and they are inside a horizontal layout group "A"

There's a max that A can expand to, but the B's are supposed to have a ratio they follow to based on their images.

But now that I put children that expand to fill up the leftmost B, it caused it to expand out and grow to fill all the remaining space D:

#

As you can see in the pic there, the leftmost one wasn't supposed to grow out like that, it's supposed to stay same size as the other 4

#

Oh damn, we still have issues though @mortal robin

#

Cuz we can have the scenario where the image is fitted to the sides, not top/bottom

#

Like so

#

...oh wait, nevermind, simply by being a child of the parent image... I guess the scaling "just works"?

#

~',.'m a g i c'.,`~

runic coral
#

Nice, works like a charm... didnt have to do anything special, just had to line it up and the auto resizing "just works" I guess

sterile wedge
marsh beacon
#

how can i fix this (make the text look "better" so its not all squished and is readable)

#

help pls πŸ™‚

azure flame
#

You need to specify what you want to fix. Also make sure you didn't scale parent transform non-uniformely

marsh beacon
azure flame
#

Check transform scale

low pike
#

All UI elements should have their scale set uniformally ... ie: at 1,1,1

marsh beacon
low pike
#

Use the width/ height on the rect transform to change the size of UI

coarse gazelle
#

I have deleted the EventSystem i have to canvas how can i turn them back on

#

because nothing is intractable

low pike
#

re-add an event system..

coarse gazelle
low pike
#

still what?

quartz wharf
#

Hey guys, I can't decide on what my UI should look like - what the style of the game's UI should be. For now, I've been just been using some placeholder UI using the unity standard UI toolkit.... I've just been starring at an empty figma board for like an hour. Do you guys have any resources / pointers to help me figure this out?

#

I've only really done some flat website UI designs in my past and I know I don't want to use that style, it's just not fitting for my strategy game.

mortal robin
magic walrus
#

how can i get these images to not waste space with 18:9 aspect ratios? they look fine in all 16:9's, but 18:9 leaves too much space

clear cobalt
#

Hey anyone knows if I can find a free animated progress bar like this?
I don't know how I can make one to add in unity and I don't want to pay for assets
If anyone has a tutorial to make one I'll also be happy to make one
I looked everywhere and I can't find anything

low pike
magic walrus
#

ill try that, thanks

mortal robin
thorny hull
#

I'm trying to get a scroll view to work, but for some reason, when I add a default scroll view from the UI menu, it does not accept any input at all. I'm running the latest version of unity, and I cannot think of anything that could be causing this. I've changed the size of the content and added images inside to make sure there's a space to scroll, but trying to scroll or click drag doesnt do anything. What am I missing here? Again, did not change anything besides changing the size of the content and adding stuff to check its actually scrolling.

silk kettle
#

What is your favorite font to use in your game's UI?

quasi parcel
tawdry ferry
#

Any ideas how to control name's width when I stretch InputField, so that together they will always be 100% of parent with Horizontal Layout Group ?

#

without writing my own script

sterile wedge
#

Then tick control child size width thing on the layout group

tawdry ferry
#

I mean, it's the same as if I was just a child of a new GameObject

#

so it doesn't make sense.

low pike
#

I just leave it at default settings

#

Depends on what you're including and how much space is needed between each char though

low pike
#

RectTransform scale should be at 1,1,1.
Change size with Height/ Width.
Don't have the font size < 1

#

The font might have chars that are chunkier than a "normal" font, then, I guess

#

just up the res a bit, until it works for you

#

never done it

#

what's wrong with a coroutine?

#

complicated doesn't neccessarily mean expensive

#

test it and profile it

#

Throw like 100 curved TMP's into a scene and see how it performs

fathom lynx
#

What other colors can I add as skins in my game? :p

low pike
mortal robin
muted flame
#

I'm still a beginner in Unity
Why did the image transparency not change? I'm trying to do an animation

#

🎁 Support me and DOWNLOAD Unity project: https://www.patreon.com/posts/49141718?s=yt
✴️ Animate your UI using code: https://youtu.be/YqMpVCPX2ls

This tutorial/guide will show you how to create stunning UI animations without writing a single line of code. Recently I showed you how to do that by coding the animation behaviour, but doing that usin...

β–Ά Play video
quasi parcel
#

Did you add canvas renderer to a regular game object. It also doesnt have a sprite renderer or image component so im confused

#

Whats that white shape coming from

muted flame
#

It's a picture that I pulled out and put a bone on

quasi parcel
#

I mean yeah you need a canvas to use a canvas group

#

so just to be clear you should make a canvas, inside the canvas you add UI elements such as Images. (anything under the UI dropdown)

quasi parcel
mortal berry
#

I'm having an issue understanding how Content Size Fitters are supposed to work. I've got a game object w/ a content size fitter and it's vertical fit set to "Preferred Size". I've got two child GameObjects (the header and content area) which each have a Layout Element with both Preferred and Min height set. However, the Content Size fitter always sets the parent game object's height to 0. I'm in prefab editing mode.

What am I doing wrong?

mortal berry
low pike
#

The game object with the content size fitter on it is empty though, the CSF doesn't use children size

#

you need a layout element on the same object

mortal berry
#

so content size fitter... doesn't fit child objects?

low pike
#

not without a layout element..
(vert/ hori)

mortal berry
#

OK but as I noted and is visible in my screenshots, my child elements DO have Layout Elements in them.

low pike
#

I didn't say on the child elements

#

I said on the same object

mortal berry
#

and then I asked about child elements

low pike
mortal berry
low pike
#

that doesn't mean on the child element

mortal berry
#

In any case, what I want is for my box to expand to contain any children

azure flame
#

The manual I linked explains exactly how it works

#

Read the Descripition

mortal berry
#

well forget content size fitters then, if they don't do what I'm trying to do.

low pike
#

They do, you're using them incorrectly and didn't understand what you were told would work Β―_(ツ)_/Β―

mortal berry
#

ok. How do I use them correctly. I've got a CSF on the parent game object. I've got layout elements on the children. What am I missing?

low pike
#

the vert or horizontal layout element on the CSF object, like I've said 3? times πŸ˜„

mortal berry
#

And I've got a Layout Element on the parent object too - it lets me set a "preferred height" but is unresponsive to any number of children

low pike
#

ver/horizontal layout elements don't have a preferred height

azure flame
#

Don't bother with them, they decided to send insults in DM.

livid bay
#

If i want to make a circle in UI... but cant use a image because i want to use the circle to transform an image into a circle... do i need to use the mask thingy?

azure flame
#

Yes, if you want to show arbitrary image as a circle shape you'll have you use mask

feral harbor
#

where did i do wrong?

#

canvas scaler:

azure flame
#

Don't make people guess about the problem. Describe exactly what's the problem or desired behavior.

feral harbor
azure flame
deft sierra
#

Maybe someone could throw some common issues for ui to not detect mouse at all, I copied my whole canvas into new scene there button sees its being hovered over with exactly same setup but in main scene it does not no errors in console for them to lock up something

azure flame
#

Make sure new scene has the EventManager

#

when you just create canvas for the first time it is created for you

deft sierra
#

Yea I was missing event system had it deleted cant remember why thanks

azure flame
#

Right, EventSystem.

azure flame
next garden
#

i want the score to be in that blackzone of the background image, but when i make a build and test it on my phone, the background image stretches to fit the phone res and the score is not on the black zone anymore, how to fix it?

sterile wedge
#

And the score text should be set to auto size

uneven ferry
#

hey ,im sorry if this sound dum, but for some reason my button isnt interactive

#

this is the property

#

and when it get click, it should send a console message

#

which i didnt recive

low pike
#

Got an event system in the scene?
Is there anything blocking the graphics cast?

uneven ferry
#

ok my bad

#

i work out why

#

cause i made that the mouse alway stay at the center

#

so i couldnt be able to click it

#

that is my bad

#

im sorry

low pike
#

Also, side note, don't leave empty Start() , Awake() and Update() methods in your classes, they still have a (tiny) cost

uneven ferry
#

i unlock the mouse and now its working

shy iris
#

Any video suggestions on how to make the UI on mobile games more poppy and lively?

low pike
#

I'd suggest looking at the top mobile games and seeing what they do

shy iris
#

Yess, I didd. I came across feel also but it seemed a bit overkill for mobile games. I tried using UI Particles plugin which worked pretty nicely but didnt satisfy me. So I tried making my own animations which forced me to make separate animations for each and every element which was extremely time consuming πŸ˜” Someone recommended Dotween so I am yet to try that.

low pike
#

Yep, DOTween is great

shy iris
#

Ahh okiee, so the standard version is sufficient right?

low pike
#

Yeah, I've been using DOTween for years, never had a reason to even look at what the Pro does

shy iris
#

Okayy thank youu, will learn how to use it then!

sterile wedge
shy iris
#

Ahh that's cool. My company might not invest since I personally had to invest in feel, Particle Images and royalty free music and sfx 😭

torn pendant
#

How would one create a UI effect like this one?

#

where it looks like a low res display or whatever

fathom lynx
low pike
#

be specific with what you don't understand

fathom lynx
deft vigil
#

how can I get the power bar in the same position on both screen sizes? ive already changed it to scale with screen size

deft vigil
#

I see alright thanks

hot crow
#

So i have over 250 3d objects for character customisation. I have created a shop, but I need to display these objects as icons in the shop. Is it possible to do that without manually having to create a 2d sprite from each object and then upload it?

deft vigil
# mortal robin with proper anchoring and layout of your UI elements

No matter where I anchor it it's the same. could it be a problem with my code where I'm changing its possition to a specific amount of pixels and thats different per screen?

ballPowerSlider.transform.position = cam.WorldToScreenPoint(ball.transform.position) + new Vector3(116.5f, 0, 0);
hot crow
#

not sure right now

deft vigil
#

i see alright

#

yeah its a pain i hate working with ui

hot crow
#

i hate UI πŸ˜„

mortal robin
#

Why are you setting the position in your code

deft vigil
#

is there a better way I should be doing it?

#

basically a hud

mortal robin
deft vigil
mortal robin
#

place it in front of them

feral harbor
slow yarrow
#

Is it possible to scale children sprites with the parent image's rect transform width and height?

sterile wedge
#

Look up any tutorial on making scalable UI on Unity and it should cover proper anchoring

inland obsidian
#

Why whenever I open Unity, some UI elements are moved by Unity

#

It is super annoying

#

These texts for example

#

Or this entire Panel

#

Is this a Unity bug?

lime cloud
#

I am trying to make a box that encircles UI elements. I used GetWorldCorners, so now I know the area to encircle them in world space, but I'm struggling to get back to screen space

#

camera's WorldToScreenPoint does not work for me

deft vigil
#

Why is the settings icon getting squished and how can I fix that

mortal robin
deft vigil
#

ah ok thanks πŸ™

crimson cairn
#

How would one go about creating a scrollable panel where elements inside of it can be dragged and dropped into any position? Without strict grid etc.
Do I need to write a custom script to resize content container based on content?

inland obsidian
crimson cairn
#

Fit content isnt working since it needs a layout group and it would disable the ability to drag elements to any position

inland obsidian
#

I don't understand what you mean

crimson cairn
# inland obsidian I don't understand what you mean

Solved the issues by writing a function that checks all content children and calculates content container size based on their positions and sizes and then executing it whenever something gets dropped. Tho I had problems resizing rect transform with anchors being anything but 0 1, gladly 0 1 works fine since i'm not planning increasing it to the left\top side

late talon
#

im trying to make pages side by side but when i duplicate the image object inside horizontal layout group it squeeze them for one screen width, any ideas ?

low pike
late talon
#

nah tried all those

late talon
#

then how am i gonna scale the image as screen width for per aspect ratio or resolution ?

dark marsh
#

so

#

did you know where from the problem ?

#

@azure flame

tired inlet
#

how did you position your image?

dark marsh
#

i just drag and drop

tired inlet
#

make sure you use anchored position

dark marsh
#

what's thaat

#

sorry bro im new to unity lol

tired inlet
#

you can just drop ui elmenets onto the screen like this

dark marsh
#

i used this like 2 days ago

tired inlet
#

so learn how to position ui elements.

dark marsh
#

you can't explain this right now ?

tired inlet
#

hold the alt key and choose one of these anchored positions.

#

then you can fine tune the x and y

azure flame
#

@dark marsh UI is sorted by hierarchy. If you want something to be on top it goes to the bottom.

dark marsh
#

oh okay

tired inlet
#

yeah, that too, your ui image might be rendered behind the other elements. make sure to position them in the hierarchy as you want like Fogsight said

dark marsh
#

thanks for the help !

maiden plover
#

Is there a vid or something I can watch to get the basis of learning ui like menus, inventorys, ability timers and stuff like that ik how to do hp bard but not the other nesacary things

onyx flowerBOT
#

πŸ§‘β€πŸ« Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/

young shell
#

Hi all! I have written code for my UI, but it doesn't behave exactly as I intend. Can someone help? Not sure I should ask here. The issue is: my game should show the value of an enemy when it is destroyed. In my game I have 4 different prefabs for enemies, each having a unique point value. I want my game to show the value of the enemy destroyed. My game already succesfully shows and updates the total score. But not the value with which the score increases. Here is a video and my code. Can someone help?
https://gdl.space/ucecokibix.cpp

mortal robin
#

you basically found one random enemy and are using that enemy's point value to show the text

#

why do you need this at all?

#

You should just do this:

    public void Score(int scoreToAdd)
    {
        score += scoreToAdd;
        scoreText.text = "Score: " + score; //Shows the current score number as part of the score text
        scoreIncreaseText.text = "(+ " + scoreToAdd + ")";
    }```
#

there's no need to get a reference to an enemy in this script at all

young shell
mortal robin
#

Well it makes no sense to do it that way

#

so it's unclear why you want it

young shell
mortal robin
#

how would grabbing a random Enemy reference in Start tell you anything about the particular enemy that died at the moment an enemy dies?

young shell
mortal robin
#

I'm talking about the code of course

#

that's what the whole discussion has been

young shell
#

I'm learning Unity and am happy to make mistakes and learn.

sand thistle
#

how can i set anchors on image so that when the parent changes it stays 1:1

low pike
#

Tick the "preserve aspect ratio" box

sand thistle
livid bay
#

sorry for the ignorant question maygiwah
I have this png that is big, i will scale it down so...

If i scale it down in unity will it look worse?
Is scaling it down outside of unity a better idea?

low pike
#

Test it

fast forge
#

Hi guys! I have a problem with linerenderers and canvas. I have a canvas set to screenspace camera and some linerenderers drawn by code. The problem is the lines appears above the UI panels. I've tried with sorting groups and changing Z (if I change Z of the lines below -10 they don't get drawn but that's all) and no luck.

livid bay
# low pike Test it

it looks like unity scales it down a lot better than an online tool ArtistThink but no idea why

#

photoshop seems to do better than online tool but also worse

low pike
#

That sounds like you're trying to curve it when the mesh isn't ready to be manipulated

#

I assume when it's disabled, because there is no mesh being rendered, you can't curve it yet.

quasi parcel
#

sometimes the scale on an object in my canvas gets set to 0, Im not sure why this happens. It doesnt happen too often but still annoying

low pike
quasi parcel
#

Ok

#

Ty

quasi parcel
#

Did you just try to @ everyone lol

celest remnant
#

im making the scroll rect like this

#

but the problem is

#

when i change the screen ratio

#

it looks like this

#

so i can't scroll to the bottom of the square

#

like this

#

how can i fix this problem

#

what im I using

sterile wedge
#

tried this?

celest remnant
#

oh shit

#

that helps

#

by adding this

#

thanks so much

sterile wedge
deft sierra
#

https://hst.sh/ihotamizom.csharp all related code + profiler trace and what components prefab is made out of im getting micro stutter when instantiating this prefab for the first time afterwards there are no such lag spikes anymore anyone knows how this happens? I need to dummy instantiate effect to warm it up or something before game starts?

raven rover
#

Hi, I have a problem with TextMeshPro text, so basically I don't have a 4k monitor or ANYTHING close to it but when I set the resolution in the editor to 4K the text becomes a lot more crisp and nice looking, but when I set the game to free aspect or any other aspect the text becomes blurry again like the picture on the left

low pike
#

Don't use free aspect when dealing with UI, it's impossible to setup your anchors correctly.
Make sure all UI elements have a scale of 1,1,1
Font size for TMP should be > 1

celest remnant
raven rover
#

all the scales are 1 1 1

#

the font size is 0.6 but that's because I'm using world space mode

low pike
#

the width/ height are tiny

raven rover
low pike
#

Put the canvas as a child of an empty game object, with a normal transform.
Set the scale of this transform to 0.002, 0.002, 0.002
Set the scale of the canvas to 1,1,1 (and all the children)

You can then use normal sizes for width/ height

#

or just set the canvas scale to 0.002

raven rover
#

hmmm nope, it looks worse now

low pike
#

because you need to size everything up

raven rover
#

the problem is it only looks crisp and good when I set to 4K

raven rover
low pike
#

you put the width/ height to something like 50/50? and the font size to something like 30?

raven rover
#

yes

low pike
#

and all the scales are 1,1,1?

#

for the entire UI hierachy, except the top one set at 0.002?

raven rover
#

yes

low pike
#

what size did you use for the TMP sdf?

#

Atlas Resolution

raven rover
#

let me see

drifting flare
#

hey guys

#

I am trying to make a UI for a project

low pike
drifting flare
#

this UI will contain a list of names, that could be sorted, also would have tags/labels.

low pike
#

There's something else going on, the setup I just suggested is what I use for all my world space UI.
What you were already using is far too small, the font is 0.6 on 4 pixels

low pike
low pike
#

I'm out of suggestions, I would need to dig around in the setup of the UI to figure it out

raven rover
#

thanks for helping Carwash, much appreciated, the text does not look bad I just wish it could look like the upscaled one but it's okay, I'll dig deeper and if I don't find a solution I'll just settle with what I currently have

raven rover
#

this is another example from the main menu and as you can see the glow spreads in my native resolution but doesn't and is more crisp when I put it in 4K

#

this does not make sense since my screen is not 4K

honest saffron
low pike
#

Log out the verts (or whatever makes sense to check) in Awake/ OnEnable/ Start and see if / when they become present

quasi parcel
raven rover
#

I want the text to look crisp like it does on 4K but on all resolutions

quasi parcel
#

Thats really big and doesnt scale to 1080

#

Are you drawing your pixel art in that large of a canvas?

raven rover
#

ohhh wait

#

no sorry here is the base resolution

#

here is the canvas scaler

#

it differs from canvas to canvas

#

this one is the main menu's

quasi parcel
#

Thats a weird resolution, you should make it small and scale it up if you are using pixel art popular resolutions like 320/180 since that scales to 720p, 1080p and 1440p

#

The canvas scaler basically you want to put your lowest resolution in it and it will scale up to higher popular resolutions

#

Are you making pixel art?

raven rover
#

no

#

actually the menus I showed are just textmeshpro text elements

#

I'm using a pixel art font though

#

the whole game is pixel art, but the big difference between the normal resolution and the 4K res is only the text

#

I have noticed something, the lesser the value of this scale thing in the editor, the more crisp text is

quasi parcel
#

the scale doesnt matter, its an illusion only for the editor. Your real game doesnt interact with that scale bar at all. If you build and run your game you can see how it will look.

raven rover
#

another thing I noticed is, the text lights up because of the post processing that's affecting it, but when reducing that inspector scale it glows less

#

I found it, it's the bloom affecting the text, it looks perfect now but that's only the main menu

dark marsh
#

hello i want to creat an interaction menu but he is too big how i can low the scaale ?

#

really too big lol

mortal robin
#

this is how canvases work

#

the big canvas rectangle is representative of your screen

#

if you put a UI element in the center of the canvas, it will be in the center of the screen

dark marsh
#

oh okay

#

so my game down left will be seeing ?

mortal robin
#

what?

dark marsh
#

look here

mortal robin
dark marsh
#

there is the game

mortal robin
#

Look at the Game window to see what the game will look like

dark marsh
#

its normal

mortal robin
mortal robin
dark marsh
#

ohh okay okay i think i see

#

so all ui element will be see in the canva but other thing will not apear ?

mortal robin
#

Will not appear where?

dark marsh
#

(sorry for my bad english btw)

mortal robin
#

don't get confused by scene view

dark marsh
mortal robin
#

scene view is just to layout your scene

mortal robin
dark marsh
#

okay okay thanks man

#

its very hard to learn unity

#

i learn with chat gpt lol

#

i don't know if its a good idea

mortal robin
#

It is not a good idea

quasi parcel
celest remnant
#

i see this warning in content size fitter

#

it doesn't cause any problem, right?

sterile wedge
celest remnant
#

thanks i see

#

i have to remove scroll rect to make it disappear
but remove scroll rect make this nonsense lol

pliant crescent
#

I have several sanity check questions.
I have a 2d game with a lot of canvas objects, usually one per prefab. Is this okay? Do I like, want a canvas object to group a set of child sprites, or do I want to maintain one for the entire scene? or do I just want one per sprite? Same question for graphic raycasters.
if I add a button component to a sprite, what else do I need to add to make it clickable? I have an event manager in the scene root already.

sterile wedge
#

the idea is that if something in a Canvas's hierarchy changes, the entire Canvas is marked as dirty, so if there's a particular hierarchy of items that changes often, you should probably put them under a nested Canvas

#

you put graphic raycasters on canvases that have elements that will be interacted with

sterile wedge
pliant crescent
#

that makes sense, thanks

sterile wedge
#

if you want more optimization tips, there's a link on that that's pinned in this very channel

pliant crescent
#

during runtime I'm noting that canvases that exist under another canvas's hierarchy get a different inspector view, the event camera field disappears, etc. is it optimising them away?

sterile wedge
sterile wedge
#

are you using world space canvases?

pliant crescent
#

yup

sterile wedge
#

i'm afraid I dont have much experience with those, but the concept should be the same

#

it's probably that the nested canvases are using the same event camera as the parent

pliant crescent
#

that's okay, I'm slowly puzzling my way through how it all works

sterile wedge
#

so it doesnt make sense for it to be exposed

pliant crescent
#

I was hoping that was the case

#

got it. I've been using sprite renderer components rather than an image component

#

my image component works as expected for everything

sterile wedge
#

Rule of thumb is if it's going on Canvas, use Images

wheat cave
#

Not sure if this is the correct place, but!
How does UI work in Unity when it comes to hierarchy? For example, a ContainerPanel(?) that extends Panel(?) keeps track of x amount of items, and makes the appropriate buttons, linking the interactions between the inventory supplied in the constructor, and the button clicks

#

Is this available? Can I just extend a Panel with a custom Start method, and keep on chaining? Or would that not be intended

mortal robin
agile grove
#

Hi, I'm trying to make an achievement panel, I've made the panel with images and text, it's on the Canvas, but I want it to spawn off screen and wipe in from the side, wait a few seconds, and wipe back off screen and destroy, I think I'm just missing the rect transform part, I keep getting the coordinates wrong, I'm trying to use a vector three, do I need to convert to screen coords? I think it's using world space

sterile wedge
#

One which has recttransform?

#

You need to change the anchoredPosition

wheat cave
agile grove
low pike
#

anchoredPosition uses the values you set in the RectTransform, you don't need to do any conversions

copper trellis
#

i know there's a technique to create rounded rectangles for ui, where you slice up a sprite into 9 slices n stuff
but that doesn't work with the sprite renderer

#

does anyone have a workaround?

proven fractal
#

can you parent the text object to something else and disable the object it is parented to instead of the tmp object?

mortal robin
copper trellis
#

Uh, i just did it

#

And it didn’t work

#

Maybe i’m doing something wrong

mortal robin
copper trellis
#

ok so

#

when i did the thing where i cut it up into 9 slices in the sprite editor, and put it as an image, i could scale it around and it would give me rounded corners

#

when i put it as a spriterenderer, it's just a circle that's squashed and stretched

#

like, a normal circle

copper trellis
#

yeah

#

it's still not working

#

i feel like i'm doing something very wrong

mortal robin
# copper trellis i feel like i'm doing something very wrong

Did you read this?

When a Sprite’s Draw Mode is set to Sliced, you can choose to change the size using the Size property on the Sprite Renderer or the Rect Transform Tool. You can still scale the Sprite using the Transform properties or the Transform Tool; however, the Transform scales the Sprite without applying the 9-slicing.

copper trellis
#

i'm so stupid

#

sorry for wasting your time

median marsh
#

for some reason when i adjust my scroll view height, the scrollbar handle just dissapears when starting the game, anyone know a fix??

sterile wedge
median marsh
sterile wedge
#

You see the part that says auto hide and expand viewport?

#

Yeah

#

Change that

median marsh
#

bruh

#

why does this option even exist

sterile wedge
#

Because not all games want to show their scrollbar all the time?

median marsh
#

makes sense

sterile wedge
#

You're welcome

slim sentinel
#

How could I create grid lines? I'm trying to make a grid for my game that uses a scoring system. It should look like this :

trim sierra
#

Is ther any good and free solution for writing uis wir html and css?

low pike
#

Ugui doesn’t use html or css

trim sierra
#

Does anyone have any ida what could be happening here?

I'm trying to render some "Lines" (It's a prefab with an image). Here's my code to render them:

       int currentLine = 1;

        for (int i = 0; i < lines; i++)
        {
           
            GameObject newLine = Instantiate(Line, LineParent, false);
            newLine.transform.localPosition = new Vector3(currentX - LineParent.rect.width, 0f, 0f);

            Debug.Log(newLine.transform.localPosition.y);
            currentX += step;

        }

Everything works as expected, except for when the localposition.y reads 0, but in the scene it is not:

ionic beacon
#

The rect transform inspector shows anchoredPosition, not localPosition

trim sierra
#

thankk you, chaned it to set the anchoredPosition and works perfect!

waxen terrace
#

Hello friends! i could use some help, am not entirely sure this is the correct place to ask for it

#

Do i post my issue here, wait for someone to message me, or find a better place to post it guys?

ionic beacon
#

Pretty much impossible to say without knowing what the issue is about

low pike
rain briar
#

The Unity Documentation appears to be outdated for 2022 versions on this matter:

proven fractal
#

Does anyone have a strategy they can recommend for an art pipeline that targets 4k and scales down nicely to 1080p? I was considering using mipmaps but I don't like the blurriness you get when you scale down

errant kraken
#

How do I make a little hole

#

For a lake

#

How do I activate cut tool

jagged monolith
empty sparrow
#

hey, a while ago I probably did something that I don't know, and now my UI is broken, the buttons are not clickable anymore, but I have an event system in the scene, and it, and the button itself is enabled, the button component is enabled, the Interactable checkbox is checked, and the text on the button has Raycast Target checked on Extra Settings, I already searched, watched YouTube videos, everything is fine for me, but the buttons are still unclickable, what do I do?

low pike
#

No idea how the UI works with the new input system, but you can include both in the project. Player Settings

empty sparrow
#

it's on Both

#

but it is still not working

#

I also tried making a new button incase the ones that I had were the problem, but the new one is also not clickable

low pike
#

Check list

  • Active Event System loaded
  • Canvas has Graphic Raycaster component
  • Nothing is blocking the graphics cast hitting the buttons
  • All Canvas Groups in the hierarchy, from the button up, are allowing interaction
  • The button image has the Raycast Target field ticked

Use the Event System to see what your mouse is hitting

empty sparrow
#

by the way, in the "First Selected" on the Event System, should it have something?

low pike
#

only if you want it as something

empty sparrow
#

also, my event system has only this

low pike
#

at runtime?

empty sparrow
#

yes

low pike
#

and does it have these?

empty sparrow
#

it doesn't have Base Input

low pike
#

That's only there at runtime

empty sparrow
#

it didn't get added by default, I added it manually, and there is no change

#

do I need to change something in the component?

low pike
#

nope

#

Delete and remake the event system? Probably won't make a difference.. try it anyway

empty sparrow
#

still the same

#

I created a new scene, and it's working on that one, I will just move everything

low pike
#

That will confirm whether or not it's the UI setup that's the problem

empty sparrow
#

I moved everything, and it seems that I have something that's breaking the buttons

#

I will just recreate everything in another scene, carefully this time

low pike
#

At runtime, if you swap to the scene view.. and click the button - what gets selected?

empty sparrow
#

the button

low pike
#

click it multiple times and does anything not to do with the button get selected?

empty sparrow
#

the button is the only thing selected, there is nothing on top of it

low pike
#

These kinds of issues are so frustrating

empty sparrow
#

yeah, just forget about it, I will remake everything on another scene, thanks for trying to help

latent tulip
#

Can someone help me create the UI for my game cuz I have no idea how to

#

like link a yt vid or smth

empty sparrow
latent tulip
empty sparrow
#

you don't need a tutorial to make UI, all you need is to look at another game's UI and make something similar, also making a good looking UI will take a long time, so take your time, and slowly work your way, it's simple

latent tulip
low pike
#

You need a tutorial to make UI.. so you know how to do things

ebon ermine
#

define the layout (how your UI is positioned and what interactions it has)

latent tulip
ebon ermine
#

then u can focus on making it all look pretty

ebon ermine
#

and have you determined what interactions u want ur ui to achieve?

latent tulip
#

Yeah I want something similar to the fnaf security breach UI screen

#

and yes

ebon ermine
#

can you provide a ss?

latent tulip
#

just have no idea how

#

kk

#

This is the best one I could find

ebon ermine
#

so basically play and options buttons?

latent tulip
#

and more

ebon ermine
#

what more is there?

latent tulip
#

I want to add a little

#

like the player name and current area their in

ebon ermine
#

player name? is that something locally defined?

latent tulip
#

Im new to game development so idk what you mean

ebon ermine
#

does the player define the name in the game or do they have to create an account or something, to then have their username retrieved

latent tulip
#

The player defines their name ingame

ebon ermine
#

are you planning to use multiplayer or not?

latent tulip
#

no

ebon ermine
#

then it's fairly simple :>

latent tulip
#

neat

ebon ermine
#

I can help you in call if you prefer

latent tulip
#

I dont really like calling

ebon ermine
#

then should I dm u?

latent tulip
#

yeah

ebon ermine
#

aight

latent tulip
#

thanks

near barn
#

Hey, after loading a scene I have these UI elements that aren't correctly laid out (no proper spacing).

If I disable/enable the vertical layout group they are contained in, they are properly laid out. They are not added dynamically, everything is in the scene from the start.

Does anyone know why this happens and how to resolve it?

#

It looks exactly as if it's using the configured padding, but in negative (-50 instead of 50)

ebon ermine
mortal robin
near barn
#

indeed if I resize the game window it also redoes the layout

low pike
#

Never use 'free aspect' when developing or testing UI

near barn
#

it's set to 16:9

ebon ermine
#

is canvas set to fit screen size?

near barn
low pike
#

Set the Canvas Scalar to scale with screen size -> set a reference resolution -> move the slider to where you want it for scale with height/ width

near barn
#

before after is nothing special (it just redid the layout clearly)

ebon ermine
#

I'm thinking the issue might be something like that

#

cuz I think the spacing is between the anchor points no?

#

I think it's why it gets smushed like that

#

I don't know any actual solution, but maybe increasing the spacing might be a good workaround

low pike
#

Make sure the images have 'preserve aspect' ticked
Then enable these 4

near barn
low pike
#

that sounds like one of the weird quirks of the UI system

near barn
#

I'll write a bug report

low pike
#

good luck

uneven ferry
#

hey, is there a way to make UI/canvas stay scale or like match with the screen resoultion

#

i tried changing it,but it arnt working out

uneven ferry
foggy prairie
#

Hey guys i have input field for my game and was wonderiing how can i get an input field to accept both inters and decimal values?

#

bc right now it can only accept one or the other

terse hamlet
#

Question. I am getting weird warping of a world space canvas when I rotate it. It is a child object(but of normal GameObjects, aka Transforms not RectTransforms). I am rotating the parent Transform, but it seems to happen on the RectTransform also.
It looks like the canvas is beings Rotated and stretched.
How do I fix this?

#

And of course I figure it out after writing out my problem. The root object was a SuperTextMesh which for somereason was causing this effect, if I change the root to a normal gameObject it is fine.

nimble orbit
#

Having a brainfart. I know there are things like IPointerClickHandler and stuff like that but is there any handler interface for receiving/losing focus?

cedar arch
#

I just need help with math. So I have an image, and I want the image to start at a size of 0, and when you go inside the green zone, the size of the image will increase the closer you get to the black rectangle in the middle

wise elk
#

Anyone know how to stop a ui element from being added to the UI navigation selectable? Text is even showing up and selectable by the event system.

quasi parcel
#

Can i see the text objects that are working with the event system?

#

I was under the impression only buttons are navigatable with the event system.

#

Buttons can have text child objects though

wise elk
tribal jasper
#

I have two canvases and I'd like to block one with another (ie you cant interact with anything on the other while it is displayed)

One Canvas is on the "Interface" layer, with its interactive elements having a Graphic Raycaster that have a blocking mask set to "Interface"

Over this I display another canvas set to the "Overlay" layer,
it has a fullscreen image with raycast target ON, and a Graphic Raycaster set to Everything, and a Canvas Group whose BlockRaycasts are ON

Both canvases are set to "Screenspace - Camera" and are rendered to two different cameras, the "Interface" layer is rendered to a "Text Camera" and the other to an "Overlay Camera". The Text Camera is under the Overlay Camera in the stack order on my URP camera and they are both set to their respective volume and culling masks (Overlay on Overlay, Interface on Interface).

This second canvas is meant to make it so that when it displays, the stuff on "Interface" doesnt receive any input, but if I make the fullscreen image half opacity and mouse over buttons on the Interface layer, they get highlighted and can be interacted with.

What am I doing wrong?

quasi parcel
#

I meant the inspector

livid bay
#

I think that i did something wrong with my scroll rect but idk what. my panel doesnt expand and when it does it expands both ways instead of just downwards. So at the moment it doesnt scroll

wise elk
#

The inspector has noting.

livid bay
livid bay
#

when i set vertical fit to min it goes up

acoustic hedge
#

I'm trying to create a UI element like this. That can grow and shrink automatically based on how much text there is inside it (showing number of coins)

I've attached the sprite setup I'm using as well. I cannot get this to work. I've watched so many videos and read the auto-layout docs and it's just not working.

#

The closest I've gotten is with the following setup. Which does auto-grow for text. But will not shrink when there is little amount of text.

#

If I could just figure out how to get this min width down, it would work! But I have no idea where this minimum width is coming from.

#

any help would be much appreciated

sterile wedge
#

Or is it part of the background

#

Oh, I see you have it almost set up..

#

I think you can try adding layout element on the text

#

And set the min

acoustic hedge
#

On the actual text mesh pro game object?

#

I just tried that. Still no luck. The text just wont reduce beyond the seemingly arbitrary width it is now

sterile wedge
#

Just to be clear, is the issue that the background image isn't shirking further beyond a specific width?

acoustic hedge
#

@sterile wedge yes, it is sliced. In the original message I attached a screenshot showing the slicing

acoustic hedge
#

But it won't shrink down beyond a certain point

#

Thank you for your time btw.

sterile wedge
#

Sorry I just pop in and out

ebon ermine
#

Hey :> I'm trying to make this cool slider where the gradient fill would look smooth with a mask and I'm wondering, how do you make it so that a UI element doesn't scale at all with its parent? Cuz my fill scales with my mask, and it gives... unwanted results. Overall, is there a way to disable this completely?

sterile wedge
ebon ermine
#

still behaves weirdly

#

I recorded it wait

#

so yeah, either way it doesn't behave like I wanted it to...

halcyon basin
#

Hey, how do you render a World Space Canvas over the entire game? I thought world space canvas meant it would render on top of everything in the scene (models/vfx/etc), but seems like it only places it in physical space. I've looked at documentation/tutorials/threads but can't seem to figure out why it won't render on top.

I've tried setting the Layer and Sorting Layer to UI but it still won't render in the camera. I set the CameraUI to "see" only the UI layer.

Do I need some kind of special script/shader to render reticles over the entire world (but beneath canvas)?

halcyon basin
#

nvm figured it out. Had to create a separate camera that follows the main one. Same standard settings, it just needs to be moving in world space. Previously it was static (sitting in one spot like the UI) so it was off-screen

nimble orbit
#

Using ISelectHandler, how would I tell if I'm being selected by a gamepad or not?

livid bay
livid bay
mortal robin
#

set what to

#

if you want the size expansion to go down you need to set the pivot to the top

#

right now your pivot is in the middle

#

so it's expanding both ways

livid bay
#

like this? or is it the blue circle?

mortal robin
livid bay
#

nothing visually changes when i change it other than the pos but it worked thx

#

why is pos x saying 408 tho

#

shouldnt it be 0

mortal robin
#

I would have expected a pivot of (0.5, 1) for this setup

obtuse minnow
#

hey guys, I'm new with unity, I'm trying to develop a mobile game and everything was going great but things started going downhill when I tried to make it compatible with all the mobile platforms (hence different resolution) ... can someone please help? thanks in advance

#

I managed to fix the problem with background, UI images, UI textes and UI button, but I can't make it work for the loading bar
this is how it looks on "game window" (I know it looks bad, it's just a prototype)

#

this is how it looks on "game window" (I know it looks bad, it's just a prototype)

#

And this is how it is when I'm in simulator view

livid bay
#

is there a way to delete or edit this bar?

golden cave
obtuse minnow
#

so I don't need any kind of script?

golden cave
#

nope, not sure why/what you have a script for . . .

obtuse minnow
#

ok

#

let me try

#

let's say I want to keep the ratio/size proportional to screen size of the background

#

I just need to set anchor to this one

#

and it works fine

#

the problem manifests when I try to do this with this loading bar:

#

it doesn't keep the ratio/size proportional to screen size of the loading bar and it's filling

obtuse minnow
livid bay
#

when i build the game it comes in fullscreen ArtistThink

golden cave
obtuse minnow
obtuse minnow
obtuse minnow
# golden cave you're using a separate canvas for the ui. is the canvas scalar setup the same. ...

after some more research I found out that it's like if my purple panel is trying to keep the same distance from the borders of the screen, which is fine, until the space left by the the loading bar is different from the one occupied by the panel ('cause the loading bar is keeping the same distance of the screen borders as well)... is there any way to anchor the purple panel to the loading bar (like anchoring an image to another one) or another way of fixing this? thanks

golden cave
obtuse minnow
#

I'll record the screen and show you

golden cave
#

is the purple bar the fill area GameObject?

obtuse minnow
#

no

obtuse minnow
golden cave
#

i don't see a panel GameObject in your scene hierarchy . . .

#

i'm not sure which object you're talking about. from the pics, the purple bar should be the fill area of the loading bar, right?

obtuse minnow
#

but there's another object

obtuse minnow
#

u still there? @golden cave

#

I'm sorry to bother you but you're my only hope

golden cave
obtuse minnow
#

what do I need to adjust them to?

golden cave
#

there's no way i (we) can tell since it's your images and setup. just set the anchors where you want the loading bar to be, then zero out all the values . . .

obtuse minnow
golden cave
#

you shouldn't, the anchors are a percentage. it'll always be the same percentage of the parent image that it stretches along with . . .

obtuse minnow
#

let's say that to make it look normal I have those stats on the "FillArea" object (the purple panel)

#

and it looks perfect in "game" mode

#

then I change it to simulator mode (with a Samsung Galaxy Z fold2 in portrait mode) and this is what I see

#

which means I need those stats to make it look regular

#

it doesn't change them automatically, how can I do that?

golden cave
#

because you have hard-coded values for the position. Left and Right will always be set to 189 pixels away from the anchor . . .

#

you need to align the anchors of X to the inside of the black bar then reset the Left/Right values to 0 . . .

obtuse minnow
#

I LITERALLY LOVE YOU

#

OMG

#

it's 4am and I've been struggling on this for 4h straight

#

it works

#

please marry me

golden cave
obtuse minnow
small lava
#

hello, im building MainMenu and Pause Menu, so far it works good but!

#

when i press pause, it opens pause ui, then if i go to options menu, and close pause menu, open it again, it opens in last menu i've been, this case options

#

how to make it go always on that first pause ui instead remembering last chosen?

open prairie
#

Hey, what would be a good way to not get overlapping text with textmeshpro?

restive umbra
#

So I'm having a wierd issue where I made my UI elements a prefab and the buttons no longer work. It gives me this error, however I do have the reference set in the inspector.

You probably need to assign the pauseMenuWindow variable of the UIPauseMenuController script in the inspector.```
Everything worked before I made it into a prefab.
mortal robin
restive umbra
#

That's what it says but they are assigned, that's why I am confused.

mortal robin
restive umbra
#

Ok there is only one copy, now the prefab itself doesn't have anything assigned but the copy that is in my scene does

#

then here is the script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;

public class UIPauseMenuController : MonoBehaviour
{
    [SerializeField] GameObject pauseMenuWindow;
    [SerializeField] GameObject settingsMenuWindow;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void OnPause()
    {
        if (pauseMenuWindow.activeInHierarchy == false)
        {
            pauseMenuWindow.SetActive(true);
            Time.timeScale = 0f;
        }
        else
        {
            pauseMenuWindow.SetActive(false);
            Time.timeScale = 1f;
        }
    }

    public void PauseMenuResumeButton_OnClick()
    {
        pauseMenuWindow.SetActive(false);
        Time.timeScale = 1f;
    }

    public void PauseMenuSettingsButton_OnClick()
    {
        settingsMenuWindow.SetActive(true);
    }

    public void PauseMenuMainMenuButton_OnClick()
    {
        SceneManager.LoadScene("MainMenuScene");
    }

    public void PauseMenuQuitButton_OnClick()
    {
        Application.Quit();
    }
}
analog steeple
#

I want to make the image(left) to make it pixel perfect like the sprite(right). Ive set the image to native size. Why is the image so much smaller ?

quasi parcel
#

Your canvas reference pixel per unit is the same as your sprites?

#

If not make then equal then youll have to click native size again

thick sky
#

is there a way to disable the caret or atleast changing its width?

#

nvm fixed

tawdry ferry
#

it has some public fields for caret

tawdry ferry
hoary kelp
#

In case someone needs this, only took me 2 hours to get to this point:

If you want to show a inputfield only after a key is pressed, here is a way to do it:

        public void Open(char start_value)
        {
            gameObject.SetActive(true);
            input.text = start_value.ToString();
            EventSystem.current.SetSelectedGameObject(gameObject);
            input.selectionAnchorPosition = 1;
            input.selectionFocusPosition = 1;
        }
#

start_value is the keypress.

#

Can be gotten from, for instance, Keyboard.current.onTextInput += OnTextInput

#

Actually, scratch that, it's unreliable, too 😦

#

Is it not possible to keep a text field focused?

shut quarry
#

Hi all! Is it possible to prevent streching when trying to assign sprites to an Image that have different sizes and aspect ratios?

mortal robin
shut quarry
#

Thank you! Didnt see it at first because no sprite was assigned in editor

river meadow
#

Hey, am i allowed to post screenshots and ask for help here?

low pike
#

That is why you were told to come here and post screenshots..

river meadow
#

Okay, yeah- so my Unity tab is still loading up. but i'm having trouble figuring out what to do after it loads up for a start button.

low pike
#

"Unity tab" isn't a thing, this term makes no sense

#

I suggest going to !learn searching for UI and doing the UI lessons

onyx flowerBOT
#

πŸ§‘β€πŸ« Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/

magic walrus
#

i have a tmp input field and when i hit backspace the first time, the rect transform values are changing a bit. any idea why or how to stop that?

livid bay
mortal robin
livid bay
#

it doesnt seem to do anything tho

hoary kelp
#

Hey, I have come here today to ask you all for help. πŸ™‚

Does anyone here understand RectTransform? Like, really understand? Grok them, even?
Please teach me, sensei. πŸ™

I'd like to know, for a "window" that I'm rendering:

  • the center of its title bar (or rather - I'd like to place it so the center of its title bar is under the current pointer position in PointerEventData)
  • the center of its title bar WHEN ROTATED +/- 90Β° around Z
  • optional: offset it from the edges of the screen so that it no longer overlaps the edges.
  • optional: the above, but if rotated +/- 90Β° around Z

Sample video shows my dockable window, but I'm struggling with:

  • docking it centered to the Y where the mouse left the screen
  • restoring (un-rotating) it under the mouse, e.g. with the mouse cursor at the center of the title bar.
  • possibly moving it back into the screen on double-click (which I use to minimize/maximize already)

The window is a vertical layout group containing 3 elements: Title, bar, a search bar (always hidden in video), and the content area (also hides on docking/minimizing).
Second pic shows what the anchor currently looks like for it. (the anchor is at the top left of the canvas)
Third picture shows the anchor of the title bar.
...
Any input or suggestions greatly appreciated, I'm really confused by now, even though I'm very close and just need to fix up my "FinalizePosition" method that gets called in OnEndDrag.

#

My problem is not with rotations of transforms, it's with expressing screen coordinates in UI space, and vice versa πŸ˜„

livid bay
mortal robin
mortal robin
hoary kelp
trail trail
#

I noticed the font in my game is a bit choppy/missing AA.

Any thoughts on this? Using TMPro.

hoary kelp
#

Needs a little bit of polish but is totally usable now.

reef hill
#

Hi there! Quick question, if you have a scene with a lot of UI that gets displayed throughout the game, what's common practice for having the elements displayed in the scene view (before playing the game) –for example,Β should they start in-active in the game, or start active and hide them on start? Any thoughts would be helpful here!

Thank you

reef hill
hoary kelp
reef hill
#

Ok thank you

trail trail
hexed pulsar
#

I want to ask to guide me. It is more about world space canvas. Long time ago I was creating canvas via sizes like width x height -> 1024x1024 and then scaled it down to fit my 3D environment. But now I am thinking was it the scales like 0.001 or 0.003 looks quite weird. And why I did not just reduce the width and height by that amount and leave scale alone. Performance wise I believe there is no real difference, right? But workflow which is better workflow, have world canvas at high numbers representing resolutions and reduce with scale. Or reduce the scale immediately for all worldspace canvases?

I believe I did this because of world space fonts were not scaling well, aka if your set Height x width to 0.01024 x 0.01024 the fonts sizee messes up and getss choppy

#

and it is better to have one canvas with multiple images in world space or have canvas for each image if they are not connected and static.

spark sage
#

hello, i have two buttons on screen that move object left and right and i use the Event Trigger component to fire off PointerDown and PointerUp events to detect when the button is being held and released
the issue i have is that i want to be able to drag the cursor between the buttons and them activate respectively
my only option is to use PointerEnter and PointerExit events or is there a simpler solution for this situation?

idle girder
#

All of a sudden my textmeshpro text disappears when its over gameobjects (in the game view), any idea what could have caused this? Canvas is set to scale with screen size and render mode is screen space - overlay

trail trail
#

I can obviously, disable Navigation on the objects, but, that then removes controller support.

tranquil quail
#

Hello everyone

#

I want to make a UI which looks like a UWP controls and animations.

#

Are there any UI libraries which has similar looking of UWP controls and animations?