#📲┃ui-ux

1 messages · Page 62 of 1

cyan sentinel
#

There are text styles in a dropdown when you go on the gui text component of TestMeshPro. There you can select H1, H2 which are stored in the StyleSheet asset in your project. I want this dropdown in my own SOs, but cant find a way to hook in

lime ravine
#

Hi, I am building a game for MacOS from windows. and I got issue with TextMeshProGUI won't be rendered especially for MacOS Big Sur or higher. Any body have the same issue like me?

From the image, there is should have a text in the button. (Using Text Mesh Pro Button) and all my text using TextMeshProGUI wont appear in MacOS Big Sur and Higher.

neon terrace
#

what would be the best way to see if i have a setting in the options where you can set a name but warn the player if its too long?

#

problem is that with no caps, this is only 17 characters long, but if i have for example full caps it's only 14 characters long

jagged monolith
jagged monolith
wild pebble
neon terrace
jagged monolith
#

It's on the input field

sharp oracle
#

Is there a way I can "exit" an InputField without de-selecting the Selectable?

#

It's mucking with my gamepad navigation

#

input.DeactivateInputField seems to not actually do anything, so I don't think it's that

lime ravine
lime ravine
blazing nacelle
#

So I'm trying to use some custom fonts with TMP put they are coming out blury/pixilated. I used mostly default settings for camera, canvas. Although I did switch to scale with screen size.

#

Any ideas on where I should look to try and make the text more crisp?

thorny harbor
#

I am new to unity and I created a button. but the canvas thats created is much larger than the camera. do I increase the camera size or decrease the canvas size? the screen seems to ignore the actual camera but doesnt work if deleted. this is for 2d. sorry if this is the wrong channel

sterile wedge
#

if it is, it's normal. overlay canvases are based off your screen size

frosty pewter
thorny harbor
sterile wedge
# thorny harbor screen space - overlay

yes, so the Canvas will match your screen size. it looks big because Canvas uses pixel unit, and it's being represented in the scene view as 1 pixel per 1 unity unit

#

just place your UI based on how you see it in the game view, using proper anchoring

thorny harbor
#

ah thanks

blazing nacelle
viral trout
#

Anyone knows why I might be getting blurry text? Its only when I use splitscreen. The canvas are using Screen Space - Camera

mighty obsidian
#

Hi 👋 canvas.overridesorting = true is not working even though the gameobject is in active state is there any way I can achieve it?

night valley
#

so much of the built in unity UI system seems to cause significant GC, and like calling GetComponent internally etc.

#

so like ... it's not like a little is causing actual performance issues in my little tests but i'm just worried if i build an actual full complex UI on top of this that's when the issues will start showing up

inland obsidian
#

Right now it is calculating the difference between the start of container that holds the two buttons at the end

#

But I feel like that's the mistake

sterile wedge
#

can you show the RectTransform of the horizontal group and the input field?

inland obsidian
#

Yes

#

The input field

sterile wedge
#

I think maybe the easier way would be to add a LayoutElement onto the input field, tick "ignore layout"

#

then you'll be free to center the input field, and it won't cater in the other objects in the layout group

inland obsidian
#

Hm what about other screen sizes?

#

Will that position remain centered then?

sterile wedge
#

try and see

#

you can go to free aspect and try resizing your game window

#

it should

#

maybe not because I dont see you set your horizontal layout group RectTransform to stretch, so it would be a fixed size regardless

#

but the input field will remain in the same spot relative to the parent

inland obsidian
#

Wait, I got a better idea, I create two panels that both center the items. The first one contains the left button and the container with the two buttons, and the other panel the input field

sterile wedge
#

sure

#

or put the layout group component on a child of the panel, and put children you want affected by it in it

#

then put the input group still a child of the panel, not a child of the layoutgroup

inland obsidian
#

Gotcha, thanks for the help :)

rapid ferry
#

Hi I'm very confused why unity isn't working I've tried everything but it just won't display the highlight nor press color on my button.

#

I've recreated in another scene didn't work I've restarted unity didn't work I've deleted it and recreated it in the same scene didn't work I've tryed multiple colors didn't work...

#

So I'm thinking it's more a unity problem

#

idk

sterile wedge
#

Also, are the alphas meant to be so low

#

Your Target Graphic is named Play. Are you looking at the right graphic

mortal robin
rapid ferry
mortal robin
rapid ferry
mortal robin
#

and your canvas inspector

rapid ferry
mortal robin
#

Set the color of the image by default to be full white with full alpha

#

then set alpha etc for each of the selectable modes as you want

#

at best you're going from fully transparent to a very transparent very dark gray

#

it won't be noticeable

rapid ferry
#

Okay

rapid ferry
#

Ty it worked

obtuse hemlock
#

Hey everyone I've been trying to work with scale with screen size for my UI for it to well... scale with screen size

#

but everytime I try to resize everything for a screen size

#

when changing the size it just doesn't scale properly

#

things get stretched out with wrong positions and I'm not quite sure what to do

#

here's an exemple with different sizes

#

bottom menu is out of bounds

frigid zephyr
#

is there a ui element for highlighting something

#

to put a glowing ring around it

#

or some script method

shrewd geode
#

anyone know why xr canvases are huge?

frosty pewter
shrewd geode
frosty pewter
#

The toggle should be a reasonable size in screen space

#

if you're creating a world space canvas you will need to scale it down

shrewd geode
#

so do i not change the width/height but the scale?

frosty pewter
#

You haven't really described your setup

#

is it a world space canvas? If so, you do need to scale the root

frigid zephyr
#

i need to create a button that upon selecting, acts like a toggle. selecting it twice change scene

#

how can that be done

honest stump
#

how to make the screeen resposive on mobile screen?

#

i want it to have max 700 width

#

on mobile screen it clipped

#

not centering

sterile wedge
honest stump
#

i want it to display maximum 700 width

#

on mobile i want it to resize to whatever

#

just centering the screen on bottom

sterile wedge
#

what's the anchoring of the text box

sterile wedge
#

it's near useless that you're showing me in prefab mode

honest stump
#

right

#

my bad

sterile wedge
#

but honestly, i dont know now

rapid ferry
#

I usually fix blurry text easily but for some reason this just wont go away

#

these are my settings

#

nvm found fix

inland obsidian
shrewd geode
#

anyone know why the text is like that its supposed to be black

mortal robin
shrewd geode
#

hol up, from certain angles its black???

glad kindle
#

in my project, block raycast component doesn't work at all. I tried in canvas and panel. How can I block mouse clicks behind the panel screen? ( dont want to click 3d objects)

next lake
#

I am using a second display. my canvas is rendered to the first display on startup. I then have to move it to the second display (I change the cameras targetDisplay), after this my canvas is no longer responsive in release mode, but does continue to work in the editor.

#

I know mouse clicks/position are working correctly, as I am using them to render some effects in the background.

#

any idea how I could debug what is going on here?

#

oh and while I am at it, what the hell are these yellow lines:

#

I've disabled all gizmos

buoyant zephyr
#

how do i get my vertical layout group to fill top down instead of filling weirdly like this

next lake
#

don't control the child height I think

#

what are your layout settings?

buoyant zephyr
#

thanks

next lake
#

np

frosty pewter
#

you must have enabled it on a selectable UI object

next lake
#

so this is some component on an object? I just added this textmeshpro button

frosty pewter
#

A button is selectable, so yes

next lake
#

ok thanks hmm

buoyant zephyr
#

how do i make it so everything outside is invisible

low pike
#

use a mask

buoyant zephyr
#

on where

frosty pewter
#

on the content rect presumably

buoyant zephyr
#

i've got a mask on the content doesn't work

frosty pewter
#

what kind of mask

buoyant zephyr
frosty pewter
#

that mask uses a graphic

buoyant zephyr
#

i've got it now

#

rect mask 2d worked

frosty pewter
#

if you don't want to use a graphic, a Rect Mask will-yeah

buoyant zephyr
#

but now some of the elements are missing, even when scrolling

#

in the inspector they exist

#

but not when i scroll

#

there should be one at the bottom with this text, then then this happens (pic 2)

buoyant zephyr
#

anybody able to shed some light on this?

next lake
#

is there a way to fire my own mouse-up/down events?

surreal kiln
#

Why's ui text so low quality

mortal robin
surreal kiln
#

And how to apply custom fonts to it

surreal kiln
#

It still looks pretty weird

#

Just less gray

timid pollen
#

hey um when I use the splash image in unity the image gets cut off and Idk why

honest stump
#

how to display on screen keyboard?

#

i have input field on game

#

if user connect their controller e.g xbox or PS4 controller

#

nothing appears

#

they cant type anything

neon terrace
#

err i have an issue where my pivot wont move to the corner of the canvas, only to the corner in a small box

#

it works in a different scene though which is hella annoying

hexed plank
#

Hello! Working on my game UI manager, I'm wondering how you guys deal with the canvas management of different UI screens. Is a state machine a good route to look into ?

buoyant zephyr
#

how do i stop my scrollview content from going so far out of bounds you can't get it back?

cyan sentinel
cyan sentinel
low pike
buoyant zephyr
low pike
#

change the vert layout to start at top middle, instead of middle center

deep ridge
#

Programmers attempt at some UI stuff.

trail trail
#

Question:

I have a 16x16 tile based UI. I've never used tile based UI's before, only 9 Slicer, and I'm wondering,

How do I go about implementing it in Unity?

low pike
#

I don't think they're the same thing...? A 9 slice is to cut up 1 image so that it can be stretched without messing up the corners

#

a "16x16 tile based UI" sounds like it's 256 separate images?

trail trail
#

Thats pretty much the case that I'm trying to figure out. As an example this is what I'm referring to.

If I slice it up as 32x32 tiles. Everything fits besides the things that should be 9 sliced.

I understand I could drag out the tiles and resize them. However, I was hoping there would be an easier way.

low pike
#

right, that's an atlas

trail trail
#

It also seems like theres no easy way to add new slices to an existing?

low pike
#

9 slices is something completely different

#

you want the sprite editor to cut that up

trail trail
#

I know, I understand what a 9 slice is. But the larger boxes in this case, would be 9 sliced easily for scaling

low pike
#

I assume once you've cut up the atlas with the sprite editor, you can also then setup the 9slice stuff on the individual sprites created from that

trail trail
#

I guess at the end of the day the question is.

Can I add a slice to a sprite sheet/atlas manually? Or do I need to go in, count all the number of elements I have, then tell the sprite editor to say slice it up as 1x# THEN manually go in and resize them?

low pike
restive haven
#

trying to use unity premade scroll bar auto hide feature on a previously made scroll section, it isnt hiding anything though, anyone know what might be causing this ? i have the proper scroll bar added to the scroll rect

I tried making a new one and the new scroll bar stay inactive and i can not turn it on manualy

lapis dragon
#

Hello everyone. I have this issue. I am trying to make my text disappear into the shadows when using the unity2d lights but i can't figure out how to make it blend in with the shadows where there is no light. (this also happens on my health bars which are sliders)
I am using sorting layers which work on sprites but on the canvas and text they don't seem to work...

blazing nacelle
#

Is there a TMP feature for being able to select/highlight text in game and right click copy?

blazing nacelle
#

Far as I can tell, the low budget way to allow copy of read only text is to use Input TMP with read only activated. Then get rid of all the input graphics/highlighting.

mighty obsidian
#

Hey hi I want to position a 2d image in a UI canvas to point a gameobject in worldspace?How to achieve I came to know that we can use the worldtoscreen point method but not sure how to use it...Kindly help me with this...

lime field
#

Hello, is there a way to "Use child scale" without a layout group ?

red hare
#

How do I make a scrollable bar but only left and right?

mild kernel
#

Use a scrollbar component and set it to horizontal.

red hare
#

@mild kernel How do I make the scrollbar effect something like a frame's position?

#

Or like make something move

mild kernel
#

Attach the scrollbar to the scrollbar field of a scroll rect component.

red hare
#

Input field you mean?

#

Hm

weary reef
#

Does anyone know any program to layout my application, before passing it to unity?

red hare
#

@mild kernel Maybe I'm blind but I can't see it-

mild kernel
#

A scroll rect component that you've added to a object.

frigid zephyr
#

is it possible to make animated sprites

#

like

#

two frames

red hare
#

Why is that when I make this only horizonal the vertical scroll bar is still there?

magic walrus
red hare
#

How do I make a scrollbar effect a frame's position?

frigid zephyr
#

how can i set a texture from a list of textures for an image

#

instead of having one image it can be from a list of them

sterile wedge
short pike
#

I've a problem that seems that the clock I have doesn't render, but the text does render, what can I do so that the clock can be displayed?

sterile wedge
short pike
#

Thanks :)! Stupid mistake from me xD.

rapid ferry
#

guys

#

i clicked something

#

and none of my ui preview is visible

#

how do i fix that XD

#

sorry im new

mild kernel
#

@rapid ferry Don't ping people, it's obnoxious.

rapid ferry
#

yeah sorry

#

i did it by accident

tacit yoke
#

Good evening/ morning guys. I wish to slow down time when I'm in my weaponwheel. Of course I would like the animation of my menu to not be slowed down. So do I have to compensate by accelerating my animation or is there another way to do that that I don't find ?

rapid ferry
#

How do i set priority in ui? I want to be something on top of other image

mortal robin
rapid ferry
#

Oh okay

#

And second question

#

@mortal robin

#

I did an animation

#

that only shows up when u hold a specific key

#

and right now its not visible from the point of Scene when editing

#

but in game it is

#

how do i change that?

#

I just dont want canvas to play animations

mortal robin
#

Huh

#

Show what you mean

#

But probably you just have the usual confusion about canvases and how they're drawn in game vs scene view

rapid ferry
#

I want this selection wheel visible without condition to held a key

#

is it possible?

#

I think it is

#

@mortal robin

mortal robin
#

Of course it's possible I just have no idea what you're doing or how you're doing it so I can't help you with the how

rapid ferry
#

as im saying

#

I made animation

#

that shows that button only if specific key is clicked

#

and now i want to edit it

#

but i cannot because it is not visible\

#

And can i disable animations when im in editing mdoe

#

so it will be visible

rapid ferry
#

@mortal robin

lethal crystal
neon terrace
#

okay so my canvas is really wonky and idk why. if i click on e.g Play Online right on the red dot, Play Splitscreen becomes clicked

#

same thing for options and what not

#

this broke when i set the canvas to screen space camera. i reverted it back but it's still broken

neon terrace
#

tried making a new canvas, still broken. i have no idea what the fuck happened, the settings are the same as it was before it broke

sterile wedge
neon terrace
#

there is nothing overlapping it, it's on top of the canvas hierarchy

warped yacht
#

anyone alive in here 🙂

#

hi guys, im a little bit confused about the scaling of the canvas. Ifi started in unity with say 1920x1080 then drag the window smaller during runtime (down to say 900x600, everything scales perfectly. But if I start unity in 900 x 600 then everything is overlapping etc. any ideas?

#

centroid: seems like there must be some boundaries overlapping the other buttons, if u turn on gizmos and click on them u should be able to see it

#

damn i miss irc where people would respond 🙂

warped yacht
#

oh wow, i needed to pass false when parenting! works

neon terrace
#

It has a vertical layout group too idk if that affects anything, but i’ll check out the boundry thing though

neon terrace
#

@warped yacht err im a bit confused, what am i supposed to see here?

neon terrace
#

eureka! this was the cause

#

ig you guys were right, thanks!

sterile wedge
#

if you're using Textmeshpro, it's under the extra settings

neon terrace
#

👍

jagged monolith
#

You can easily catch these kids of errors by selecting the eventsystem while testing @neon terrace, it will tell you whichever gameobject is being hovered

warm wolf
#

Suddenly, a bunch of my UI images are super scaled up like in the image here. Any idea what could have caused this?

low pike
#

They've been moved around in the hierarchy?
If you move things in the hierarchy to be under different parents with different scales.. they could end up messed up

#

ALL UI elements should have their scale at 1,1,1 (only changing with animations)

warm wolf
low pike
#

got any layout elements? toggle stuff off/on

warm wolf
warm wolf
warm wolf
#

The super strange thing, is some are fine, others are not. E.G.
This one is fine

#

This one is not

#

They are right under each other in heirarchy

#

They are identical other than their rect transforms

brisk sandal
#

So I created a viewport-based rect representing the '2D' bounds of a collider, and I'm trying to position and resize a canvas image to match. Resizing works fine but after multiplying the position by the canvas' pixel rect, the position is offset by a consistent screen value (as in if I move the camera, the image shifts the same distance as the object and is still equally offset.

I think it's due to some weird calculation error between the corner and the centre, so I tried halving the pixel rect size and subtracting it from the position value, but that causes the image to judder around slightly to the bottom left of where it's supposed to be, even though the pixel rect size doesn't change at all between frames. Any idea what's happening?

#

Okay so I did some more testing, the position value being output without the offset is totally fine and consistent with the object's screen position. Yet the image is still positioned wrong. I've been messing around with the pivot and anchor data for the RectTransform but it hasn't done anything

cosmic herald
#

hello, i have a small question anyone know a good quick tutorial showing how to use a vertical scroll slider?

low pike
#

@copper meadow the anchor in your first screenshot is for the settings text/ image. But the issue is with the background.. I assume you have it set to a size, instead of to stretch with it's parent

copper meadow
#

how was i suppose to do it?

#

is this the problem?

#

fixed it. works now. thanks! @low pike

night valley
#

trying to find a way to get the screen pixel position (bounds) of a RectTransform and failing - am i missing something or do i really need to do my own calculations

teal patio
#

Tips on improving this menu layout? (Icons are only placeholders for now)

mortal robin
#

layout

unborn summit
#

I dont really understand the ui thing at some points. Any Resource that helps getting into it? I understand what a pivot is but the things like Content Size fitter, Vertical layout group, Layout element and different resolutions is a thing i dont really understand yet

#

in the hierachy the "Frame" Object works fine with its children. But somehow its not auto scaling to its parent

#

i cant add a verticallayoutgroup to the "Panel" because i already have one in the "Frame"

low pike
vague oriole
#

What happened to the Grid Snap Settings?

neon terrace
#

got another UI issue. rn im using explicit so that i can set my own navigation with the buttons

#

problem is that if i change option category it will keep then navigations

#

problem is that explicit only allows one UI element/direction.. so uh... do i have to reassign this by code or?

#

ugh this will be ass to fix... boohoo
seems like i gotta do stuff by code

hexed plank
#

Is using multi scene workflow a viable approach for handling UI menus ? I.e load/unload additive scenes that just contain a canvas and event system

low pike
#

yes, but you only need 1 event system active at a time

hexed plank
#

Thing is for navigation I need to specify the first button to set as active

#

Is better to have 1 event system per UI scene and set it in editor or 1 global event system and update the first selected from script .

low pike
#

Only 1 event system works at a time, if you load more than one, the second one loaded is ignored

#

You will need to manually set the active selectable when you want the required change to happen

hexed plank
#

Okay thanks !

low pike
#

@brave iris

brave iris
#

oooh thanks! :)

#

i was looking in the text component... thanks lol

thick hedge
#

Was working on this one screen which has a scrollview for the buttons but the issue I'm having is whenever I try to scroll it, it snaps back to the original position again

#

This is the screen I'm working on

#

And I have a tutorial I was referencing

#

This one

#

I did everything as he did as far as I'm aware

#

But when his scrolls it stays in place

low pike
#

the scroll rect needs to be the size of the elements within it

#

if it's smaller than the scroll area then it's gonna snap

thick hedge
#

So do I just adjust the height of the gameobject that has the scroll rect in?

low pike
#

I'm guessing, because I can't see the setup from a screenshot of the game .. if what I've guess is correct, then yes, that is what would fix the container being too small

thick hedge
#

I mean from here

low pike
#

I don't know your setup, that's not enough information for me

thick hedge
#

okay wait I got it

#

This was the setup of my menu

#

I just changed the height of buttoncontainer

#

That seemed to fix it

low pike
#

If the container for the buttons is smaller than the buttons (the red square) it won't stay where you scroll too. If it's bigger, like the green.. it will stay where you leave it.

thick hedge
#

Thank you I got it working now!

low pike
#

A content size fitter, on ButtonContainer, will probably do the job for you

#

and will auto re-size the container if you add/remove/disable buttons

thick hedge
low pike
#

you probably left the drop down at "unconstrained" which means it doesn't do anything.. did you try the other options in the only two dorp downs available?

#

If you did.. then the button objects (visible in the screenshot above) aren't sized correctly...maybe. /speculation

sleek wyvern
#

hey, i'm having this weird issue with TextMeshPro (not TextMeshProUGUI!) components where it will have this odd ghosting effect when the text is updated. Anyone know a fix?

mortal robin
#

It's possible it's an artifact of your monitor

#

I have that issue with one of my monitors that is more of a "work/productivity" monitor and not a gaming one

sleek wyvern
#

it's not really ghosting, but you can see the numbers on the gun morphing into a different one. i see it on all my screens, even on different devices, so it's most definitely there

mortal robin
#

oh i see what you mean now

#

I was looking at the Garage #01

sleek wyvern
#

oh lol oops. i should've been more specific

mortal robin
#

Could it be a postprocessing thing?

#

I'm not sure 🤔

sleek wyvern
#

i doubt it? maybe it has to do with my font asset, i'll try using the default one in a bit

low pike
#

test with no post proc too, confirm it's not making a difference

sleek wyvern
#

sorry, took a while, got lost in netcode. turned off TAA and it's gone.

mortal robin
#

Ahhh

#

that makes sense

#

TAA does antialiasing involving previous frame data

#

it could absolutely create that blending effect

sleek wyvern
#

i'm also having an issue where my UI TMPros that use my custom font are not showing when something is on the near clipping plane of my camera. this doesn't happen with the default font. i can not see any obvious differences between the font assets :(

#

see clock in top right corner

mortal robin
sleek wyvern
#

yup! thanks

mortal robin
# sleek wyvern yup! thanks

lucky string of events. Someone else mentioned them luckily stumbling upon that thread and I happened to notice them talking about it yesterday

tough wind
#

trying to move this text using the move tool, but the arrows for some reason aren't there. They used to be there, it only appears if I zoom out real far. How do I fix this?

mortal robin
#

I think it's related to the gizmos getting clipped by the scene camera near clipping plane

#

so maybe adjust that in the scene view camera settings?

tough wind
#

ok I just increased the near clipping a bit, it works now but idk what I just did

mortal robin
#

I'd expect it to work when you decrease the near clipping distance

unborn summit
#

i have some nested layout groups and when i instantiate a prefab into one of it, its not updating. its only updating after the next object was added to the list. i found a lot of tricks and workarounds on google, but they are really old (some from 2015 etc.) and i tested some of them but its not working. what i found out is that unity does not update the vertical layout group childs when a new child was added. Any ideas how to force them to update?

unborn summit
#

i tried that, doesnt work for me

sterile wedge
#

which recttransform did you pass in

unborn summit
#

the recttransform of the vertical layout group

sterile wedge
unborn summit
#

not seen yet 😄

#

damn

#

seems to work on the root but the childs which also has vertical layout groups are not updating

sterile wedge
#

i usually just need to put the ForceRebuild thing on the root.. but sometimes it's not enough. Quite an annoying issue

unborn summit
#

is it just an issue of unity or is it probably my bad because i used lots of vertical layout groups as child with content size fitter

#

i haven't found a working solution yet

sterile wedge
#

um.. it's a unity thing

#

most people want resizable scroll views and stuff, and that almost always requires a vertical layout group and a content size fitter

#

no matter what the warning says

#

it's kinda known that Unity's ui system is a small piece of hell sometimes

unborn summit
#

ok i got it to working better but not perfect

#
private IEnumerator RefreshLayout(GameObject layout)
        {
            yield return new WaitForFixedUpdate();
            Canvas.ForceUpdateCanvases();
            VerticalLayoutGroup[] verticalLayoutGroups = layout.GetComponentsInChildren<VerticalLayoutGroup>();
            foreach (var verticalLayoutGroup in verticalLayoutGroups)
            {
                verticalLayoutGroup.enabled = false;
                verticalLayoutGroup.enabled = true;
            }

            ContentSizeFitter[] contentSizeFitters = layout.GetComponentsInChildren<ContentSizeFitter>();
            foreach (var contentSizeFitter in contentSizeFitters)
            {
                contentSizeFitter.enabled = false;
                contentSizeFitter.SetLayoutVertical();
                LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)contentSizeFitter.transform );
                contentSizeFitter.enabled = true;
            }
        }
#

last message is the problem here

#

idk but it doesnt update the spacing in between the last element and the one before it

sterile wedge
unborn summit
#

this is the vertical layout group, doesnt seem to scale to the content

sterile wedge
#

vertical fit, try preferred. on your content size fitter

unborn summit
#
 private IEnumerator RefreshLayout(GameObject layout)
        {
            yield return new WaitForFixedUpdate();
            Canvas.ForceUpdateCanvases();
            VerticalLayoutGroup[] verticalLayoutGroups = layout.GetComponentsInChildren<VerticalLayoutGroup>();
            foreach (var verticalLayoutGroup in verticalLayoutGroups)
            {
                verticalLayoutGroup.enabled = false;
                verticalLayoutGroup.enabled = true;
            }
            VerticalLayoutGroup verticalLayoutGroup2 = layout.GetComponent<VerticalLayoutGroup>();
            verticalLayoutGroup2.enabled = false;
            verticalLayoutGroup2.enabled = true;

            ContentSizeFitter[] contentSizeFitters = layout.GetComponentsInChildren<ContentSizeFitter>();
            foreach (var contentSizeFitter in contentSizeFitters)
            {
                contentSizeFitter.enabled = false;
                contentSizeFitter.SetLayoutVertical();
                LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)contentSizeFitter.transform );
                contentSizeFitter.enabled = true;
            }
            ContentSizeFitter contentSizeFitter2 = layout.GetComponent<ContentSizeFitter>();
            contentSizeFitter2.enabled = false;
            contentSizeFitter2.SetLayoutVertical();
            LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)contentSizeFitter2.transform );
            contentSizeFitter2.enabled = true;
        }
#

this is working, i added also updating the layout itself and not just the children

#

but its so ugly solution/workaround 😮

#

any idea why my parent object does not scale to the child size?

#

Parent (Not scaling to the child text):

sterile wedge
unborn summit
#

the parent?

sterile wedge
#

yeah

#

um..

unborn summit
#

oh

sterile wedge
#

or, you could make the background a child of the text

#

and have the background stretch

#

so it'll stretch as the text expands

unborn summit
#

as a child it would overlay the text

sterile wedge
#

good point

#

i did this before, can't quite remember the solution.

#

Try adding a content size fitter to the background

unborn summit
#

yea that worked

sterile wedge
bright pelican
#

Hey can i get some help plz. My circle sprite is really blury.

sterile wedge
bright pelican
sterile wedge
#

keep in mind I said the texture size btw, not the UI size

#

try setting it to trilinear

bright pelican
#

u mean this size down here? cause i made the original circle in PS and made it 512x 512 been testing to try get it crisp so now its this

bright pelican
sterile wedge
#

if your UI is 512x512, try using a circle that's 512x512.

bright pelican
sterile wedge
#

no.. use a bigger texture

bright pelican
#

well i set to native size it worked but now it huge

sterile wedge
#

long story short, just use a texture size that matches the size of the object that'll be in your game..

bright pelican
#

@sterile wedge the mask component is making everything blurry, any ideas now?

sterile wedge
#

Masking in Unity has never had soft edges. You need 3rd party plugins for that. Try using a texture with a higher resolution for the mask

bright pelican
#

ok thx

unborn summit
#

I have 3 elements in my vertical layout group and i want to add a slide function when the minimize button is clicked. it should only minimize the middle element. i tried setting the minHeight & prefHeight of the middle element to 0. its working but in that the bottom "chat input" line is moved to under it because it has a minHeight. I cant remove the minHeight of the chat input because then its not visible

#

the middle element (content) has also a vertical layout group, that splits it into the display chat and the input chat

#

any idea how i can change the chat input line (which has a min-height) so it tries to use a specific height?

#

i have the 2 elements in my vertical layout group. i want that the top one scale as much as space is available and the bottom one to use between 0-40 but try to use 40

unborn summit
#

solved. For some who faced a similar problem: on the bottom element i set the prefHeight to 40 and on the bottom i set the flexible height to 99999. so it first try to scale the bottom one to 40 and then scale the top one to maximum

modern crystal
#

having a bit of a problem here

#

i'm trying to implement a menu where instead of multiple scenes i move the camera from one place to another (kinda like the tboi menu)

#

i set up some buttons and made 1 canvas per menu so anchors dont get messed up when scaling

#

i set the canvas render mode to world space and scaled them with the the rect transform scale

#

and now theres a single button that always gets triggered no matter where you put your mouse, like if it had an enormous hitbox

#

what am i doing wrong?

modern crystal
#

nevermind, i made some new buttons and now it works fine. it seems the scaling messed them up somehow

rapid ferry
#

these button icons are sprites, they show fine in the editor but when i run the game they just.. disappear?

#

the import settings should be fine

low pike
#

but when i run the game they just.. disappear?

To clarify - by run "the game", do you mean press play in the editor? Or in a build?

low pike
#

at editor play time, are the references still assigned in the inspector?

rapid ferry
#

...i just accidentally pressed don't save when restarting and lost 3 hours of work. i guess i don't have the problem anymore for the time being 😔 thank you anyways

low pike
#

you went for 3hrs without saving? 😮

rapid ferry
#

appears so somehow

#

how can i fix my buttons and texts scaling

#

they change size with dif resolutions

#

its so messed up

low pike
#
  • make sure your game view isn't set to 'free aspect'
  • set the canvas scalar to use a resolution
  • set the resolution to something that fits your needs (probably 1080p is a good choice)
  • set the slider to change with whichever width/height you want it to be
low pike
#

Do you do everything above it?

#

I put them in that order for a reason, if you pay attention to what you change.. you'll see the slider

rapid ferry
#

oh yea

#

did u mean screen size

#

scale with screen size

#

right

low pike
#

I don't have Unity open, I'm unsure what the fields are actually called

rapid ferry
#

i think its scale with screen size

low pike
#

Yep, that's the one

rapid ferry
#

that slider doesnt do anything

low pike
#

It does

rapid ferry
#

i didnt see any difference

low pike
#

It's just not doing anything for your current UI setup

rapid ferry
#

oh she

#

yes it does now

low pike
#

so I'd say just pick all the way left, or all the way right and not care

#

you're working in portrait mode too, yeah?

rapid ferry
#

yes

low pike
#

for mobile?

rapid ferry
#

yea

low pike
#

Using the device simulator?

rapid ferry
#

what simulator

low pike
#

it's a package for mobile devs, instead of using the game view.. you can select different mobile devices to see real time screen size changes

#

package manager -> swap to unity packages -> import device simulator

rapid ferry
#

i cant find package manager

#

and what does this do

low pike
#

dunno, never touched it.. you'll have to read the docs

rapid ferry
#

OH i found the

#

manager

#

i canmt see "swap to unity packages"

unborn summit
#

Any idea why the scrollbar value jumps to over 1 sometimes? i append a new element in a scroll rect and sometimes (about every fourth time) its just jumping to 1.6 but the view looks correctly. i already update the view but somehow unity set that value to 1.6+. usally 1 is max. 😄

#

main problem i have with it: it is correctly displayed but i need also a way to check wether the player has scrolled to the bottom currently but with that wrong values its always false

winter notch
#

Hi, I have a problem with my text, it kind of glow and it look really weird. does someone know how to make the text less ''glowy'' (to make it more realistic)?

mortal robin
#

you'd have to use a shader that responds to lighting for it

#

by default it's unlit

winter notch
#

i cant have two shader at once right?

mortal robin
#

why would you need two?

winter notch
#

um

#

since i want to unlit the text i need two right?

#

look

#

oh wait

#

it work

#

i found a way, sorry if I bothered you

grand citrus
#

Hello all, im trying to use Horizontal Layout and Vertical one, i just wondering what's this red line do?

grand citrus
#

okay it turns out it's not a red line... i had no idea what is this

mortal robin
#

Based on your anchor and pivot settings they've gone inside out basically

modern crystal
#

hey uh

#

im working with unity's 2D shapes as provisional sprites for my game and im running into an issue

#

whenever i put one of those sprites (say, a circle) into an image's source image it turns it into a square

#

how can i fix that? should i just google an image of a circle and use that instead or smth

tight cosmos
#

perhaps it's background or something?

modern crystal
modern crystal
#

still it doesnt matter now, i ended up changing the image for a spriterenderer cuz it was giving me trouble with changing its material's values anyways

limber violet
#

i made the canvas scale the ui's with the screen size and everything works fine but when i instantiate a new ui gameobject it's scale is cursed in everyscreen

void solstice
#

Hey I need some help with my UI in my 2D game

I have the UI on a canvas, and if I set the Canvas Scaler to Constant Pixel Size, UI elements get all messed up at different resolutions, even between like windowed mode and full screen mode. Things just dont stay lined up.

However if I select Scale with Screen size, it keeps the positions and sizes of everything proper at different screen scales, however it really messes up the pixels, as seen in the screenshot:
https://i.imgur.com/xjqiEQp.png

Any idea what the solution here is?

hollow atlas
#

anyone know how to fix this issue with text mesh pro? an ancient forum post i found said to increase padding size but that didn't fix it.

void solstice
#

really need to figure out this UI issue... I want to do title cards for areas, and lots of other UI related stuff, but I can't have my pixels looking all scuffed like this...

#

and like I said, cant do constant pixel size or even constant physical size, because they both have the issue of not scaling with the game resolution

#

the alternative is to just pick a set resolution and dont allow full screen, but thats not great either

low pike
low pike
limber violet
#

but still

low pike
#

show your code for the instantiate

void solstice
#

I havent been able to find any solid information about this issue, does anyone have any information or a good direction to go for this issue? I am stumped.

Again, it is that I am making a 2D pixel art game, and my UI elements are being eviscerated by canvas scaling... but if I dont use canvas scaling, my UI elements will be wildly different sizes and locations at different resolutions, which is just not acceptable

sterile wedge
low pike
#

the line between the red arrows is 5(?) pixels thick. The line between the black arrows, is 1 pixel

void solstice
#

the issue is that the scaling is stretching pixels, and pixel perfect doesnt help because that just aligns the pixels after they have been stretched

sterile wedge
#

Oh I see it now

#

I'm afraid I'm not sure

void solstice
#

side by side, you can see the difference clearly

still vector
#

both lines are supposed to be identical

low pike
#

Wanna give us more details?

#

Are they TMP? same font? what's the inspector look like? is it UI? world space UI?

still vector
#

The idea is that they are walls in a curved runner game with text on them, so curve shader need to be applied:

  • This is a World Space Canvas
  • This is Default unity Text UI Component
  • They both use the the Font Library/unity default resources/Arial
#

This happens when I change the Material (and hence the Shader too). I just really want to know what a Shader with ShaderGraph is expecting to be able to render Text

grand citrus
#

Can someone explain to me why does when i use Aspec Ratio 16:9 it's had different outcome when using Fixed Resolution, is it suppose to be same? 16:9 was 1920 x 1080? or i just misunderstood about this one?

grand citrus
mortal robin
grand citrus
river nexus
#

How do I make an escape menu with the background being the game live but blurred?

mortal robin
river nexus
#

by that i mean my dev friend will

restive haven
#

I have been using a vertical layout group to have some menus, But I wanted to have some of the buttons be side by side while still being stacked vertical, instead of 1x5 be like 2x5, is this possible with the vertical layout group or will it keep forcing them to be on top of one another

#

I made an empty first and just made the content children of the empty and that worked, not sure if this is a half ass way of doing or an appropriate way though

mortal robin
restive haven
#

Thank you, I didnt even see the Grid Layout, I am going to fiddle with that

low pike
#

You don't want a grid layout for this

#

Keep the vertical layout group, and where you want things side-by-side, create an empty GameObject and put a horizontal layout group on it.. with the buttons as children

devout nimbus
#
  • My hierarchy is Canvas -> empty -> button -> image. Image appears behind the button whatever i do, even when i make it a child of canvas directly. How to place it above the button?
low pike
#

If image is a child of button, it will be on top of it

sterile wedge
#

Show the inspector of the image please

devout nimbus
sterile wedge
#

Inspector

devout nimbus
sterile wedge
#

That's a SpriteRenderer, not an image

#

If you want it to be a UI element, it needs to be an image

low pike
#

You can't drag and drop sprites from the project window into the hierarchy when doing UI

devout nimbus
#
  • Noted, thanks
vernal ibex
#

How do I fix the small text or big text on diferent screen sizes?

woven glade
#

Hey y'all I have a UI question here regarding anchors.
So I understand how anchors work in regards to the screen and that is fine for 90% of what I am doing.
The issue I have is that I have a UI that needs to be relative to a background image as the resolution changes.
Is there a way to set anchor points based on game objects instead of the Screen resolution?

nocturne marsh
woven glade
#

awesome! thank you!

kindred gyro
#

Yeah, like the other guy said looks like your anchors are off and/or you don't have a canvas scaler component on your canvas

#

Just find a tutorial on UI scaling and anchoring

#

This is something you need to learn to do, and not hard. Just a little confusing at first

#

Ok, fair enough. Not mine

timber wind
#

im trying to make a ui for my gam (the first ive ever made) i have the anchor preset set to the top left but when i maximize on play it is in the same spot it is unmaximized but it isnt scaled with the sene veiw so it almost in the middle

nocturne marsh
#

using a TMP text how do I make it so that the rect fits the text, instead of the text fits the rect

#

ok got it, content size fitter

summer arrow
#

How do I see the UI in scene mode ? Or do I have to view it in game mode?

mortal robin
summer arrow
#

Oh there we go.

#

Does it have to be so awkwardly placed 😵‍💫

sharp kite
#

Then you can scale it and move it somewhere in the world

#

If it is annoying to see the big canvas in the scene view when you're not editing it, click this eye icon to hide it :D

#

.

[2020.3.16f1] Why can't I see the UI tab in the create menu? I can add the components manually

#

I read that it could be fixed by removing the Unity UI and TextMeshPro package, but I can't remove the Unity UI package as it is depending on the Universal RP package

#

I tried reinstalling the TextMeshPro package only as well as restarting Unity, but it didn't work :/

#

The only way for me is this

nocturne marsh
sharp kite
mild raptor
#

Hey everyone, Im building a speech bubble UI for my game, where the speech bubble will be on a canvas attached to a gameObject so it'll follow the NPC around. I was wondering what render mode would be more appropriate. World Space or ScreenOverlay. Im not 100% sure when to use which one

mild kernel
mild raptor
#

Ahh I see, thank you! I'll make sure to continue with world space then :)

topaz summit
#

Hi, i've been watching videos I could find on the following but still NG. I'm attempting to get a UI particle system to display on top of a ui Image. I've set up a ui camera & got all that working but A) the particle system only shows up in the scene view. B) the particle system only draws behind the image in question

#

When I select the camera I'm using for the ui elements, the little preview window displays the particle systems as well (though still behind the image)

topaz summit
#

Figured it out, the particle material doesn't like to draw infront of other transparent objects

mild pilot
#

Halo
I have an InputField, with a vertical scrollbar in the chatbox

If i click n drag the scrollbar, the scrollbar gets selected and the inputField loses focus
Is there a way to...have the inputField to maintain focus?

surreal kiln
#

How do I make a slider only go in some range instead of the whole parent? I mean like a max and min pos

mortal robin
#

handle slide area

quaint cliff
#

how do i use a scroll rect to scroll down a canvas?

mortal robin
#

Have you tried looking up a scroll rect tutorial?

quaint cliff
#

yes

#

anyway ima look it up again but do i need to apply the scroll rect on the canvas?

mortal robin
#

I haven't the foggiest idea as to what that means

quaint cliff
#

scroll rect is a component

#

so do i get the componentn on the canvas

chilly lion
#

How do I make a OnPointerEnter method call when an image element overlaps another image element?

low pike
#

do they both need raycast target enabled?

chilly lion
#

no, only the second image eleement

#

Is that possible to do?

unborn summit
#

i have a really weird issue, anyone have an idea how to solve that?

#

in the game its not really updating the text (not set via script, just normal)
Its happening since i updated the font. If i change anything in the font settings and revert that with ctrl + Z then its showing normally in the game view also. I dont have any idea how that happens and there seems to be no answer on google

#

all instantiated text objects are working somehow

#

when i set the Z position of every child object to 1 it is displayed correctly. but methods like "SetAsLastSibling()" will not work with that because it sets the Z Position back to 0

#

and i cant move the canvas to -1 or something

low pike
chilly lion
#

I did

#

but I'm still not getting onpointerenter

low pike
#

the class needs to be on the gameobject or a parent of the gameobject, which you want to catch ther pointer events from

#

you can also only have one class catching the events

unborn summit
# unborn summit

any idea? looking the whole day for a solution and cant find a solid one :/

low pike
tribal rampart
#

i have a problem
i have a button but when i click it it doesnt change the tint

mortal robin
#

only the tint? or is it not working entirely?

tribal rampart
#

nvm i fixed it

#

sorry

bold violet
#

could someone please help me with solving this issue?

#

the image on the canvas always has some pixels smaller

#

some squished

#

some longer

#

and it's only in game view

#

not in the editor

#

this is how it looks in the editor

#

can anyone help me with it?

#

i can provide any info needed

#

and if it helps to know i already activated pixel perfect on the canvas.,.

mortal robin
#

Did you do preserve aspect ratio?

#

And is the image component size a multiple of the image size?

bold violet
#

wait i found it

#

hmm the preserve aspect ratio didn't seem to fix the isue

bold violet
low pike
#

click the 'set native' button

mortal robin
#

the rect transform

bold violet
bold violet
# mortal robin the rect transform

so if the original image would be 30 pixels tall and 20 pixels wide, the image height could be 60,90 and so on, and the same for width?

low pike
bold violet
#

hmmm

#

wait... i'm using a grid layout component

#

count it mess with the rect size?

#

could*

#

i'm unsure of what i am saying just incase

low pike
#

You might need the pixel perfect stuff - which I've never touched, so can't help other than to point it out for you to look into

#

Yes, grid layout forces the cell size, which means you can't change the elements within.. so the 'set native' button can't do anything

bold violet
bold violet
#

the native button works only when something else doesn't change it's size from what i understand

#

and by itself it's supposed to make the rect of the image the same size as the texture itself?

#

without anything getting in the way

low pike
#

yep

#

so if the sprite is 1920x1080, and you've sized it down to be 100x100.. pressing the 'set native' button will resize it back up to 1920x1080

bold violet
#

okay i see

#

thanks guys, i managed to make it's size as the original image and it seems to have worked a bit better now

#

there's still some slight squished pixels but i'll look into the pixel perfect stuffs for it

#

thanks again! have a lovely day

restive haven
#

I have a very simple ui icon, but its pretty pixelated, is there a way to smooth it out? Its just a ui arrow

low pike
#

what dimensions is the image file?
what size are you setting it as on the UI?

restive haven
#

512x512 is the image dimensions, I also tried importing one that was 2048x2048
im trying to set it to be like 100x100

low pike
#

2k is far too big

#

512 should be enough

#

super hard to say anything else with nothing visual to go off when it's a visual issue..

quaint cliff
#

the square appears but not in the game ,why?

mortal robin
quaint cliff
#

sprite 2d

mortal robin
#

I'd guess it's just not in the camera's view

quaint cliff
#

you would be right

mortal robin
#

Check its position vs the camera

quaint cliff
#

thanks

copper patio
#

I have post processing turned on, etc, etc... I am working on a title screen. on the left (editor) my text is VERY glowy... HDR, etc.. but on my actual camera rendering (game) my text looks nothing like the editor. I know post processing is on, i know glow is on... but left looks like a badass NEON sign glowing, right looks like its masked? text? or something, like the glow is CUT right where teh text basically is, there is no overglow or effects its very flat

#

LEFT = editor. Right = game view you can see the text is different

#

i tried to zoom it to make a small screenshot so ignore that part of it

#

TextMeshPro / custom font from google /

#

juiced it up to 100000%

#

see the game looks like a BLOCKED MASKED square

#

the editor looks like its unmasked somehow

azure flame
#

I think this may happen when there's too little space between letter in the atlas. Try up the resolution then they work better with outlines

copper patio
#

yah that sounds like the thing

#

cause i indeed had to make a atlas and i was looking at the atlas and its just a big image

azure flame
#

Yes, also meant to say increase spacing for which you may need to increase resolution to compensate for quality loss.

#

I remember something like that being an issue

copper patio
#

ok I figured it out. it wasn't anything with the atlas. basically I have a game camera with post processing and etc and a UI camera with nothing. so the UI camera was getting no post processing. if i turned on post processing on the UI, then I got EVERYTHING... which sucks, so I made a 'second' canvas with just glowing elements and i added post processing to that one, so now i have a UI with no post processing, clean for interaction, and then another canvas just for glowy crap etc..which I have to figure out if this is what I want or if i just load up some sprites from photoshop with glow on them, which probably is what most people do performance wise / ease of use

gritty dawn
#

I need help

#

I have a script to test the hp bar

#

and it changes it

#

but it makes it invisible

#

and I have no idea what the problem is

#

please help someone

slim tulip
#

anyone know how to make my simple UI actually show in gam

#

I tried changing the Z axis and scaling it correctly but I dont know what the problem is

sterile wedge
slim tulip
#

I believe its just a problem to do with the layering, although when I check in 3D its Z axis is still infront of the 2D level

lean panther
#

It probably isn’t even in the right place

slim tulip
#

Yeah probably

#

thats what im trynna find out

#

im a beginner

lean panther
#

Is the grass an image?

slim tulip
#

Because I was testing with some different Zs to see if it was to do with the camera perspective

#

Its a tile palette

lean panther
#

Double click the canvas

sterile wedge
#

Show your hierarchy please

slim tulip
#

Very unorganised apologies

lean panther
slim tulip
#

Yeah its loads of the same image in a tilemap

lean panther
slim tulip
lean panther
# slim tulip

Can you select the canvas, press f with your mouse over scene view, and take a picture?

slim tulip
lean panther
# slim tulip

Did you shrink the canvas? It looks a bit blurry but maybe I’ve forgotten what the canvas looks like

slim tulip
#

I scaled it to my camera size

#

which is quite small

lean panther
#

The ui is overlayed over the screen, not the camera

#

Make it bigger

slim tulip
#

The canvas?

lean panther
#

Otherwise your text will look tiny

lean panther
viscid bronze
#

so i have this canvas and none of the buttons are interactable?

#

i press esc to open it and none of them are interacable

velvet scroll
# viscid bronze i press esc to open it and none of them are interacable

It could be many things, though most commonly, you might not have a EventSystem in the scene (if you are using the new input system, the old event system should prompt you about this on the component), or you have a image with Raycast Target true thats blocking your interactable elements, or your elements dont have raycast target on (which looks unlikely in your case), or your canvas is not the top-most canvas your interacting with

viscid bronze
#

so remove graphic raycaster?

#

i do have a eventsystem

velvet scroll
# viscid bronze so remove graphic raycaster?

No you want to make sure you DO have a graphic raycaster and event system, but make sure your background has "Raycast Target" set to false, and that your canvas you cannot interact with, is above the canvas you can interact with

viscid bronze
velvet scroll
# viscid bronze

If you turn off your other canvas, does the one you cant interact with then work?

viscid bronze
#

no\

#

i click and my cursor goes away becuase of the mouselook script

velvet scroll
viscid bronze
#

ok

#

it works when i disable the script

velvet scroll
viscid bronze
#

alright thanks

viscid bronze
#

how would i renable it?

lament delta
#

Anyone know the best way to add a border to my game and have it scale with canvas size

velvet dome
#

what is going on with this text? how can i fix this

hollow scroll
#

How can i prevent something from going behind my background ?

sterile wedge
#

is this ui or not. which one is ui? more information please

hollow scroll
#

one is an image one is a sprite renderer

#

the blue thing is a background

#

it's an image

sterile wedge
#

UI is always on top of sprites

hollow scroll
#

does that mean i can't put my sprite on top

sterile wedge
#

google "put sprite renderer on top of ui unity"

hollow scroll
#

alright

hollow scroll
#

i've been trying

#

i still can't

#

the only thing stopping me from making my game is a stupid music note

tranquil estuary
#

Hi, my button isn't reacting to clicks or hovering. I tried looking it up online, but nothing helped. I thought it may be because an input field is blocking it, but I don't think it's that, because when I disabled it it still doesn't work. Any help would be appreciated

hollow scroll
#

i've been trying to get this on top of my background for 2 hours

#

i have tried everything

#

and nothing work even a bit

jagged monolith
#

Select your event system and you can see see what is hovered @tranquil estuary

#

Why not just make the music note a UI image @hollow scroll?

hollow scroll
#

i'm an idiot i haven't tried it now it works thank you !

tight cosmos
eternal lance
#

Hello folks, I’m currently going absolutely insane on an issue that just started popping without me interacting with it in any form (at least I think)
The callback OnPointerExit is called on my Monobehaviour (that implements IPointerExitHandler) when the pointer is inside and not moving. I’ve used a breakpoint to see what the PointerEventData thinks I’ve just entered and it appears to be… the very same game object I was already in. How ???

#

I made sure to disable the RaycastTarget field on everything on top of that gameobject, add an empty image on it (it’s a button). But it was working fine yesterday when I havn’t made all these changes. The only thing I’ve done between yesterday and today is writing some code for ScriptableObjects GameEvent, and I haven’t put any in my scene yet…

#

Even crazier : even though the PointerEventData tells me I’ve entered the same GameObject, it does NOT raise OnPointerEnter

#
        public void OnPointerEnter(PointerEventData _eventData)
        {
            this.Log("OnPointerEnter " + gameObject.GetInstanceID(), "UI");
            Activate(true);
        }

        public void OnPointerExit(PointerEventData _eventData)
        {
            this.Log("OnPointerExit " + gameObject.GetInstanceID() + " --- Entered: " + _eventData.pointerEnter.GetInstanceID(), "UI");
            Activate(false);
        }
#

The delay between the PointerEnter et PointerExit seems to be random but stays under two seconds

azure flame
#

Simplify test, remove all possible interference. Perhaps try to replicate on a new scene.

eternal lance
#

Good point, I’ll try this

#

Also, from what understand the pointerEnter gameobject does not refer to a supposedly newly entered gameobject
edit: it works properly in an isolated environment, this is when I thank myself for having proper losely coupled architecture
I’ll go down the bughole and keep you updated

pulsar yew
#

Hi, I am not able to make my UI, scale properly with different screens and its driving my crazy. Any ideas?

eternal lance
#
#

Seems like my bug has hit other developpers too

#

Ok well I applied the fix without searching more

hollow frost
#

hey

real arch
# hollow frost

does it change if you make it bigger?
might be you just seen the border right now
size of width and height op 0.1 might be a issue

hollow frost
#

oh yeah thats the problem

#

thanks

#

I still need it to be 0.1 though I know its annoying but I can't just change the canvas size

#

ah pixels per unit multiplier fixed it :)

#

I have another issue, this should be draggable but it just disappears

#

@real arch

real arch
#

do you get a drop event?

#

how do you drag it?

hollow frost
#

with a left click

#

I followed this tutorial

hollow frost
#

border code is just to get the green highlight

real arch
# hollow frost

are you sure that setting the object position to mouse position is the right thing?
mouse position is in screen space
the object position is in world space

hollow frost
real arch
#

log the values of the mouse in the on drag event and see what happens if you try to move the object there and if that makes sense

mortal robin
#

(which isn't covered in that particular video)

rapid ferry
#

how do i hide a canvas object from the scene view?

thick blaze
#

Hello! A question regarding script, text and UI . Basically I'm importing files from my local drive into unity and displaying those file names. The problem I'm having is all files taken from the folder on the local drive are displayed on top of each other, only showing the last entry in the UI. What I want to do is arrange each file name vertically ( below each other like a shopping list ). How do I make each file name appear on a separate line? I can add script if it will help.

#

the above is at run time

tired jay
#

Hi, how to make UI Mask work if canvas in render mode - "screen space - camera".
Rect Mask 2D works, but i need circle

real arch
#

mmm works in my test case
you did set the camera in the canvas?

tired jay
#

Yep

real arch
#

all standard ui materials?

#

mmm wired
i cant recreate the issue
does a simple demo mask work in that scene?
try in a different canvas
does it work in a different scene?

#

that would be my steps to narrow it down

tired jay
#

which unity are u on

#

im on 2019 LTS

#

Maybe should try another one

real arch
#

2020.2 i can try it in 2019.4

#

what renderpipline do you use?

tired jay
#

URP

real arch
#

URP 2019.4.13f1
works too

tired jay
real arch
#

oops the URP is not set give me a second

#

new urp project with the test case still works
have you tryed the minimal setup in and in a new scene?
@tired jay

tired jay
tired jay
dapper scaffold
#

I have a character select for two or more players where the highlighted characters keep clipping into each other when displayed in their section of the screen. Is there a known way to sort of mask their cameras to fade the visibility of the model out of it exceeds a designated area of the screen?

exotic plinth
#

Hi, quick question! I have a pause menu that darkens the screen, but not the rest of the UI. How can I make it darken the other canvasses as well?

sterile wedge
#

Or put it on its own canvas with its own sorting layer

exotic plinth
#

Define ahead 🤔

#

I put it physically closer to the camera but that didn't seem to do it

dapper scaffold
#

Lower it in the hierarchy window so that it's at the front of the canvas

bright oak
#

Got the camera in assigned and the buttons still will not work

low pike
#

the event camera isn't relevant - world space UI will still work without one assigned

#

Got an 'EventSystem' loaded?
Everything got Raycast Target enabled?
Nothing blocking the UI?

noble apex
#

might be a collider too

low pike
#

What are you expecting to interact with? Just the mouse cursor? Or other stuff?

bright oak
#

doesnt look like it

low pike
bright oak
#

menu looks like this in game

low pike
#

Looks like there are 3 UI canvases

bright oak
#

The button animations for highlighting wont work either, which tells me the UI just cant see my cursor at all

low pike
#

I assume 3 is the UI you want to interact with, 1 and 2 could be blocking

bright oak
#

The big one is to make the game look low res which i wanted to make the UI world space to also have the same pixelated effect

#

no idea whats in front of the camera

#

Oh found it, its the score UI to display the score in the game

#

it shouldnt be blocking anything

low pike
#

It shouldn't but it could be

#

disable 1 and 2 to test

#

If it's enabled, then it will be able to block raycasts, meaning the pointer events can't get past from your cursor to the UI you want to interact with

bright oak
#

disabled the main 2 canvas and the pause menu wont show up without it

#

just a black screen as i expected

#

the camera renders the game through it

low pike
#

oh

#

it won't work because you're rendering it to a render texture

bright oak
#

maybe. The whole purpose was i wanted the UI to be effected by the render texture

low pike
#

Yeah, it's not simple to have it the way you have

bright oak
#

I see

#

might have to stick to overlay

low pike
#

pointer events don't hit the render texture and get passed to the UI elements

bright oak
#

ah

rapid ferry
#

Hey :)

I have a interface where i need to house 68 buttons in a circle. and because of the canvas size and read ability its not super easy so i decided to use a hover effect.

my hover effect however is getting cut off by the surrounding buttons. ( see video included )

how can i make sure my hover effect is always on top?

my script is simple as can be .

sterile wedge
rapid ferry
rapid ferry
#

hmm seems to work. thanks for the encouragement @sterile wedge partyparrot

low pike
#

For future reference, that solution won't work if you're using a layout group

late magnet
#

How can i make a hollow square with size scaling with transform size but the walls stay the same thickness?
in world canvas

sterile wedge
#

look into 9 slicing

lone cipher
#

I have a panel on wich I added a scroll rect, but when I scroll down, it just gets back, how do I make it stay where you scroll?

low pike
#

the contect rect needs to be the size of the content

#

currently, it's not.. it's the size of 3 rows

lone cipher
#

does the same

low pike
#

You changed the size of this? It's too small, so this deffinitely needs the height changed to the size of the content

lone cipher
low pike
#

It needs to be the size of the child elements, not the size of the parent

lone cipher
#

how do i know the size if I cant see them, in the tutorial I've used he used the size of the panel, not the size of my elements

low pike
#

you've either misunderstood him, or he's wrong

#

turn the mask off ... or use a contentsize fitter on the content object

lone cipher
#

yeah it works, but don't know how it works for him

#

thank you anyway

hollow scroll
#

how can i make those black borders disapear

#

on buttons

low pike
#

it's probably the sprite being used has them

hollow scroll
#

and i really don't know how to place my button without being blind on scene view

low pike
#

select the canvas -> press 'f' with your cursor over the scene view

hollow scroll
#

alright thanks

#

i left the scene and came back and now the whole background overlapped the scene...

#

nvm i made it work !

late magnet
rapid ferry
#

what icon fits a button that shows credits of the creators?

velvet dome
#

is there a way to increase mesh bounds? i made a script that curves UI and now i get loads of errors that the mesh is out of bounds

wild pebble
#

(text mesh pro) for some reason expecially numbers seems to be aligned very oddly vertically. it's aligned "middle" but still numbers are here and there

ionic beacon
#

Pretty sure that's just how the font is made

wild pebble
#

Second question. Unity is crying me about shader channels that are not needed so I'd like to get rid of them but unity doesn't seems to allow that. When I disable those, save the scene and reopen the scene, those gets back where they were and I get the *warning again. Not a big deal but annoying. Should I report a bug or is there some specific reason for that weird behaviour?

humble finch
#

Should i use 16:9 or full hd when doing UI stuff ?

wild pebble
#

I usually use full hd to make the UI look crisp on scene view but sometimes I use free aspect too to help making the UI to work on any aspect ratio/resolution

humble finch
#

Yeah im confused of what i should use that fits best for regular computer minitors

wild pebble
#

you should design the UI so it works on any monitor (using Scale With Screen Size option and anchors)

low pike
#

Using free aspect whilst designing and doing the layout for your UI is a bad thing to do

#

sure use it to test.. but it's not a good test

#

Set the scene view to 16:9, set the canvas scalar to 'Scale with Screen Size' and set the 'Reference Resolution' of it to whatever your designs are (I usually go with 1920x1080).

wild pebble
#

I don't disagree with that but why is it bad thing to use free aspect?

humble finch
#

Yeah and why do i need scale with screen size if i use 16:9 on game view?

wild pebble
#

you need scale with screen size so your UI scales according to the screen size and not resolution. If you use constant pixel size, your UIs gets smaller (relative to the screen) if you use same aspect ratio but bigger resolution

humble finch
#

And why is free aspect bad?

mild kernel
#

You should be importing your UI elements to scale based on a specific resolution. By setting your game window to the same resolution and the canvas reference resolution to the same, you'll be able to place the elements exactly where they belong.

low pike
#

Free aspect is a ratio/ resolution that will never be used by a player

patent panther
#

Hi, I'm trying to implement multiple UI screens by deactivating and activating buttons for each screen. When I change to another "screen" (which is just set of newly activated gameobject buttons) I cannot navigate and press any of the buttons. Any tips why this doesn't work? Is it even a good way to switch between UI "screens"? I'm using a gamepad by the way.

low pike
#

You need to set the 'active' selectable in the event system when switching canvases

#

this doesnt matter with a mouse , but with a gamepad it will

patent panther
#

do you mean "first selected" ? @low pike - Going to try this, thank you!

low pike
#

not first selected

#

that'll only work first time you enable it

patent panther
#

Thanks again @low pike , going to take a look 👍

hollow scroll
wild pebble
rapid ferry
#

Hello guy i need help for do a clean multiplayer selection car

#

but when i put horizontal it make me this

#

But i want to have her

cyan sentinel
#

Is anyone firm with the native keyboard on iOS and how to style it? I am currently getting an ugly black bar over the keyboard with big size fonts. Not sure where this is coming form.

cyan sentinel
#

Okay looks like you cant

rapid ferry
cyan sentinel
cyan sentinel
rapid ferry
#

but he dont respect me

cyan sentinel
rapid ferry
#

i have created a canva

#

and i have reduced the canva

#

and i but the charcter selection into

#

and i put a horizontal layer group

cyan sentinel
#

That is what setting up means. You setup the canvas, the selection and layergroup. On your layer group, you can align the children to middle center.

#

You need to block the raycast with your overlaying canvas

#

Your image, the dialogue box is visually above your box, but the image component of it does not block raycasts, right?

#

There is an option on the component

#

yes

#

So this will block any raycast from passing through objects behind it

#

It should be turned on. You sure the dialogue box is above the button?

#

Hm, I dont have any issues with TMP

rapid ferry
#

Can you help me please :c

rapid ferry
#

i need to create an another canvas ?

#

but how the guys doing this ?

cyan sentinel
#

So can you explain the hierarchy. YOu have a

-> Box as Button
-> Overlay with textmeshpro on it, anything else?
low pike
cyan sentinel
#

This is just hiding it, I wanted to style it, like the color or font being used. But thats not possible still. So I gotta calculate and add my own input field here, sadly

low pike
#

I don't think you can , but i've not looked into editing it

#

Maybe you can though, Clash Royal does IIRC

cyan sentinel
#

Yeah I just checked, from docs, this is all we have. Hide the field and call your own without input on top and the just put your UI input on top of this with calculated height

low pike
#

effort++