#📲┃ui-ux

1 messages · Page 15 of 1

torn pendant
#

when I have a horizontal layout group like this, how I can force all children to be the exact same width? (The outer white rectangles are the children, the first one contains two red retangles, one of which contains multiple small white rectangles)

#

in css I would do grid-template-columns: repeat(4, minmax(0, 1fr))

#

I can somewhat acheive it with Grid Layout Group, but I have to set a fixed pixel amount for the cell size, which I dont want to do, I just want Unity to distribute the available space evenly

low pike
#

Grid layout element isn't really useful if you want dynamic, I've never used it

#

There's a "layout element" component, with various settings on for sizes, that might be what you need

torn pendant
#

ok Ill check it out, thanks

livid bay
#

theres something sussy going on. When i enter play mode the content becomes smaller, but i just need to touch it for it to go to the intended size.
and when i build the game everything is on top of each other, like what happens second 1 when i enter play mode ArtistThink

#

theres no data being inserted programatically or anything

trail trail
#

So, did Unity just assume no one would ever use Dropdown menus with controllers? Because that functionality just doesn't work out of the box....

mortal robin
#

i mean yeah dropdowns are not really ideal for controllers. Something like a carousel is more typical

trail trail
mortal robin
#

I see this in games all the time

#

probably precisely because dropdowns are weird for controllers

trail trail
#

oooooo. That is a valid solution...

#

I shall bring that up to my artist. Thank you.

#

(For some reason when you said carousel I was thinking like.. seeing the options on the left and right, and having it actually spinning. I blame lack of sleep)

mortal robin
#

nah it's probably not called a carousel I just don't know what it is called

celest remnant
#

is there anyway to filter img not from the asset?
it shows too many unwanted textures

low pike
rapid ferry
#

Why does my build turn out like this compared to the editor?

low pike
#

possibly the anchors messed up..

#

Did you design your UI with the game view on 'free aspect' ?

rapid ferry
#

I have reason to believe it's down to the sprite system and how i've set it up though

#

But it would't make sense as to why every single UI image would tile

somber mortar
#

Hello, I am making a game and I need icons/pics but I don't know how to make them does anyone know of a course (free) that would teach me how to make it and make it look good also preferably if it also teaches rounded corners.

solemn wind
#

Any one can me suggets plugin or way for Expandable Recycler scroll view ?

marble sapphire
sterile wedge
stable plover
#

Hey there. I have a UI button that takes in an On Click() function from a game object. But the script attached to the game object is not appearing and thus I cannot choose the function I need. I attached some images. Anyone know why this could be happening?

sterile wedge
stable plover
sterile wedge
#

may I see the function you're trying to call

stable plover
sterile wedge
#

just to check, no compile errors, right?

stable plover
#

Yeah none-no-rino

sterile wedge
#

I believe it's the parameter

#

but do check out that link and perhaps save it for future use 🙂

stable plover
#

Okay thank you so much!

sterile wedge
#

you're very welcome

candid gale
#

hey, any good solution tips when we have seperate UI camera and game gamera, how could we use same particle effect prefab on both? scaling becomes an issue

low pike
#

Look up 'prefab variants'

candid gale
#

yeah sure we can have variant for both, was wondering if there is anything one could do with scripting

low pike
winged jetty
#

How to deal with sprites with 1 pixel borders if they can disappear in some specific resolutions? I managed to keep constant size for a line through code (pic 3), but is there a way to do the same with a more complex images?

deft sierra
#

is it possible to have bigger space inbetween certain rows in layout group without wrapping item in empty gameobject shenanigans? I need bigger space between 2nd and 3rd rows as thats where selected items end and possible items start but whole list is scrollable

low pike
#

You can have an empty game object in between those rows, with the height set to what you want. No need to parent those in empty game bojects

deft sierra
#

how would that work grid layout enforces same cell size and it doesnt care if element is bigger than that

#

actually my prior "solution" wouldnt work either cause I need to have same cell size for everything unless im missing some option

#

yea so if I could edit size and not scale I could get 4 empty elements to make a spacing for me perhaps but layout group wont let me

low pike
#

I avoid grid layouts, as the cell size is fixed - they don't resize with the screen.

#

I use nested vertical and horizontal layout groups

#

If you want to keep thr grid layout though. You'd need to have 2 grid layouts.

Vertical layout group on the ScrollArea game object, with 3 child objects.

ScrollArea with vertical layout

  • GridLayout
  • Spacer
  • GridLayout
deft sierra
#

nice ill try this ty

reef hill
#

Hey I am confused about rect transform and setting width and height vs the scale of UI elements in the canvas, is that just me? If any has resourcs they can point me to would be helpful!

Thanks!

low pike
#

Always keep the scale of all UI elements to 1,1,1

#

Change the width/ height to size UI to how big you want them

#

The canvas won't be a scale of 1,1,1.. but that's ok

reef hill
#

Ok thank you @low pike !

reef hill
low pike
#

you shouldn't be touching the scale ever

#

you also don't touch the transform when dealing with UI, you always manipulate the RectTransform, so yeah.. use .sizeDelta , but the only time you should be changing this is for animation

reef hill
#

Ok, I understand, thank you!

low pike
#

Just so you know why you should always keep a uniformed scale (1,1,1)..

if you have parents/ children with different scales, and then you try to resize them (either manually or because the screen size changed) then nothing will scale correctly and it'll all go out of whack

reef hill
#

Makes sense, this has happened to me, which prompted me to ask the question, thank you for your help!

low pike
#

No problemo

The same thing will happen with normal game objects too, but you have to scale them by the transform

reef hill
#

Ok I will keep it in mind thank you!
Additional question(since your answers have been very helpful!) - should the canvas typically be of square shape? Or should it be resized to be the same shape as its children?

Thank you!

low pike
#

The canvas will be the shape of the screen

#

Never develop UI with the game view set to 'free aspect'

reef hill
#

Ok thank you!

deft sierra
#

whats up with this stuff if I dont use content size fitter I cant scroll down if I do use it my vertical group default position is in the middle of list

#

I did have same problem before I just set it through code through scroll rect verticalNormalizedPosition property before showing list but im at this again like bruh

low pike
#

The scroll area needs to be the size of the children. The content size fitter just auto does that for you, if you don’t use that then set the height of the scroll area manually on the rect transform

reef hill
#

what's the proper way to resize a slider without the handle knob stretching in weird ways?

#

Thank you!

astral current
#

Is there a way to 'stretch to safe area' or something?

#

This is a Samsung s8 vs. Iphone 12

dense crystal
sterile wedge
sleek cipher
#

is there a way to have this fill amount be symmetrical?

#

so like the fill drain heads towards the center like Halo Reach for example

sterile wedge
sleek cipher
#

eye sea

#

Occam's razor at it's finest

stone flint
#

Hey 🙂 Does anyone know why i cant drag and drop this in there? It is part of a prefab, is that the reason?
in the code i used:

public Dropdown ColabDD;
#

(also does this go here or in the toolkit one?)

low pike
#

Is it UGUI or UIToolkit UI?

frosty pewter
stone flint
#

is that a different command?

stone flint
#

well that makes a lot of sense then 😄
thanks a lot ill take a read ❤️

small lava
#

is it possible to have UI canvas/image slighty under angle? so its not pure flat toward camera but angled?

sterile wedge
#

Anything except overlay

reef hill
#

Hey does anyone know what these errors are from? Ive been receiving (and ignoring them) for a while now. Thank you!

mortal robin
reef hill
#

Ok thank you @mortal robin

rapid ferry
radiant sorrel
#

why dont i see the little orange square on my inspector? (my inspector is black, his is white)

radiant sorrel
#

nvm i fixed it sorry

rapid ferry
#

Please HELP! I am using 2023.1.0f1. The first image was in a build, the second was in the editor. I did mess around with the video/graphics settings before I built the game. I have been stuck at this for days. Everything keeps tiling in the build but not in the editor.

mild kernel
#

Have you tried the LTS version of Unity as a baseline to see if it at least works there?

rapid ferry
mild kernel
#

Well it's not normal, so likely it didn't ... because it shouldn't.

#

But instead of trying to fix the issue, you need to find out when and where it started.

rapid ferry
#

I've tried diving into the github commits, however I had not built the game whilst I was messing with the graphic settings

#

So I wouldn't really know when it started

mild kernel
#

Can you not make builds from some old commit?

rapid ferry
#

It took about a day to compile all the shaders

mild kernel
#

Right, well, rolling back and building would be your best bet. But if not that, then at least verifying LTS.

#

Which you'll still need to compile for ...

foggy tulip
#

Is there a way to make ScreenSpace rendered in perspective?

I have a mostly UI Toolkit project, but I want an effect where a Playing Card flips over and it currently looks quite bad because there is no perspective. I tried making the card UGUI instead and in Screen Space - Overlay, it is still ortho. I swapped to Screen Space - Camera, but then it can't be rendered over the UI Toolkit elements.

Am I just screwed?

mortal robin
#

if you're looking for an MTG arena style thing - you should be using 3D objects for your cards

foggy tulip
#

But I think I'm coming to the conclusion that UI Toolkit just isn't fit for more complex systems yet.

mild kernel
#

Even with normal screenspace UGUI, you wouldn't be able to do perspective. I'd imagine in both cases you need to fake it with scaling it big (lifting the card) and then scaling it horizontally (flipping).

elfin pendant
#

This canvas pops up in the scene view but not in the game view. It works perfect when I die before defeating the "boss" but after defeating the boss it stops working. No errors are thrown. Any ideas?

grand citrus
elfin pendant
grand citrus
steady badge
#

Hello, i have a little game with some ui and need to create a menu for upgrades, do i just create the window of it on the existing canvas and enable/disable it or is there some more proper way to do it?

mystic solstice
#

New to Unity so.... How do you get a "Screen Space - Overlay" Canvas to appear - in editor view - as you'd see it in the game? I want that so that I can more easily place UI elements on the Canvas and don't have to worry about things like perspective. The docs mention a "Fit Canvas" button but I can't find that. I tried double-clicking on the Canvas and that alternates between bringing it into view (but not perfectly aligned - basically a projected plane that consumes about one-third of the total screen real estate so the UI is very small unless I manually zoom in and orient the camera) and zooming in on it such that you can't see any of its elements (i.e. camera seems to be on the Canvas' plane so you're looking past its projected elements.) Once I jump into the game everything shows up as you'd expect - the button that I placed at the top left of the Canvas is at the top left of the display and stays fixed there regardless of where I move the camera. Essentially, I want to be able to see the Canvas and move the UI elements around on it like it shows up in the game.

low pike
#

Press the 2d button on the scene view -> select the canvas -> press F

#

also, press T to use the UI gizmo tools

#

To go back, toggle 2d off and select something in the game to focus on (F)

mystic solstice
#

I had tried the 2D view and that half worked - doesn't fit the Canvas exactly (or even close) to the screen size (without my manually zooming in maneuvering.) Is there a way to address that bit?

quasi parcel
low pike
#

I don't fully understand your problem,that's how I always work with UI and don't zoom in/ move around unless I want to get closer to something

#

record a vid?

mystic solstice
#

When I focus ('F' key or double-click) on the Canvas the camera alternates between two views. The first is close to what I want, especially if I'm in 2D view. That is, the Canvas shows up without any perspective and is centered on the screen. The problem is that it doesn't fill the screen like it does in the actual game and instead consumes just a small fraction of the visible real estate - roughly 25% so it's actually zoomed out pretty far. Placing a lot of UI elements precisely on such a small display is difficult. To address this I manually zoom in to the Canvas and get it pretty closely aligned with the full extent of the display. Unfortunately, that effort is lost as soon as I maneuver the camera to look at something else and then seek to return back to the Canvas (via another focus operation), which once again occupies (by default) just a small fraction of the display.

mortal robin
#

Make sure you have the Rect tool selected

#

And note that the canvas is not supposed to line up with your 3d scene in scene view

#

It will be much larger than your scene typically

#

Use game view to preview what it will actually look like in the game

mystic solstice
#

Yes, good point - the UI presentation in Game View - which is identical to being in game mode itself - is exactly what I'm after with one shortcoming. Is there a way to select UI elements in that mode - at least those that are a child of a "Screen Space - Overlay" Canvas - and move them around the screen? I can do that via typing into the Pos X/Y/Z fields - would just be way more convenient if I could drag the UI elements around the Canvas like I can in Scene View.

sharp belfry
#

I have a horizontal layout group with several elements with left anchors - when I grab an element and drag its width, it stays anchored on the left side and resizes on the right, causing the elements to the right to also change their position - this is good. But when I change its x size through the inspector (and therefore through code) it resizes relative to its own center and doesn't effect anything else in the layout group. Wtf?

#

Oh, and just discovered - if I change the element's width when the game isn't running, then it resizes while respecting its anchor and works normally. But if I do the same thing while running it resizes relative to its center

#

game not running - change width to 180

#

game running - change width to 180

#

(from width 300 in both cases)

#

(if I drag it with the mouse then it works as expected whether game is running or not)

sharp belfry
#

Eventually figured it out. Need to change pivot point x to 0, and also have to force the layout group to rebuild inside the coroutine which lerps the resize

halcyon basin
#

Hey, is it possible to mask out an Image material in the UI? It seems like Mask doesn't work in the UI if the image is using a custom Material, it does work with standard sprites though. Is there a way to get around that? Or does it require custom code to force some kind of render mask?

I'm trying to mask down my "map fog" to my "compass" so it obscures the player map when in specific areas (code trigger). Maskable is checked but it appears to be ignoring it

tight hazel
#

hello

left oar
#

yo

tight hazel
#

ooh this channel will be useful later

left oar
#

so what is this ui object

tight hazel
#

it's a healthbar

left oar
#

alright and did u add a sprite renderer to the component?

#

or an image?

tight hazel
#

has a sprite render, image, and text mesh

left oar
#

so delete that sprite renderer

tight hazel
#

in that order

left oar
#

you only need an image

#

images show up on canvases, but sprite renderers don't

tight hazel
#

well the sprite renderer is the backfill color of the healthbar

#

wait no it is an image nvm

left oar
#

alright

#

now show me the scene view

#

of the canvas

tight hazel
#

so basically screenshot unity?

left oar
#

yeah

tight hazel
#

the actual game and camera are extremely small in comparison to it

left oar
#

yeah that's normal

#

check gameview?

#

also send a ss

tight hazel
#

oh i messed with the screen resolution dropdown and now it's here

#

i got it on camera at some point before

#

and then i havent seen it for 2 days

left oar
#

ok so basically the canvas things are resolution specific

tight hazel
#

mhm

left oar
#

so if you manually position them, it can mess up if you change the game resolution

tight hazel
#

yeah

#

so i imagine there's a better way right?

#

(i hope)

left oar
#

yes

#

just a sec i'll be right back

tight hazel
#

alright, no rush

#

just ping pong me when you return

left oar
#

@tight hazel im back

tight hazel
#

hellohello

left oar
#

so basically what you wanna do is change the anchor position of the object

tight hazel
#

the canvas?

left oar
#

no

tight hazel
#

the healthbar object?

left oar
#

the healthbar object

tight hazel
#

the healthbar object.

left oar
#

the healthbar object

tight hazel
#

the healthbar object?

#

so like where it's anchoreed on the whole canvas?

#

it's set to 0, -400, 0 right now

#

or do you mean this

left oar
#

so its is centered righ tnow

#

what you want to do is hold ALT and click the middle bottom one

#

the one below the outlined anchor

tight hazel
#

mhm

#

now it's exaactly on the bottom of the screen i assume

left oar
#

now you see that windmill looking thing

tight hazel
#

mhm

left oar
#

thats where the object is anchored

#

so it will positioned relative to that point

tight hazel
#

so its x y and z are 0 at that point

left oar
#

that's the new (0,0) basically

#

yeah

#

so if you move the y position up from there

tight hazel
#

it go up

left oar
#

it will always y amount higher than the bottom of the screen

tight hazel
#

and it's marked like a drafting chart yay

left oar
#

no matter what resolution

tight hazel
left oar
#

go crazy

#

but first try changing the resolution of the game now

tight hazel
#

mhm

left oar
#

and you will hopefully see that the health bar stays at the bottom of the screen

#

and it doesn't ever go offscreen

tight hazel
#

my friend with the dumb wide screen

#

will be

#

only mildly mad now

left oar
#

perfect 😭

tight hazel
#

hehe i can figure out making it a bit more scaling friendly later

#

for now it's on the screen

#

and it's mostly readable

#

and that's good enoguh

#

tysm!

#

and with that i think it's nap time

left oar
#

no problem

#

im surprised i was able to help honestly 😅

#

i'm also very new to all this, but i'm learning

#

have a good nap

low pike
tight hazel
#

no worries, i prefer the precision of typing in here over the mouse guided controls

low pike
#

You can still type in there, the rect tools give you more control than the transform one

tight hazel
#

oo noted

solemn pivot
#

I am trying to set to canvas rect transform's position in code.
What am I -supposed- to be doing to do this?

#

My code is broken and does nothing like I expect, so me posting it is pointless because I have no idea what I am doing

low pike
#

You can't move a canvas position. Unless it's a World Space canvas

solemn pivot
low pike
#

So you can't move the canvas

#

You can move the children RectTransforms around, is that what you mean?

solemn pivot
#

reading my own question I can see how that is confusing, I didnt word it well

low pike
#

You need to set the .anchoredPosition

solemn pivot
#

How do I set to the rect transform value of elements within a canvas, correctly

low pike
#

And the values you put in depend on the pivot and anchor setup

solemn pivot
#

anchor position in that gif is being sent to the curor's positon, but its nowhere near the cursor's position

low pike
solemn pivot
#

I said I am trying to move it in the canvas

#

because its a UI element, on the canvas, with a rect transform, not a 3D world, there is no 3D, no vector 3s at any point

low pike
#

I understood exactly what you want. Did you read beyond the title?

solemn pivot
#

"How to move a UI GameObject using Mouse Position in 3D World Space?"
why would I need to read beyond the title if the title doesnt pertain to my question?

low pike
#

Go read the first answer?

solemn pivot
#

its a bad title if the question isnt about 3d world space

low pike
#

I don't really give two forks about that, I didn't write it.

solemn pivot
#

k

#

okay I read it now, and it has nothing to do with my problem

#

world space is not my problem, 3d is not my problem

low pike
#

You read the first answer?

solemn pivot
#

Yes

#

I guess I'm just too fucking stupid to understand how their constant discussion about 3D space world points relates to my 2D question that hs nothing to do with world space

low pike
#

alright, well, I'm done googling for you

solemn pivot
#

k

low pike
#

Dumbass

solemn pivot
#

k

solemn pivot
old cape
# low pike Dumbass

Let's refrain from insulting people. I think they would end up with a world position with that?

sharp belfry
#

When I add a Mask to IconBackground, the Icon disappears entirely despite being situated on the background (only small portions extending beyond the background)

#

the heck?

#

without mask

#

with mask

mild kernel
#

Is the maskable property turned on?

sharp belfry
#

Rect Mask 2d works like it should. But that's no good since it's a rectangle and not a circle

mild kernel
#

Can you show the mask component?

sharp belfry
#

Hm, when I uncheck Show Mask Graphic, the Image doesn't disappear like it should either

mild kernel
#

Can you remove the GlitterMaterial so it's default

sharp belfry
#

huh, that made it work

#

K so you have to make a 'dummy' background with no material to child the icon to. Can't have both a mask and material on the same image. Feels like a bug? 🤷‍♀️

mild kernel
#

Your shader needs to account for it

#

But a workaround is faster

sharp belfry
#

Why is this text always setting itself to minimum size even when there's tons of room..?

#

(there's no layout groups or other components on the text obj involved)

#

Figured it out...

crisp flume
#

what is the best way to render a list of points on unity canvas?

#

is one image per point the only way?

neon nest
neon nest
crisp flume
#

no gpu instancing

#

?

#

custom shader

neon nest
#

ah

#

u guys use instancing but then positioning might be an issue

#

unless you are rendering thousands of points there is no reason to use instancing

crisp flume
#

Yes

#

A lot of points

neon nest
#

how many?

crisp flume
#

from 100 to 1000

neon nest
#

i see

#

I dont think u need instancing, should be fine with components

#

you should also try and render only what is needed etc

crisp flume
#

It is all needed

#

For a world map

#

Drawing path from player to some pin

#

I will try using normal images

neon nest
#

yea, go with the default, if that doenst work, then pull out the big guns

crisp flume
#

I think i found a way

#

to make it a bit more efficient

#

using image tiling

rapid ferry
#

Buttons not working for UI?

frosty pewter
rapid ferry
#

Thank u! Posted a thread

#

Problem solved^^

grizzled inlet
#

Help guys

jagged monolith
jagged monolith
copper fox
#

Anyone know how to force a TMP Dropdown to show more?
Right now it only shows (height wise) [total items -1], would love to have the dropdown have a max height for scalability.
I.e. at 1 entry be 1 entry tall, 2 entries be 2 entries tall, but at 3 entries + have scrollbar and still be 2 entries tall

serene compass
#

How do I make an area in my UI where images that enter that area go invisible?

#

So if half of an image were to enter that area, that half would become 100% transparent

tired inlet
#

indeed a good question

#

i tried a few things but no results

#

maybe with a ui mask?

#

but it is actually the opposite of what you want when using mask

stiff merlin
#

Is it possible for me to have a different layout for vertical aspect ratios?

On desktop this looks nice, but on mobile, I want to make it bigger so the text is more visible.

tired inlet
#

well your font is small by default

#

it would look ok if it was slighty bigger evne on the mobile version

#

there is a way how you can handle ui for different plattform but it is trickery and you would need to define all the plattforms available

#

you could also stretch the ui text holder completely so it covers the whole width which will also give you some more extra space to make the font bigger. This should be enough to make it readable.

stiff merlin
#

but not sure how to handle that necessarily

stiff merlin
tired inlet
#

yeah but i would not recommend doing this tbh. Just make your ui flexible so it automatically fits the width

stiff merlin
tired inlet
#

you could also make use of this:

stiff merlin
#

i believe that's only for the font

tired inlet
#

yep it is on the TMP

#

and if you add an aspect ratio on your panel where the text is it sould be what you are looking for

stiff merlin
#

one issue i've found with auto size is it makes the text wayyy too big for a given area, especially if there's only a word or two, and since this can have variable text i'm not quire sure how to handle that

#

i imagine that's what the "max" field is for but I need it to change depending on the height of the box

tired inlet
#

yeah you would have to find out. Unity´s ui system is very powerfull it provided a lot of nice options and features.

#

why is the video not playable hmm

rapid ferry
#

i think

solemn pivot
#

I've spent 16 hours trying to solve why this panel wont drag correctly and nothing I do is fixing it and im at my wits end trying to solve it

#

every single mobile app ever made has press finger -> drag

#

so why is it so unbeliebly difficult, why is nothing I do working

#

its literally three different vector2s, start, stop, yourfinger

#

unity's UI Canvas thing is so utterly dogshit but I'm not allowed to say or think or feel that because the REAL answer is that I'm a stupid worthless dipshit

#

and thats why im here now asking for help to solve this because I am too stupid to solve it myself

#

and im going to come back every single 8 hours, every day, until its solved

#

I cant even post the code because the code is like 30+ methods

#

and all of them are critical

#

and all of them are broken and worthles

#

    private Vector3 SetOffsetPosition(Vector2 touchPos, MobileCanvasUIElement uiElement)
    {
        RectTransform rect = uiElement.GetUIRectTransform();
        Vector3 touchInWorld = cam.ScreenToWorldPoint(new Vector3(touchPos.x, touchPos.y, cam.farClipPlane));
        Vector3 offset = rect.position - touchInWorld;
        uiElement.SetTouchOffset(offset);
        Debug.Log("Rect Position: " + rect.position);
        Debug.Log("Mouse Position on Canvas: " + touchInWorld);
        return offset;
    }```
#

do you see why this is fucking up its intended purpose?

#

all SetTouchOffset does is store that value

rapid ferry
#

or you need to change its pivot position aswell

solemn pivot
#

im 90% sure its my code though because without any code, the panel doesnt do anything.. since there's no code

#

i just want to press my finger on it, and drag it, and have it be dragged, along a line

#

why is that too much to ask for :/

rapid ferry
solemn pivot
#

ive tried assigning to position, to anchor position, ive tried offseting every possible variable from every other variable in all 8 different coordinate spaces Unity has

#

none of it works

#

I dont understand why its so immensely nontrivial to just touch and drag a thing

rapid ferry
#

i dont remember, search it up, use google

solemn pivot
#

I have been

#

I can barely find anything because apparently im the only one who's ever had this problem

rapid ferry
#

u could make it easier if u just make it in slider and just slide it off screen

#

scroll bar/scroll view actually , something like that

solemn pivot
#

what even is Slider?

#

Watching that video

rapid ferry
#

its an UI element that u can use without ur code, to just slide through scroll content

sterile jewel
#

Why Canvas component is blocking button on child gameobject?

sterile wedge
#

What is happening, and what do you want to happen instead

sterile jewel
# sterile wedge Blocking button? What do you mean

I am trying to sort particle system on layers and made empty game objects with Canvas component and different layers. Empty gameobject has an object with button and it doesn't work. But if I delete Canvas component, it works.

sterile wedge
#

I don't think you can have particles on UI

#

So your issue is you have a child button

sterile jewel
sterile wedge
#

The parent has canvas component

#

Is your issue that when you add a Canvas component to an object, the child button cannot be clicked?

#

Is that it?

sterile jewel
#

Yes

sterile wedge
#

Make sure your canvas also has GraphicsRaycaster

sterile jewel
sterile wedge
#

All interactive ones must have

sterile jewel
sterile wedge
solemn pivot
#

I am trying to debug the difference between spacial coordinates with canvas and world and screen positions.
In this picture, why is the selected canvas UI panel's anchor position (teal) so far to the left outside of the actual panel itself?

#

the values being shown are all in reference to an initial tap position on the screen

mortal robin
#

you ahve a right-center anchor on that element and a centered pivot, so really the -302 is just saying that the parent is 604 units wide and you have it centered (with a right anchor)

#

That's my interpretation anyway 🤔

solemn pivot
#
     InstantiatCanvasUIDebugPoint(debugTarget.anchoredPosition, "RectTransform Anchored Position");


    private void InstantiatCanvasUIDebugPoint(Vector2 position, string spaceName)
    {
        GameObject debugDot = InstantiateDebugObject(debugUIDotPrefab, position, canvas.transform);
        SetDebugObjectName(debugDot, spaceName);
        Color textColor = SetDebugObjectColor(debugDot);
        SetDebugText(debugDot, spaceName, textColor);
    }```
#

in the above, the instantiated dot is made at debugTarget.anchoredPosition

mortal robin
solemn pivot
#

Yes 🤔

mortal robin
#

Instantiate expects a world space position

#

but anchoredPosition is a canvas space position

#

so it's not really a correct thing to do

solemn pivot
#

Hm okay, what is the reccomended proccess for instantiating elements into the canvas in that case?

mortal robin
#

Most of the time I'm doing that they're going into a layout group, and I just use the Instantiate(prefab, parentUiTransform) form

#

and the anchoring etc will already be set up in the prefab and it "just works" ™️

#

If you want to preserve that specific anchored position I suppose you can do this:

GameObject debugDot = Instantiate(debugUIDotPrefab, canvas.transform);
RectTransform rt = debugDot.GetComponent<RectTransform>();
rt.anchoredPosition = position; // where position is the anchored position you want it to have```
solemn pivot
#

Thusfar on my end sadly nothing has just worked™️ so I am trying to visually and numerically debug the exact relationship between everything UnityChanThink

mortal robin
#

good plan

solemn pivot
mortal robin
#

basically yes

solemn pivot
# mortal robin basically yes

I went to impliment this but I have reached confusion.
You're not setting the debug dot's position, you're setting the debug dot's anchor position. I want to see where the other thing's anchor position is, am I misunderstanding something here? Shouldnt we be setting to the debug dot's position to the anchor position of the other thing?

mortal robin
solemn pivot
#

I went to pass in the reference panel's anchor position as a vec2 'true position' but realized you arent assigning to that value

solemn pivot
#

because I need/want/think that I need/want how all these positions inter-relate, not just to the canvas itself but things in the canvas

#

so atm all of the canvas part is being done relative to that asset

#

the values of position and scale and anchor and all of that are entirely arbitrarily set for no reason other than to make them not identical to the size and shape and everything of the canvas itself

#

should I be doing something else? Is that not what I should be trying to come to comprehension?

solemn pivot
#

I am not comprehending why its anchor position is way over here 🤔

#

the debug dot rt's position is being set to the anchor position of the reference panel, which is aparently -16459x in the canvas

#

things like this are why I am so confused and having so mant difficulties, why is the anchor position at -16459x? What am I supposed to be setting to? There are just too many "positions" in coordinate systems that all have nothing to do with eachother :/

#

I am trying really really really hard to not get distressed

#

but its not easy

solemn pivot
solemn pivot
#

does this data help?

#

this as well

#

the end goal I am trying to achieve is to be able to take input value in space X, and return output value in space Y

#

use case example - take in finger touch position, use it to drag a panel 😐 which is not going well

#

I have the data, but I am not sure what to do with the data, what to infer to get results

#

Im still poking at it

#

but I am realizing I dont know what I am doing or what result I am even trying to get

#

I have Data™️ but no comprehension what that data means or how to use it

#

I guess the most practical result would be that when I tap, every dot appears in the exact same space? But not like, I brute force them all to be in the same space, that each are in the same space relative to themselves but in whichever input space I sample?

#

eg I can tap, and every dot appears at the pixel coordinates in world space that Screen Space Finger Position is at

solemn pivot
solemn pivot
#

are these three assumption methods correct?

#

am I making a mistake from minute 1 of trying to solve this?

#

seems correct so far

#

step 2

#

assigning that position to the anchored position

#

expected behaviour: cube is on the dot

#

actual behaviour: cube is not on the dot

#
    private void CaptureFingerInitiatePress(ET.Finger finger)
    {
        if (debugClick)
        {
            //This value is in screen space. Screen Space is pixel dimensions of viewport or physical device.
            Vector2 fingerSpot = finger.screenPosition;
            Debug.Log($"The value {fingerSpot} is the finger's screen position.");
            Vector2 canvasSpot = ConvertToCanvasSpaceCamera(fingerSpot);
            Debug.Log($"The value {canvasSpot} is the relative canvas space position of the finger's screen position.");
            InstantiatCanvasUIDebugPoint(canvasSpot, "canvas relative to finger");

            debugTarget.anchoredPosition = canvasSpot;
        }
    }```
#

am I even supposed to assign to AnchorPosition? How are you 'supposed' to move rect transforms?

fathom roost
#

I know you can use the <color> tag to make TMP text colored, but can you specify an RGB or hex value? I tried <color="#hexvalue"> but that doesn't work

fathom roost
crisp flume
#

I had fun Joining Newbies Genshin World to steal their chests in Genshin Impact Co op... now I feel bad for scaring them :(

If you like the video, be sure to like and subscribe! https://bit.ly/3Fq9e0k

Nuzlocke Playlist 👉 https://www.youtube.com/playlist?list=PLwn8q1k5Zg44nkiliWGIQmM5uwzhABig5

Re:Genshin Playlist 👉https://www.youtube.com/playl...

▶ Play video
#

Is there any way to animated vertical layout groups like that?

#

<< the obtained list

mild kernel
#

Not automatically, no. You would have to build that yourself.

hoary kettle
#

uhh not sure if this is the right category but... does anyone here know how to make UI elements have a neon style efect

#

basically glowy edges for sprites

#

I searched up some tutorials but they only work in 2D

#

but I have a 3D game with 2D UI elements

mortal robin
#

you mean you input the white points and get the curve?

#

Use bezier curves

#

LineRenderer?

jagged monolith
#

Freya Holmér is working on a splines library that integrates with her Shapes plugin

mortal robin
#

but you can also draw this with GL lines, or LineRenderer, or a shader

#

probably?

#

could also be a dynamically generated mesh

celest remnant
#

do you guys have any tutorial about red zone like this?
or any key words about this

#

this red zone is like evade from this

sterile wedge
#

you just need to find out these things

  1. how to spawn objects
  2. how to set their position
  3. how to make them scale up over time
    @celest remnant
#

Game dev is not "how to make hit warning indicator". think in more generic terms

celest remnant
deft sierra
#

can I prevent ui elements from resizing when I unparent them? I had issue with them prior if I instantiate without canvas it needs to sit on as parent, element expands massively and it doesnt resize anymore to proper look with parenting but now I really gotta make them homeless for a moment kekW

#

oh nvm its obvious they always need canvas to be in but this weird expansion threw me off

meager quartz
#

how do we feel about this as a ui layout
I'm not sure if health / mana being all the way down there will be easy to parse if youre looing at mid screen thinker

#

alternative is something like that

cloud crow
#

I'm trying to make this image scalable to all ratios but it scales awkwardly. It's just a menu in the center. I'm a beggar so anyone help please

sterile wedge
#

and please take a screenshot, not a photo

#

be more specific on what's wrong and what you want to happen

cloud crow
# sterile wedge be more specific on what's wrong and what you want to happen

Oh sorry for that i apologise. Also my problem got fixed i changed the match of canvas scaler and it worked fine. The problem was that it was stretching too much in horizontal. And even though i tried anchor points to stretch vertically it didn't like a messy thing. But now it's fixed 👍🏿 also thanks for telling me I'll try to be more specific next time and share screenshot

mortal robin
#

Postprocessing

rapid ferry
#

i think if u play with bloom scattering u could get there

nimble orbit
#

I want to get an event when a selectable is either clicked or activated with a gamepad

sage torrent
#

Hello I'm mostly a programmer looking for feedback on UI layout for a mostly vertical climbing upwards type game. I looked at downwell as a reference but was wondering if people here might have suggestions for improvement. Trying to set up both portrait for phone and more square/landscape for desktop/web

marble aspen
#

I have a text but on each device it has a different position, someone told me to change the resolution to fit mobile but now I've been told there is no resolution for tmp text

tired inlet
#

because you are not using anchored position but manually puttinh the ui element on the screen

marble aspen
#

I have been using it, no use

tired inlet
#

can you show the inspector of one of your ui elements

marble aspen
mortal robin
#

to learn how to use anchors and pivots etc

marble aspen
#

thanks!

dreamy salmon
#

In a 2d core project
i tried to create a ui raw image
put the image in the raw image
dragged it over the camera
but the camera doesn't see the image it's still showing the background color

#

ok my issue was that i should put my stuff over the canvas and not over the camera

nimble orbit
#

I have a custom UI element that sits behind a TextMeshPro text object, and I'm using the UI element to render colored rectangles behind the text. Think like the <mark> tag in TMP rich text but instead of rendering in front of the text, it renders behind. I'm doing this for a terminal emulator in Unity, and I've got it almost working fully. Game's framerate is also much better with this technique than it was with my old one.

Problem is I've screwed up the measurement of line heights. Not sure what's wrong with my math but the rectangles are ever-so-slightly taller than the actual lines of text TMP is outputting. You can see here how the text cursor looks like it's a line below where it should be

#

Clear the terminal though and it looks fine

#

10 linnes down though, and it starts to look slightly misaligned

#

This is the code that does the font measuring to figure out how wide and tall a color cell should be

#
private void CalculateTextSize()
{
    char ch = '#';
    var style = FontStyles.Normal;
    float fs = fontSize;
    
    // Compute scale of the target point size relative to the sampling point size of the font asset.
    float pointSizeScale = fs / (font.faceInfo.pointSize * font.faceInfo.scale);
    float emScale = fs * 0.01f;

    float height = ((font.faceInfo.lineHeight - font.faceInfo.underlineOffset) * emScale);
        
        

    float styleSpacingAdjustment = (style & FontStyles.Bold) == FontStyles.Bold ? font.boldSpacing : 0;
    float normalSpacingAdjustment = font.normalSpacingOffset;

    // Make sure the given unicode exists in the font asset.
    font.TryAddCharacters(ch.ToString());
    if (!font.characterLookupTable.TryGetValue(ch, out TMP_Character character))
        character = font.characterLookupTable['?'];
    float width = (character.glyph.metrics.horizontalAdvance * pointSizeScale +
                   (styleSpacingAdjustment + normalSpacingAdjustment) * emScale);
        
    Vector3 scale = transform.lossyScale;
        
    this.characterWidth = width / scale.x;
    this.lineHeight = height / scale.y;
    UnscaledLineHeight = height;
    UnscaledCharacterWidth = width;
}
#

Widths are fine, but the height is slightly off

#

I didn't write this code, got it from an ancient forum post or something, can't really remember.

#

I've tried messing with the way the height's calculated though and I just can't seem to get it

nimble orbit
#

Figured it out for this use case

#

font size + underline thickness is what I want

loud cargo
#

I have an object in the scene I want to receive UI events, but, for some reason, doesn't, despite me implementing the right interfaces. The eventsystem only seems to distribute events to UI objects, like buttons. Can I flag my object for receiving events from the EventSystem somehow?

mortal robin
#

(or the 2D equivalents if 2D)

astral oriole
#

they worked before but now they seem to have 0 functionality

#

im sure its not unity but rather something im not seeing (please ping when replying tysm)

sterile wedge
#

but from what I can see, you seem to be missing the EventSystems in your scene. that's the issue. the link covers that

sterile wedge
#

an image with a circle texture? 😅

jagged monolith
deft sierra
#

I dont understand how buttons exactly work I have disabled every single thing button has as raycast target apart from button itself and it still doesnt click through images on top of it so only white area shown is interactable

sterile wedge
#

you can check that in the EventSystem's inspector

#

and if there's nothing on top of it, can you interact with the button in the first place?

deft sierra
#

you mean this event system?

#

nothing changes when I click on anything and yeah button is interactable

#

in the white area which is the actual button with no images on top

sterile wedge
#

see that link to learn how to use it to identify what you're currently detecting

#

it's pinned in this channel

deft sierra
#

it was text btw now million dollar question why starter button isnt blocked by its own text but when you add your own it now becomes an issue kekW

rapid ferry
foggy tulip
#

I have UI Elements that look fine in edit mode (Screen Space - Camera) but when I play, they are moved thousands of pixels off screen. Anyone know why this is happening?

mortal robin
#

it will show the full extents of the canvas

#

which represents the screen

#

arrange your UI as such

#

you should not be arranging the UI according to your game world

umbral geyser
#

Does someone know a solution for the following solution?: I have an Overlay Canvas with Joystick, some Buttons and an image, which works as a swiping-field to look around with the camera. Now I've added a World-Space-Canvas with a button, which I want to click. However, the Overlay-Canvas (The image swiping field) is blocking it.

mortal robin
#

(leave the joystick and buttons on the overlay canvas)

umbral geyser
#

Ohh okay, thank you so much!

deft sierra
#

is there a way or trick to update layout group manually through code I instantiate text elements on it but they have content size fitter on them and last text is always inside of second last my guess is layout group puts in text with default height then fitter expands it but what to do

#

actually found solution just had to do it next frame + randomize spacing a bit but idk CringeHarold ```IEnumerator Refresh()
{
yield return null;

    verticalLayout.spacing = Random.Range(19.99f, 20.01f);
}```
umbral geyser
mild dome
foggy tulip
#

I'm using UGUI. I have a "hand of cards" and when the player hovers over one, I'd like to have it rendered ontop of the other cards. I initially thought that adding to its Z-position would work, but that doesn't seem to be the case. Moving it to be last on the hierarchy affects its position in the layout. Is there a known solution for this?

mortal robin
#

For card games though honestly I'm a fan of not using UI elements at all - use spriterenderers and let them fly around more or less in 3D like they do in MTG Arena and Hearthstone

#

you'll have to write some logic for fanning them out and stuff but it's not that bad compared to the benefits IMO

jolly plaza
#

this is what happenes when I move my button

mortal robin
#

Seems you're doing something very strange

jolly plaza
mortal robin
#

Thge green outline is a box collider

jolly plaza
mortal robin
#

and why are you moving it, apparently, instead of the ui button

jolly plaza
mortal robin
#

Colliders most assuredly are not part of the default button you create through the menu

#

you need to show your hierarchy and the inspector of the selected object - otherwise I have no idea what you're doing tbh

jolly plaza
#

I press ui > button - textmeshpro

mortal robin
#

And the inspector for it

mortal robin
# jolly plaza

1 you're doing this at runtime? What happens when you're not in play mode?

Also what happens if you use the Rect tool instead of the move tool?

jolly plaza
#

It's fixed now

foggy tulip
umbral geyser
mint blade
#

Hi guys, i need some suggestion, i am new in unity, lets say i want to make software in unity,in which i will have tool bars on top and left side, and view port or game view in right bottom side (which is in red in picture attach), can anyone guide me which approach should i use to divide screen and which approach should i use to make buttons on top and left in tool bars

mild kernel
#

Approach in what sense? You can use UGUI or UI toolkit, but as for how in either, that's just something you need to learn the basics of by following some intro tutorials to UI.

foggy tulip
#

Are there any downsides to mixing images and sprite renderers for UI?

mild kernel
#

Yes, mainly that sprite renderers can't be used on the UI.

cinder sentinel
#

for simplicity, is it recommended to have all ui elements have z position of 0?

#

bc sometime when i create new object i get things other than 0 so each element has something like 1, 0.333 , -3000, etc

#

for z value

tough wind
#

Might be a noob question, but how can you automatically fit a parents width/height to its children?
I have a horizontal layout group with a bunch of items inside that will vary in number, the overall width of the layout group will change, but the parent object acting as the layout group doesn't get resized accordingly

#

Is there a way to not do this manually or through dynamic code?

#

Some sort of editor option

#

It makes the Horizontal Scrollbar not work properly if the width of the layout group is incorrect

grave quartz
#

For the layout groups this

#

but in general, youtube "Unity UI Anchors"

tough wind
# grave quartz

follow up question on this, is there a way to type in the height/width I want the children to be? Because this way the children are based on the width of the parent, but what if I want to make them perfectly square? or perfectly 16:9 ratio? Is there a way to control the size of children elements with a specific width/height?

#

Cause here I'm just playing an approximation game with the width of the parent element

#

Hmm, looks like Grid Layout Group allows you to do that but not a horizontal layout group

#

Ok looks like I figured it out thanks @grave quartz

grave quartz
#

For a shop youd probably do grid anyways

foggy tulip
#

Could use some advice for post-processing. I have my game camera and my UI camera (Screen Space - Camera) ui.
My UI camera has a higher priority so it gets drawn ontop.
It appears that causes the postprocessing to only be applied when drawing the hud camera.
I only want post processing on my game camera, not my UI camera.
Any advice?

#

I've tried using layers and that doesn't seem to work.

knotty dagger
foggy tulip
knotty dagger
hoary kettle
#

how to make UI elements keep position and size relative to different resolutions, from PC to wide-screen mobile for example or from HD to 4:3 2K

#

I'm a beginner and this is a very important issue since I want my game to work with as many platforms as possible

#

I'm using a single canvas to store everything if that helps

hoary kettle
#

then just disable post for UI camera

#

and use post on game camera

#

and now it will only work on the game

foggy tulip
#

That's exactly problem. My postproc is very different for either layer.

hoary kettle
#

well all information I found on the web didn't help

#

it was outdated

#

or not supported anymore like clear flags

#

anyways you can deactivate post on the UI but that's as far as I could figure stuff out

#

if you find a fix eventually let me know

#

I'll do the same

plush solstice
#

hey, does anyone know if it is possible to have a subscript and superscript on the same level in textmeshpro? example here:

jagged monolith
#

Don't think that's possible no

plush solstice
#

shame

tranquil quail
#

Hello

tranquil quail
#

Hello all, how are you?
I am a Unity MMO P2E game developer. Now I am developing a new MMO P2E game using Unity.https://vimeo.com/861569495?share=copy
The backend features are mostly completed. I am stuck in front end development.
I tried many UI frameworks/libraries/packages for my game.- https://www.noesisengine.com/

  • UI toolkit/UI builder- uGUI- and many more
    I couldn't find a proper solution for my game.My only requirement is to make a game UI which looks like Microsoft's Fluent UI.URP or Standard RP doesn't matter.
    Could you please recommend what package (which has been maintained by powerful and famous team) could I use for my MMO game?
    I would be very grateful if I could get a reply from you. Thank you

This is "bandicam 2023-09-06 00-52-56-176" by JamesWaterson on Vimeo, the home for high quality videos and the people who love them.

▶ Play video
reef hill
#

Does anyone have thoughts on hiow to approach creatging something like this? Thank you!

old bane
#

Hey guys, when I use TMP input fields in screen space - camera, the function to select highlight a piece of text doesn't work. And i cannot click to change the position of the caret. Instead of changing the screen mode to overlay, is there a work around to get it to work in camera mode?

old bane
livid bay
#

Is it recommended to not work with many decimal values in UI? Like having a height of 1023.754857

#

or does it never matter

lime kindle
#

But it doesn't typically mess with your game

rich ravine
#

Clickable Entities + Disabling Panels On Click Away

tight hazel
#

how do i change the sorting layer of UI?
my gameover screen is currently showing up underneath the regular ui

livid bay
#

the lower it is the more priority it has

#

So, i have a question about this thing.
I have been designing my app with a reference of 1920 1080.
The app has scalable functionality so the user can make it any resolution they want.
But the default resolution will be 1280 720 and is what users will most use
( the app will always be windowed mode in case that matters )

Should i start using a reference resolution of 1280 720 and edit the UI thats already done or does it not matter and i should keep doing things in 1920 1080?

tight hazel
dawn acorn
#

hi guys i have a question about views. My simulator view looks perfect however this messes up the game view. If I try to change things to look good on the game view, it messes up on simulator view. Does this matter? should I keep the simulator view?

mortal robin
#

You should design your UI to look good on any reasonable resolution

#

And test via the game view resolution drop-down

dawn acorn
analog plinth
#

would TMPro related questions apply here?

#

i feel like it would. so I'm trying to use the Distance Field shader builtin, because i'd like to do an outline on some text. but using that shader, i get this weird coloring in the spacing between the letters when zoomed away from the text (see left two text displays in image below)

#

If I change the shader to the TMPro/Bitmap shader, it looks fine but then those options for outline go away

tight hazel
#

i have a timer with two child objects, a background and an icon
how do i change sorting layer in this case?
i dont want the timer to be underneath the backgrouns

frosty pewter
tight hazel
#

so i cant have them be children of it huh

#

ah i guess there's no reason it cant be their child

frosty pewter
#

(Children are below their parent in the hierarchy, so they will be on top of it)

tight hazel
#

can i change TMP's default font?

meager quartz
#

mostly placeholders, but i feel like this gui is too bare/layed out so far?
reckon i should add some other little things to make the screen feel less square (like the pink lines ive drawn)
or is this okay

pale plaza
#

Hi all. When I set a canvas to pixel perfect, text renders sharply but moving images are, naturally enough, messily pixelated. When I switch off PixelPerfect, images are smooth but text becomes blurry. Is there some solution that allows for crisp text but smooth images? And I tried using two canvases, but that ends up being fairly awful when, for example, a text box tries to move along with a sprite. I.e., I want anti-aliasing for images, but not for text.

slender meteor
#

Hey, maybe try out using an other font which is more sharp, and make sure to use TextMeshPro (you probably do already) because TMP is more high quality/sharper

pale plaza
slender meteor
#

you dont??? yeah definitley use TMP. I think thats where your problem comes from, espacilly if you text is small the default Text seems blurry.

pale plaza
#

Yeah, I figured this kind of stuff should work out of the box 😄

#

But eh, such is Unity.

pale plaza
tight hazel
#

is there any component similar to an image, but with a gradient slider?

lime kindle
#

Shader Graph might be of help

tight hazel
#

any like plugin for that then?

#

i saw textmeshpro has gradient built in

#

so like

#

what if i do the stupid route

#

make a font of only squares

lime kindle
#

Though I know Text Mesh Pro has it's own indiosyncracies

thorn zinc
#

How do I get the scale of my text backdrop to match the height of my TextMeshPro text?

lime kindle
thorn zinc
#

I have it as a sibling right now but potentially.

#

When I tried to scale it as a parent it would stretch the text.

lime kindle
lime kindle
visual depot
obsidian oriole
#

How can I ensure that a scaling object will keep a distance from the parent border and not expand out when resolution ratio changes?

mortal robin
obsidian oriole
#

I have anchors set to center, I need the object to keep its size ratio (that's why I don't use stretch). Pivot is in middle

obsidian oriole
dense crystal
#

Whats the best way to change all the Font Assets of your textmeshpro components at once? Is this possible in the editor?

mortal robin
sand cosmos
#

Where do i get UI design inspirations?

ionic beacon
#
Game UI Database

The ultimate screen reference Tool for game interface designers. Explore over 1000 games and 42,000 individual images, and filter by screen type, material, layout, texture, shapes, patterns, genre and more!

sand cosmos
#

Or do i just look at inspirations and try to follow them?

wicked mural
#

Hey everyone.

So I was trying to make some of my UI elements get affected by a global light I have in the scene by changing the material of those images to Sprite-Lit-Default (I use URP).

And it works, but I get this warning in the console and I'm not sure how to get rid of it: "Material Sprite-Lit-Default doesn't have _Stencil property"

Is the Sprite-Lit-Default material not supposed to go on Image components?

EDIT: And I think I have one more problem. It seems like the Mask component no longer masks the UI Images that use the Sprite-Lit-Default material.

autumn badger
#

Hello, today I opened my Unity project, and suddenly the canvas in my scene was no longer visible. The GameObject "Canvas" is active and present in the scene, but when I start the game and in the editor, there is no UI visible. The last thing I did in my project was to code this shader script here:

{
    Properties
    {
        _Color ("Color Tint", Color) = (1,1,1,1)   
        _MainTex ("Base (RGB) Alpha (A)", 2D) = "white"
    }

    Category
    {
        Lighting Off
        ZWrite Off
        //ZWrite On  // Uncomment if you have problems like the sprite disappearing in some rotations.
        Cull back
        Blend SrcAlpha OneMinusSrcAlpha
        //AlphaTest Greater 0.001  // Uncomment if you have problems like the sprites or 3D text having white quads instead of alpha pixels.
        Tags {Queue=Transparent}

        SubShader
        {
            Pass
            {
                SetTexture [_MainTex]
                {
                    ConstantColor [_Color]
                    Combine Texture * constant
                }
            }
        }
    }
}

Could this be related? Can you help me? I would appreciate any assistance. 🙂

eternal hull
#

btw @supple basalt u asked for the hierarchy of the size fitter thing

#

its just somethin like this

#

the menu object have horizontal layout group

supple basalt
#

I need to see the inspectors for the Menu and for one of the items

eternal hull
#

ok waiot

#

here

supple basalt
#

the Menu is set to stretch horizontally. It's going to grow in both directions like that.

#

I think moving its pivot to X=0 will help.

#

You should reset the pivot of the individual items to 0.5, 0.5

#

since I think we were messing with that before

eternal hull
#

kk ill try

#

still it results the same

supple basalt
#

lemme recreate this

eternal hull
#

:()

#

sorry to trouble you

supple basalt
#

oh, I see. you have Content Size Fitter on the child.

eternal hull
#

oh btw in the child it got text

supple basalt
#

Put it on the parent.

#

This looks like what you want.

#

one moment, screenshots

#

actually, here's something better than a screenshot

eternal hull
#

the content size fitter on the child is to uhh

#

make the texts background (the childs from the menu) to fit the text

supple basalt
#

oops

#

unity crashed

#

i will have to recreate this lol

eternal hull
#

:()

#

sorry to trouble u once again

supple basalt
#

check this out.

#

The Menu has a Content Size Fitter. It is set to "Preferred Size" in both directions.

#

It has a Horizontal Layout Group set to control the child size in both directions

#

Each child has an Image and a Horizontal Layout Group. It's center-aligned and controls child size in both directions.

#

Each grandchild has a TextMeshProUGUI component and...I forgot to remove the Content Size Fitter. They don't need that.

#

Adjusting the font sizes works correctly

#

My understanding is that you put a Content Size Fitter on the top level transform to make it grow or shrink based on the minimum or preferred sizes of the children

eternal hull
#

how is the text parents resizing itself without a content size fitter

#

is the root content size fitter resizes them also

supple basalt
#

because the top level Horizontal Layout Group controls its height

#

if it doesn't, this happens

#

I have no idea why the layout groups don't default to controlling width and height

#

and instead go on "force expand"

#

The preferred size bubbles up from the text to the image to the top level

#

and then the top level sizes the image, and then the image sizes the text

eternal hull
#

so in conclusion what are the differences between my version and urs

#

the children doesnt have content size fitter?

supple basalt
#

import the package and you can look!

#

it'll add a "Menu" prefab

#

content size fitter up top. horizontal layout groups that control width and height on the Menu and on the Images.

eternal hull
#

yeah im looking on it rn i cant tell much of a difference :()

#

wait wait let me look at it more

#

ooh

#

my menu deosnt have content size fitter

supple basalt
#

Also, the Menu's anchor is [0, 0.5]

eternal hull
#

while ur shave

#

urs have

#

wait let me implement

#

it to mine

supple basalt
#

The content size fitter needs to be on "Preferred Size" for the horizontal axis so that the Menu widens and narrows

#

and for the vertical axis so that changing the font size correctly increases the size of the images

#

The documentation doesn't quite explain these high-level concepts properly

#

from my experience, at least

eternal hull
#

:()

#

thank you so much

supple basalt
#

no prob! it gets a lot easier once you learn the "rules"

supple basalt
eternal hull
#

lol

umbral geyser
#

Does someone know, how to render a World Space UI Button ontop of everything? I didn't understand the unity forum solutions

astral current
#

for a mobile landscape pixel art game, if you're setting up the pixel perfect camera are you supposed to do something like 1920x1080 reference resolution, 16 asset ppu size, and then scale the assets up? Or should you instead do something like 240x135 resolution to have everything scale at once?

#

using pixel perfect camera, i mean

frank shadow
#

does anyone know how to get crisp text?
I tried text mesh pro but it still is blurry in the game view

sterile wedge
#

and that your game view is not zoomed in

frank shadow
#

how would i unzoom my game view

sterile wedge
#

with the game view visible

#

there should be a scale slider at the center top

frank shadow
sterile wedge
#

yeah, that says 1.2x

#

see if you can drag it all the way left so it says 1

sand cosmos
#

Does anyone have any tutorial on drawing game art with illustrator?

cobalt remnant
#

Hey, I have a problem with UI scaling, or perhaps anchoring, hard to say. I have this type of panel around the car, with the orange dots (buttons as children). The issue is, that when I change aspect from 16:9 to either 16:10 or 4:3, the panel breaks and is too small (as shown on the 2nd screenshot). How should I anchor it, or generally do it, so it stays the same size, and the buttons do not move?

umbral geyser
#

Does someone know the problem, that a Screen Space UI Image reacts to clicks randomly? It randomly doesn't recognize clicks/swipes, but when I move a little bit it only sometimes recognizes it again

#

It somehow works when I set distance from 100 to 10

#

For example

mortal robin
umbral geyser
mortal robin
frank shadow
#

but if i launch my game on different screen sizes does that mean the text would get blurry again? (since the scale would change)

sterile wedge
#

No. That scale is just for your game view

#

If you want to see how it looks on different sizes, click on the Game dropdown in the top left and there should be a Simulator option

#

That is where you can see diff phone screen sizes

#

@frank shadow

sturdy stag
#

I am currently working on a Custom Input Manager, but how come one of the inputfields is more grey than the other after I interacted with it?

#

This only happens every now and then, not every single time

mortal robin
sturdy stag
covert tiger
tiny spade
#

hey! what would be the best way to make a ui like this -> the line is always pointing at the selected objects/ does scale with the distance?

pale plaza
#

Hi all again. I'm looking for a font that works well at small sizes. Ideally as small as size 8 or less - a big ask, I know 😄 Still, I'd appreciate any suggestions.

pale plaza
# tiny spade hey! what would be the best way to make a ui like this -> the line is always poi...

Check the Unity Camera API: https://docs.unity3d.com/ScriptReference/Camera.html. You can use WorldToScreenPoint to get the screen coordinates of the scientist in your example, and then you just need to place, scale and rotate an image so it looks like the line you want and connects that first screen point with wherever you want your message to appear. There are other ways, but that's how I'd do it.

rapid ferry
#

my game looks fine with these details

#

and many other phone resolutions

#

but breaks in tablets

rapid ferry
#

How can I make a button look better?

#

A little less "unity-y"?

meager quartz
#

use premade sprites, usually hire a designer or make something that looks unique
dont use the in program unity sprites for buttons

lime wigeon
#

anybody online that's good with Buttons/Canvas in particularly in correlation to scrolling via keyboard or gamepad?

I have a working Menu for my game (via mouse). The game starts at the Main Menu. Then if I select "Options" from the Main Menu it goes to the Options Menu (when done via mouse). However when I select an option on the Main Menu with the up and down buttons on the keyboard and 'Enter" it automatically starts playing one of the levels that is listed under the 'Options Menu' after it flashes a non-interactable version of the OptionsMenu for a millisecond.

i.e. it 'feels' like I am visually seeing a selection on my Main Menu (which is actively & correctably) interactable via mouse. But if I choose to highlight via keyboard it seems to do a double entry.

TL;DR
Mouse Menu Select = Good
Keyboard + Enter Menu Select = Crazy Town

azure flame
#

You should attempt to debug the problem first. Then post the code that suppose to do that with debugging messages.

lime wigeon
#

I'm not ignoring you. I'm suddenly a naked Archimeds displacing water.

#

#TotalEurekaMoment (I hope)

meager quartz
#

no matter what i do i feel like i don't like this ui for the bestiary tooltips

#

right now
green = animal, white = common enemy, blue = uncommon/elite enemy, gold = rare enemy, +star = boss

devout mist
#

hello, I have TextMeshPro inside an Image. I'm using Content Size Fitter and set it to Preferred Size to make my textmeshpro size expand vertically to make up for spaces for the text.
But if I do the same for the parent, which is Image, it doesn't expand to make up for the space for TextMeshPro, why? How do I make the parent image auto expand?

quasi parcel
#

Look up the super mario rpg background for the menus. Thats what i think it needs

hardy creek
#

Hi.
So I have a code that generates an island using noise and a seed, so far so good. I also have a UI button that calls the method to generate the island when I click on it so that I don't need to exit game mode when I want to change values for the generation.
The problem comes when I add a seed to the world gen: if I give the seed normally, outside of play mode, it work as intended. But once I give it (the same seed) on play mode and use the button to re-gen everything, I get very weird results.

#

The first image I'm giving the seed on editor mode normally. The second image I'm giving the same seed, but clicked the button to regen the world.

#

Is this the button's fault?

#

My only guess is: because the land is still the same, the problem is with my water level detection, which is in another class (that inherits the Tile class)

#

And for some reason using the button is passing the wrong values to my water class

#

(btw, do I send this here or to one of the codes channels?)

soft sail
lucid plume
#

hello guys, want to make a menue for a game for ios. what background size should i use or how can i make it so it adapts to the screen size of the user

meager quartz
quasi parcel
#

Forgot to @meager quartz

meager quartz
#

these are just meant to be popups when you mouse over something so i'm not really sure how to apply the ideas in this video to them

#

did try something with boarders, though

quasi parcel
#

Oh okay, i think they look good, i like the colored border in the middle and just color code your boxes for things

tiny spade
analog spire
#

How can i have these 2 things to match ?

#

specifically, i would like the size inn the canvas rect transform to be 1080/2400.

#

i have the following canvas scaler

pale plaza
# tiny spade but how can i scale/ stretch the image to exactly point at the target, tried it ...

Calculate the distance between the screen coordinates of the scientist and the text box, then set the scale of the recttransform of your line element to that length. The position of the image should be on the halfway point between the two coordinates, you can get that one through Vector2.Lerp(scientistScreenPos, textBoxScreenPos, 0.5f). As for rotation - that's trigonometry; can't do it off the top of my head, but https://en.wikipedia.org/wiki/Trigonometry should serve you well.

Trigonometry (from Ancient Greek τρίγωνον (trígōnon) 'triangle', and μέτρον (métron) 'measure') is a branch of mathematics concerned with relationships between angles and ratios of lengths. The field emerged in the Hellenistic world during the 3rd century BC from applications of geometry to astronomical studies. The Greeks focused on the calc...

mortal robin
analog spire
#

and yes, that was that

#

thx

hot jolt
#

Hey all. Beginner here. I am trying to enable glow on mouse over on my main menu buttons. Cannot seem to get it right. Is this the right place to post? or should go to code section?

devout mist
#

hello, how do obtain this Pos Y value through script?

devout mist
celest remnant
#

im using vertical layout group

#

but when I start the game

#

the position looks kinda weird

#

the problem looks like fixed when I disable and enable that canvas, can i know why and how to fix it

quasi parcel
#

How do you determine where to put those bars above the slime. Does each slime have their own bar or do you move bars into place?

reef hill
#

how does anyone know why UI graphics disspear when camera isnt focused on it?

quasi parcel
#

Elaborate im not sure what you mean

celest remnant
#

i havent used scripts to move bars or text

hot jolt
#

Hey all. I have two materials. One is normal and the other is just glow. When I put it on my play text. It disappears on canvas. What am i doing wrong here?

analog plinth
#

Sorry to barge in but I am using a Canvas with the Render mode on Screen Space - Camera, so that I can use a Canvas Image with Scroll Rect, and also use a Line Renderer in the same space. I have been able to set up the Sort Ordering to show both the Line & Canvas Image together, which is great!

However, the Line produced by the Line renderer is just floating in the same position on the Game screen, not moving with the base Canvas image when I scroll in it. I set the Line to be a child of the base Image, but no dice. How can I anchor the line to the image?

#

I unchecked "Use World Space" on the Line Renderer

#

Problem solved

#

only thing I dont get is the x position index of the line i'm using, it is incredibly large

#

I don't get how it's related to the camera space

#

scale was off, as usual

#

heh

haughty drift
#

how do you make a slider like this

#

I can google it if i know what it was called

frosty pewter
deft vigil
#

How can I make it so my content area scales based on all the items?

low pike
#

layout groups (vert/ hori), with some flags ticked (I forget off the top of my head) and content size fitters

deft vigil
#

i found out its not the scroll its the contents position

low pike
#

Make sure the content game object is resizing correctly for the contents

haughty drift
timid flint
#

Yellow,Iam doing a figma design for a game "Stack Blast"

#

Any suggetions ?

proper ether
#

Hi everyone 👋 - I am wondering what is the correct way of building a menu system for a game - is it to have a 'scene' for each step in the setup of a game? And is this best to build entirely with UI Builder? Thanks in advance

(I was reviving an old game i made 10 years ago and everything is different now in unity so i'm starting from scratch)

low pike
rapid ferry
pine ginkgo
#

i gave a gameobject the button component and still cant click it

mortal robin
sterile creek
#

Does anyone know how to make these maps, or what resources i could check out

pine ginkgo
sterile creek
#

How to make "these" maps, like in malls

#

There's gotta be something on that on youtube

pine ginkgo
#

go on photoshop and do it or any other photo editing software

sterile creek
pine ginkgo
#

You need too do it (probaly) youreself

sterile creek
#

Thats why I'm asking

pine ginkgo
#

When you have a idea why dont you make it?

sterile creek
#

typo

#

no idea

pine ginkgo
#

or so you mean you have no idea?

#

oh

pine ginkgo
pine ginkgo
#

No problem

sterile creek
#

Oh now i have an idea

#

I could create a simple 2d image using rectangles with colors, 3d rotate that and then just add text later

pine ginkgo
#

that should work but i dont know if it looks good

pine ginkgo
sterile creek
sterile creek
#

@pine ginkgo i made a custom logo

#

Does anyone have an creative ideas on what i could do for physics

#

like what icon

#

Right

#

an atom

#

literally the first thing that comes up when i google "physics"

pine ginkgo
sterile creek
unique finch
#

Hey, I've been stuck on this... for like half an hour already.
Basically, I want the text to start from the bottom, and not from the top.

To my understanding, Vertical Layout Group should fix this.
I tried to replicate exactly what this guy does in the video in about 4:25.

https://www.youtube.com/watch?v=0QPIhCFWkAM

But the text just wont go to the lower left, or anywhere else, no matter what (anchors dont work too)

In this video I will walk you through the setup and implementation of Facepunch.steamworks for Unity. By the end of this video you will be able to start a lobby using steam, and have other friends connect with a lobby UI set up with chat and ready up functionality.

GitHub:
https://github.com/PixelFizz/FacePunch-Steam-Lobby

▶ Play video
#

Can some UI guru help me?

sterile wedge
unique finch
#

Oh, wait a second. I think yes.
Now I was able to drag the text to the bottom.

unique finch
sterile wedge
novel marsh
#

Is there any way to load a TMP SpriteAsset object from an assetbundle? The ways I have tried don't work because the glyphs don't load with the object probably because the texture and material don't either.

upper raft
#

Hello guys. I tried to change the resolution of my canvas by using the canvas scaler. Did i do it right? Will it now display in 6907x140140?
The reason im worried is because as you can see in the scene that my canvas is a lot larger than the actual display, and i have a lot of blue background in my game scene

mortal robin
#

all it does it change the numbers you are working with in your RectTransforms

#

The actual canvas resolution is determined by the game resolution

#

If you wish to change the game resolution use this dropdown on the game window

upper raft
#

Ok then.

As i see it ialready have the free aspect with my intended resolution on in my game window. So did i do it correctly?

mortal robin
#

open that dropdown and select the actual resolution you want

supple dune
#

Hi, I try to change sprites when user location is Japan, because they switch submit with cancel, and I want switch sprites for gamepad, I use
sprite.spriteCharacterTable[0].glyphIndex = 1;
sprite.spriteCharacterTable[1].glyphIndex = 0;
but sometimes it works, sometimes not, and I don't know why 🤔

umbral geyser
#

Did someone also have the problem yet, that an orthographic camera causes game crash? I use it as MiniMap and when enabled, it freezes the game, music is still playing

native cedar
#

hey guys, this might be kindof a nooby question but I'm making a multiplayer game and obviously the player has a HUD, I have multiple maps and my hud has to be the same on every map.. but when I change something in the hud on 1 particular map, it doesnt always apply to all the maps.. I'm sure I'm just not using the right workflow, how should I go about making the hud?

deft sierra
#

is there a way to keep that snapping functionality when you rotate image or any element tbh Ive got image which needs to be rotated 90 degrees but I cant snap it anymore afterwards so I gotta go make a duplicate which would be already rotated

river vortex
#

I have this kind of GUI layout where I navigate to various screens by clicking different buttons. Works well for touchscreens and mouse.

But now I am trying to make it work with keyboard/controller and having a hard time keeping track of which button on which panel is currently highlighed/selected so pressing ENTER key or X button triggers the event.

#

What's best practices on creating a GUI menu screen system like this that works with PC with keyboard and/or joystick?

mystic orbit
#

Yo, I have 2 scripts attached to a correlating “UI Manager” gameobject for each. It’s a dealership so the first script sets a carSelectedString to the given brand and disables the panel that shows the car brands. My 2nd script takes in that string and uses it to initialize the prefabs for that car brand. The problem I have is the initializing script gameobject is set to off when the scene starts because I want to use “onenable” and “ondisable” functions. But I can’t inherit the selectedBrand string since the gameobject with the first script gets disabled on button press. So I can’t use findgameobject when the 2nd script manager gets enabled since the other ui manager gameobject is disabled

cursive ocean
#

Anyone else have an issue with unitys anchors resetting after ANY input at all? like i move my mouse 1 pixel and it resets. Tried looking it up on google and nothing related to the issue appears

vague epoch
#

https://www.youtube.com/watch?v=--LB7URk60A&t=2s&ab_channel=GameDevGuide
hey guys, so i was following this tutorial but the "graphic" class at 1:59 isnt recognised by unity 2021.3.19f1
people said to add a canvasRenderer but it still doesnt work
can anyone suggest a solution? Thanks

Unity's Line Renderer Component doesn't work in the UI system... So, let's create one that does...

Interior Mapping Shader - https://www.youtube.com/watch?v=dUjNoIxQXAA
Photo Real Assets - https://www.youtube.com/watch?v=Y538_YYhC1A
Fixing Grid Layouts - https://www.youtube.com/watch?v=CGsEJToeXmA
-----------------------------------------------...

▶ Play video
#

For context, im trying to make a realtime graph for a physics game in unity. It should show a value against time

mortal robin
#

use a recycler view

#

what?

#

The lag spike is from creating 100 elements in a list

#

that's a lot of GameObjects

#

recycler view gets around this by not creating that many

#

it only creates enough to fit on the screen

#

yes and a recycler view gets around this by only having 20 items period

#

Have you profiled the game yet

#

you say this but you also say

i have a scrollview with hundreds of items

#

so it sounds like you have hundreds of items in the view, not only 20

#

How does that mean profiling doesn't work?

#

If you used the profiler and determined that the scrollview itself somehow is the issue, that's the profiler working

#

I still don't see how that means profiling doesn't work

#

the point of the profiler is to identify the source of the slowness

#

if it identifies the source of the slowness as being the scrollview, then it has done its job

#

ok so I have already suggested a replacement

#

it's a complete rewrite

#

and if you want to get to hundreds of elements you're going to HAVE to solve the scaling problem ANYWAY

#

so your pool of possible solutions already is going to include only different variations of a recycler view

#

in all this time debating you could have tried this out

#

This one i linked was just the first implementation to pop up on google

#

we already know default scrollview isn't going to work when you scale up

#

you're going to have to rewrite things

#

but it really shouldn't be that hard to switch

#

refactoring/rewriting code is a normal and expected process

#

there's not going to be some magic "run faster" button on ScrollView

wicked mural
#

Hey everyone.

So I'm using this line of code to update the position of a rect transform in my scene which acts like my cursor. It was working perfectly but for some reason today it's putting the Z position to the plane distance from my canvas multiplied by 100. I have no idea why because I set it to 0 in my script...

mortal robin
#

So 0 means at the camera's z position

mild dome
#

width is 280, height is 85

#

i go into gimp make it the same size

#

make a 5 pixel outline