#📲┃ui-ux

1 messages · Page 38 of 1

normal cove
#

This screams of something being wrong. If I give these guys a preferred size of anything greater than 1, they grow, but not to the size specified

normal cove
#

the goal is simply to have two columns in a variable-width row that are always equally sized

patent sleet
#

Vertical layout group sets the positions of UI elements after first update (maybe in late update?) which means you can't get the local transform of UI elements in start, awake, or first update. Does anyone have any insight on when would be a good time to grab a base local transform for a child of a vertical layout group?

patent sleet
#

I ended up biting the bullet and doing it on late update, I just didn't want to add a late update just for that lol

low pike
patent sleet
#

Gave it a shot, good guess but exact same issue unfortunately.

hollow sleet
low pike
patent sleet
low pike
#

vertical layouts work at edit time, so for everything that's already present nothing should be changing UNLESS there's a change that affects the size of the group

patent sleet
#

Yep I'm instantiating it.

patent sleet
normal cove
#

Does anyone have any idea why this is behaving like this? It seems like such a simple use case. A vertical layout group has a child which is a horizonal layout group, which has two children that are vertical layout groups.

One would think that setting each of those children to Flexible Width would cause them to each fill half the horizontal group, until one needed more space. But instead they're growing long before they need it.

amber trout
#

This is really frustrating. I changed something with the camera (I guess) and now it looks like everything's rendering at half the resolution? I don't understand

#

What's really weird is that "200" in text size is way bigger in-game than it used to be

#

This has happened across all of my scenes too. Something real fucky happened

mortal robin
amber trout
#

yes

fossil shale
#

I'm calling EventSystem.current.SetSelectedGameObject on a GameObject which is in the middle of being initialised. The GameObject has a component called SelectedHandler. Awake has been called on the component, but not yet Start. The component has the ISelectHandler interface but OnSelect has not been called. Is this to be expected? The gameobject does end up being selected, but because OnSelect has not been called, it does not have the correct custom effects applied to it

mortal robin
fossil shale
#

I do have other menus where SetSelectedGameObject is called and OnSelect is called on the component

mortal robin
#

Perhaps Awake or OnEnable has not yet run on the EventSystem or something

#

meaning possibly it's not yet ready to call event handlers?

#

Just as a test - is it possible to move the SetSelectedGameObnject call to Start() or something like that?

#

Or in a coroutine with a 1 frame delay?

fossil shale
#

It is still happening even if I use a coroutine to delay it

#

Just added some more debug and it thinks this object is already selected

#

There was some old code which called SetSelectedGameObject on this object while it was still disabled. So that explains everything

summer trench
#

@fossil shale

#

Are you here

fossil shale
#

The object was not enabled, so OnSelect was not called, but it was still considered selected, and when SetSelectedGameObject was called on it again, it did not call OnSelect because it was already selected

#

One other problem I have is distinguishing between reasons for a button becoming selected. If a button was navigated to using keyboard or d-pad, it becomes selected (playing a sound effect). If a button was clicked on with the mouse and is not currently the selected button, the on select sound is played, but the on click sound is also immediately played. Is there a way of detecting whether the selection came from a mouse click, in which case I can suppress the on select sound?

mortal robin
#

e.g.

if (evt is PointerEventData ped)...```
fossil shale
#

I'm doing this, but it's showing as BaseEventData and false when I click with the mouse: Debug.Log($"OnSelect {eventData} Pointer: {eventData is PointerEventData}");

#

Might just try using Mouse.current.leftButton.wasPressedThisFrame

supple basalt
#

if you're still having this issue, select "Small Bar" and show me the preview pane for its layout properties

#

Oh, dammit, I didn't scroll down

#

i thought that was the last message in the chat :p

#

still, it looks like you've got some issues, so both the Layout Properties and the configuration of your layout group would be useful to see!

supple basalt
#
public void OnSelect(BaseEventData eventData)
{
    if (!target.IsInteractable()) return;

    if (eventData.GetType() != typeof(BaseEventData)) UISoundSource.Instance.Hover();
}
#

I'm checking if it isn't a BaseEventData

#

I guess I'd check what logging evt.GetType() shows. It should match whatever evt.ToString() produces

normal cove
versed grove
ripe turtle
# versed grove

could be wrong but pretty sure you need to connect the alpha as well

#

oh wait you are driving it through the sample texture mb

dawn notch
#

Hello all

Working on a class assignment, Recently my group struggled on getting our UI to scale properly in our game with different resolutions

Any help + rule of thumbs would be appreciated

#

For Example regarding above

Player UI is an Empty with the anchor points on stretch

Feedback is also an Empty with anchor points on stretch and their children are images

#

I feel that maybe we're doing something wrong with the hierarchy or the anchor points but im unsure

azure flame
mortal robin
plucky wigeon
#

how can i fix this

finite glen
#

do u use gizmos currently?

plucky wigeon
finite glen
#

this is because of it

#

i had this issue in 2 of my projects and it didnt interrupted anything

#

it is just a warning

plucky wigeon
plucky wigeon
finite glen
#

as i know, it didnt prevent my game from playing. are u sure that it isnt from any other porblem?

plucky wigeon
#

and this error doesn't show every time

dusk stirrup
#

does anyone know why I can't click any UI buttons when timescale is set to 0?

#

i have an animator on the buttons and the canvas itself both set to unscaled time

mortal robin
dusk stirrup
#

unless do unloaded menus still exist

#

it does to into dontdestroyonload if that makes any difference

#

since its not directly in the scene

#

but idk

mortal robin
#

check with e.g. IPointerDownHandler/IPointerEnterHandler if the events are being detected

dusk stirrup
#

it should be, i have a method in my game manager object that the buttons call

#

and what's weirdest is that pressing escape (another trigger for the unpause function) works

#

but the buttons dont even get like a hover animation

mortal robin
#

check with e.g. IPointerDownHandler/IPointerEnterHandler if the events are being detected

#

You need to do some actual debugging here

#

timescale doesn't directly affect the event system

slender viper
#

Is there a way to scale a background to text without ignoring overflow completely?

hollow sleet
#

perhaps if it doesn't you can sample the values off the tmp comp instead/additionally

#

its used in this console

slender viper
sharp pasture
#

I just started testing my app on an actual andriod phone and I have two UI issues that I don't understand at all why they are happening. The first is simply an input field that is not appearing. Any idea why?

mortal robin
#

the y position is hardcoded

#

You want it to be anchored to the bottom, presumably

low pike
#

Don't change the scale on UI elements either. Especially when you don't keep the scale uniform (the same value for all 3 axis).

It's going to cause you problems - change the scale back to 1,1,1 (for everything) and set the size with width/ height fields where necessary.

sharp pasture
#

@mortal robin : I'm not clear, what other option do I have other than an hardcoded position Y? Does it matter if its anchored to the bottom or the top. Either way it is dependent on the size of the parent element (PasswordPanel) correct?

#

@low pike : I'm not aware of any width and height fields to change the size of the input box. Can you please help me find them? I am new to this.

low pike
#

They're on the RectTransform. Though if you have it set to stretch the fields are renamed to left/right/height

mortal robin
#

right now you have it anchored to the top of the parent element, with a -173 pixel offset

#

so if the parent element is significantly smaller than 173 pixels high it will be pushed off the bottom of the screen

#

You want this one

sharp pasture
#

@low pike + @mortal robin : Thanks for your help. The issue was scaling and me incorrectly choosing my positions/anchors. Everything is running as expected now.

halcyon plover
#

Does someone knows why that weird "outline square" appears?

low pike
#

usually caused by the font being packed too close when you create the SDF with the TMP font creator thingy

halcyon plover
#

I got it

#

Ill try now and send the answer fast

#

So I tried increase padding in TMP_font Asset 4 to 8 like what you said

#

and It worked!

#

Thanks for your help :) @low pike

hollow heron
#

Heya, in a scroll bar , how do i make the content auto adjust after adding gameobjects through code?

#

my stuff is all there but the Content stays at 0 height

steep warren
#

the stuff is in Content, correct?

#

does it have a content fitter layout group?

hollow heron
steep warren
#

the content isn't going to get bigger on its own, something has to control it - that could be a layout group

hollow heron
#

Yup, I have Grid & Vertical, (2 display types), Those sizes are fine but content is 0

#

Yeah ,ContentSizeFitter didn't seem to work

steep warren
hollow heron
#

Content.sizeDelta = new Vector2(Content.sizeDelta.x, ScrollContentQuest.sizeDelta.y);
This didn't work either, almost like the sizes weren't set yet

hollow heron
#

ContentFitter->Preffered works great on the 2 child prefabs but Content is unaffected

hollow heron
hollow heron
#

Fixed it with an inline coroutine that delayed 1 frame, and then set the content size to the proper child size

supple basalt
#

ContentSizeFitter is not a kind of layout group. You often use it along with a layout group.

#

For example:

  • Scroll View
    • Viewport
      • Content <-- ContentSizeFitter, VerticalLayoutGroup
        • Items <-- HorizontalLayoutGroup
          • Item 1
          • Item 2
          • Item 3
        • Cool Picture
supple basalt
#

this even seems to be an intended use of that method!

#

/// However, for special layout calculation needs, ::ref::ForceRebuildLayoutImmediate can be used to get the layout of a sub-tree resolved immediately. This can even be done from inside layout calculation methods such as ILayoutController.SetLayoutHorizontal orILayoutController.SetLayoutVertical. Usage should be restricted to cases where multiple layout passes are unavaoidable despite the extra cost in performance.

#

This is necessary if you need to know how large the RectTransform is going to be right now

#

(but this should not be necessary at all, in your case)

#

appropriate use of ContentSizeFitter and layout groups will make it work correctly

hollow heron
#

Yeah I tried that but it was still getting size values from the frame before all objects were added

#

either way the 1 frame delay worked perfectly 🙂

frigid bone
#

render order in UI stuff is usually a matter of what's first in the hierarchy right? Why isn't this changing if I move it above DialogueUI?

mortal robin
frigid bone
#

Ah, nevermind, I had canvas components on the constituent objects of the popup to set their order relative to each other, and it was overriding the render order with other stuff

little fable
#

hey uh guys

#

i have a background image. i wanna add a title on the background image for a main menu screen. is there any like person who can find me a good font for it . the game is about finding a kids toy its called Toy Trails

#

nvm

#

i can mak it

halcyon plover
#

does someone knows how to make UI render first?

#

I already make the "PerkSelectionAlert" locates higher than other Elements

#

but It does not working

#

also all of the child elements has Sorting layer UI(5)

#

And If i make Canvas to PerkSelectionAlert and change sort order

#

it works but that makes the child Button not working

sonic granite
mortal robin
# halcyon plover

UI elements lower in the hierarchy will be drawn on top (within the same Canvas)

#

Also make sure everything involved here is using the Image component, not SpriteRenderer

#

And if you're using multiple canvases, things are a bit different

halcyon plover
#

wait

#

bruh did I remembered completely opposite way

#

I thought the Children above would be rendered at the top

mortal robin
#

children are rendered on top yes

#

not sure what "children above" means

#

the good way to tell is just where they appear in the hierarchy window. Anything that appears below something else in that window will render on top

mortal robin
# halcyon plover

That's why enemy info is appearing on top here, because it's lower in the hierarchy

halcyon plover
#

maybe I'm confusing for midnight issue

#

wait a sec

#

So The lower the child is, the later it is rendered, and it is located on the top layer.

#

is it right?

sonic granite
#

yes

halcyon plover
#

damn I'm so embarrassed

sonic granite
#

dont be, happens to the best of us

halcyon plover
#

Thanks man

#

have a good day guys thank you

#

I might be go to sleep aaa

patent sleet
#

I want to be able to drag a scriptable object into a public field on a UI prefab, and have the UI prefab be populated with the data. Doing this in game is easy of course, but I want it to update in the editor. I tried with a property which seemed to work at first but never printed any debugs, I think it was just assigning to the underlying field unfortunately.

patent sleet
#

Cheers, just found it too :))

winter zenith
#

Please stop advertising here This channel isn’t for service promotion

ionic beacon
#

<@&502884371011731486> spammer

amber plank
#

am not

amber plank
hollow sleet
ionic beacon
frosty pewter
#

!ban 1450105861040246867 spamming non-Unity job postings across many channels, ignoring server rules

marble pawnBOT
delicate mauve
#

and i don't know why

#

These are some of the rect transform values for it

#

i don't get what a negative value means in this contxt

thick sundial
#

If I mask a UI image, and then set a button to use that image as its graphic, will the raycast click limit itself to the contents of what is shown in the mask?

zenith nimbus
#

I imported a big map image (1920×1080) directly into the scene. Now when I add UI (Canvas/Text), everything feels off scale-wise.
The map is already scaled down a lot, and if I scale it more, the aspect ratios start breaking.

What’s the right way to handle this?
Should I resize the map via PPU instead of transform scale, or is this more of a camera / canvas setup issue?

timber elbow
zenith nimbus
#

sry you have to be wrong iam getting yellowd wehn i start the game

timber elbow
zenith nimbus
#

As is tryed to say when i creat an panal is so big i have to scale it down to 5x5 and then i cant see it in game anymore something with the scaling has to be wrong i resettet all of the rec

timber elbow
#

Look at the game view to see how it would look like in runtime. Or use a world space canvas.

zenith nimbus
zenith nimbus
timber elbow
#

You can hide the canvas while not working on the ui.

timber elbow
torn crane
#

Just to clarify something, UI isn't visually scaled to the objects in the world (in the scene view). The UI in the scene view should look significantly larger than game objects in the scene as they're in screen space (seeing them overlap is simply for the development process). For instance, moving would not have the UI leave the screen. If you're wanting to simply work within world space, TMPro would also allow you to do so (canvas setting) but it's really up to what you're trying to achieve (I'm assuming this is a misunderstanding with the design process of UI)

rapid ferry
#

When I go to scene it looks like the image but when I go to game It looks blue and blank please help me fix it (I did script scrolling UI look at right hand side code below.)

using UnityEngine;
using UnityEngine.UI;

public class ScrollingBG : MonoBehaviour
{
    [SerializeField] private RawImage _img;
    [SerializeField] private float _x, _y;
    void Update()
    {
        _img.uvRect = new Rect(_img.uvRect.position + new Vector2(_x, _y) * Time.deltaTime,_img.uvRect.size);
    }
}
steep warren
#

what kind of canvas are you using

rapid ferry
steep warren
#

a screenspace overlay canvas should be fine

#

you said you were just seeing the camera's background color in gameview, or what exactly?

rapid ferry
steep warren
#

so the camera's background color, right

rapid ferry
#

idk

#

Its the background of the game

ionic beacon
#

The scrolling BG script is probably broken. Does it still happen if you remove or disable the script?

steep warren
#

that color is the default camera background color, that wasn't a question

steep warren
#

do they show up if you use a normal image

rapid ferry
#

Idk but why do my shapes keep on spawning in huge and far away from my camera?

rapid ferry
steep warren
#

ah

#

that explains it

steep warren
rapid ferry
steep warren
#

you've made your stuff insanely small because you've been trying to match them to the camera's worldspace size

#

your image is showing up fine

steep warren
#

select your canvas in the hierarchy and press F to focus it

rapid ferry
#

Oh that would have been nice to know LMAO

steep warren
#

now you do 🎉

rapid ferry
#

tysm

#

With my scrolling frame think there is a way to patch this with code?

steep warren
#

i mean, code is just doing things, you can basically always solve things with code, but that's not necessarily the best option

#

you should just make your texture tile properly

rapid ferry
#

How do I do that?

#

In here?

steep warren
rapid ferry
#

Oh texture tile property

steep warren
#

that's also not what i said

rapid ferry
#

huh

steep warren
#

properly, not property

#

this isn't anything in the editor

#

just make your image better

rapid ferry
#

Oh okay

#

urm

steep warren
#

the left edge and right edge of the image don't align, that's why you have that seam

sand gull
#

anyone know how i can make sure the menu size stays reasonable for different aspect ratios? for some it just turns to a single line for others its gigantic

steep warren
proven falcon
#

@steep warren this is the setup of the button

#

and the text

steep warren
#

make sure none of the parents of that button are scaled either

#

those.. are some massive rects

#

if it's in screenspace, 1920 width would be the entire screen on 1080p

#

and the height seems about normal, so probably you have something along the hierarchy where X is scaled

proven falcon
#

yes i was also confused by those astronomic numbers haha. But i found out the parent parent object, my panel, was set at x 0.30

#

I only learned today that you should reshape by width and height, and not scale

vale otter
#

Hello. How would you go about implementing a static UI bar at the top of the screen in Unity similar to games such as Super Metroid and Shovel Knight? I want the game screen to functionally end where the UI starts and have been unsuccessful at finding any tutorials or guides on how to implement this.

chrome kettle
vale otter
proven falcon
#

happy new year!

im trying to learn the UI system of unity by trying to create a dialogue system, and have a question.

here im using two example buttons using a content layout group to organize them, and it looks fine.

but when i run the game and initiate the dialogue, the responsebuttons clutter. any idea why ?

steep warren
#

are you setting the text there at runtime?

proven falcon
#

yes, i think so. the text is inside some scriptable objects which i assign to the npc objects

steep warren
#

it just soudns like they aren't set up to handle that correctly then

#

perhaps try setting the button text to some longer placeholder text and see if that breaks in the same way

proven falcon
#

it partially worked! The padding wasnt assigned left enough to show the whole text if it was long enough, so i fixed that. But the text for the two options are still spawning on top of each other, and stays on top even when i adjust top/bottom on the vertical layout group

steep warren
#

ah wait, that's padding not spacing, nvm

#

have you tried messing with the control child size stuff?

#

-# i honestly just set those by trial and error... i should really figure out how to use them properly lmao

proven falcon
#

i think i've found the issue here's my code where i spawn the buttons depending on the number of available responses. However since the only spawn when conversation is initiated, how do i adjust their position ? i mean it's not like theres something in the inspector i can drag around

#

If you understand my problem ?

steep warren
#

well, you'd make sure your UI is anchored and set up properly to handle that

proven falcon
#

well they are anchored correct i think. Their position is more or less correct, it's just that they all spawn on top of each other. How do i adjust each individual elements spawning position, when theres no game object i can move around ?

steep warren
#

well, then obviously they aren't set up correctly lol

#

How do i adjust each individual elements spawning position
you don't, that's what a layout group is supposed to eliminate

#

you use the layout group to define how it should be laid out, and then it does it for you, no manual tweaking of each individual element

proven falcon
#

Haha no you're correct. But what i mean is that the top element is exactly where i want to be. they just all appear on top of each other for some reason. I've set child alignment to top left, and i can change their position by adjusting left and top ( not bottom and right) but even when i change the values of left/top they still stay on top of each other, even if they change their position. Any ideas why ?

steep warren
#

is your vertical layout group perhaps overly constrained?

proven falcon
#

hmm, not sure what you mean by overly constrained. Sorry, im still pretty now to this UI stuff

steep warren
#

like, maybe your vertical layout doesn't have enough space to expand down to accomodate the buttons

#

i'm not super well-versed with UI so this is mostly guessing at potential issues rather than knowing what mightve happened tbh 😓

covert flint
#

ok so my thing is not scrolling.
QuerySlots has a scrollrect and a rectmask2d.
Scrollable has a grid layout group, but it's not auto-sizing, and when i put a contentsizefitter it shows a warning saying i don't need it in a grid layout group. But apparently something is wrong because the grid layout group is not growing to fit the new slots

mighty agate
#

guys can somebody help me TMP_InputField is typing but text not visible

azure flame
#

Does the default component work if you just drop it in without changes?

proven falcon
azure flame
covert flint
#

and now it's not scrolling again, idk what is wrong

#

i added a scrollbar, that's it

#

i have it set to clamped and it does nothing, but when it's elastic it works half of the time.

azure flame
#

It reacts to the size of the Content element. So select it to see its gizmo when you moving the slider.

#

(if content element size is fitting the window already, or nearly so it wouldn't be moving)

covert flint
#

I don't see anything when enabling gizmos

#

or not for the selected item

#

i see other gizmo things

#

ok so it only scrolls when it's hovering over a slot

#

also it doesn't update the scrollbar, even though it's pointing to it in the inspector

clever sapphire
steep warren
#

how's your camera set up? is it following the player, a child of the player, etc?

brave mesa
#

just set up a nice timeline grid using the Grid component, a Scroll View and a bunch of rects
what would be the best method to add visible grid lines to this?
(Note: watching until 0:18 of the video is enough, the rest is just me showcasing the grid numbers)

#

(the Grid component doesn't do anything right now, but it is correctly updated, and I would like to be able to utilise this if possible)

heavy fractal
#

is there a way to add a panel into a script? (preferrably by using public)
making it public gameobject doesnt let the panel enter
making it public panel doesnt work either due to "security level" or smth
and trying to get it by it's recttransform doesnt work either
can anyone help?

steep warren
#

oh this was 3 hours ago

#

please don't crosspost for future reference

mortal robin
#

depending on what you're trying to do, any of these would work:
GameObject, Image, RectTransform, Transform

ruby shell
#

ok basicly the ui doesnt work when i start the project

#

editor

#

in game

#

the test input work but when i try to put in game doesnt work

steep warren
#

can you show the scene view (of the text object) when in play mode

humble yoke
# ruby shell in game

Write out “Ammo: 29 / 30” outside of play mode to see how it looks and if you have the same problem. You may just need to make the text box larger.

#

Not a good test to use a different text value. Use the same one

steep warren
steep warren
# steep warren

@ruby shell there's 2 components for tmp text, one for UI and another for worldspace
you have the worldspace version there

ruby shell
#

okok

#

and i need the UI

#

how do i change

steep warren
#

add the correct version and remove the wrong version

#

it's not like, a setting you can change, they are separate components

ruby shell
#

im really not understanding sorry

steep warren
#

what part of "add the right component" do you not understand

ruby shell
#

where i add a componnet

steep warren
#

you could probably just create a new gameobject with the right settings instead, that'd probably be easier

#

however you created this one, do the same thing except pick the UI text

ruby shell
#

ok

#

okok thanks it wokr

#

work

#

thank you and sorry for my bad orientation

steep warren
#

also go through unity essentials, it sounds like you haven't

#

!learn

marble pawnBOT
ruby shell
#

thanks

solar herald
#

Has anyone got any idea on how to properly scale the Canvas (UI) for a pixel style game? My resolution is 320x180 and my PPU for all my sprites is 32. I've created a health bar I want to use for my game and made it in a UI with a image and a slider for the health bar itself. When I imported the sprite it was 64x16 as I wanted it to be about half the size of the actual world grid and length of 2 world grids. When I manually add sprite onto the scene without canvas it looks actually really good, but when added to a canvas and set to native size, its absolutley massive on the scene now. I've tried making my UI Scale With Screen Size specified X and Y and also match to 0.5. Tried playing with PPU on canvas Scaler nothing happened tried setting my sprite to 1 PPU as I've asked chatgpt if it could give me an idea and nothing changed there. I'm kinda running out of ideas as this is my 1st ever pixel project and kinda lost of the UI front of it as I need to make a lot more UI stuff and I'm unable to get HP bar to work correctly. 🙁

steep warren
#

@solar herald let's continue here.

#

have you checked the Include Font Data option in Font Import settings?

#

import settings for any given file are visible in the inspector when you select that file

solar herald
#

There is absolutely nothing here. I'm following a guide on youtube on how to create this dual coloured pixel perfect font and its from 2022 but he just creates an asset and is able to extract the atlas so he can edit it as atlast created becomes a single white colour instead of black outlines with letters being white. Ive done everything step by step as needed. Unity is being absolute pig about this.

#

If I put in Dynamic mode I options for Include font data

#

With Dynamic I'm unable to extract atlas from the asset to edit it

steep warren
#

ok, one thing at a time. with tmp you can specify a custom set for the atlas with the tmp font asset, so im pretty sure dynamic is a step in the right direction

#

what's the issue you had with extracting an atlas

solar herald
#

there isnt an option to extract atlas with dynamic option thats the issue Im having but idk if custom would change that.

steep warren
#

real quick, are you intending to use tmp (text mesh pro)

solar herald
#

Yes ofc

steep warren
#

have you generated the font asset?

#

the font asset is what you configure with tmp stuff afaik

solar herald
#

yes but im unble due to font ass in dynamic breaks pixel perfect and make everything blurry

#

trying to use bitmap but that aint working rn either

steep warren
#

dynamic is unrelated, dynamic just means the characters imported are dynamic

#

the render mode is what you'd configure for this if i'm not mistaken

solar herald
#

shit mb forgot to add my proper render mode. Okay now its the atlas time

#

Now that I have font asset I cannot extract the atlas.

solar herald
#

This is my atlas its does generate it but I need to edit this with my dual coloured font where there is black outline

steep warren
#

mm, i'm unfamiliar with that aspect

#

what do you mean by "extract the atlas" exactly?

solar herald
#

Here I made bitmap asset from my original TTF and it has the ability to extract font as PNG which is linked to the actual atlas. If you edit that PNG and swap all the atlast with correct black and white you're able to get dual coloured font pixel perfect.

#

Does that make sense? I hope

#

But when I use maker for asset it make that what it is instead of the actual asset where I cna extract atlas from

steep warren
#

the font asset thing made the top PixelPerfectTinyFont?

#

that's not right, make sure you chose the tmp option and not the text option

solar herald
#

I got the atlas

#

How and why was is making normal text and not tmp

#

I have no idea Ive been battling unity for last hour or two for this going nuts

steep warren
#

probably because you chose the wrong option? the tmp and text menus are right next to each other so couldve just been a mouse slip

solar herald
#

they also loook idetical

steep warren
#

they have different icons, they're different asset types

solar herald
#

thank you for noticing this I will go try edit the atlas and see if rest of the step work,

solar herald
steep warren
#

the tmp font assets have that capital F thing

solar herald
#

@steep warren You know how to make custom work? because Dynamic is just not doing it. Its messing up all the characters and only 1st character works from custom font.

steep warren
#

the characters option is just about what's included in the atlas, it doesn't have to do with rendering

solar herald
#

nvm I got it to work its really quarky but pixel perfect does work I can now scale font size and its pixel perfect on screen and no blur what so ever

honest pond
#

hey yall quick question

#

how can i have an UI image have its size stretch/shrink to fit different image sizes?

#

the second one is a wider frame but i want it to stretch

polar sinew
#

ive got a free pixel font but some letters and numbers are not pixelated ? is there a setting i could fix that

edgy plaza
tame shell
#

@neon field you can align as you want by having your elements use anchoring correctly and have the layout group expand width

#

The elements need a parent container that gets force expanded and inside is where anchors get set

neon field
tame shell
#

It can't be the object that's in the scroll rect content

neon field
#

Actually it works when i remove the vertical layout group from my content (Scrollview component), but it's this vertical layout that manage the fact that the bubbles doon't overlap each other

tame shell
#

You need an additional gameobject

#

So:
Content
-> Element parent
-> -> Bubble image
-> -> -> Text

#

The things inside element parent get their anchoring set to the left or right

neon field
#

Hmm, I'm maybe too new to this, but like, my bubbles are basically two prefab object with the image of the bubble being the root, and having a text as a child. Then i have my Scrollview which is a child of my canva. And the bubles are added to Scrollview -> Viewport -> Content with a script

#

Oh

#

Like I'm supposed to have one more parent in the content of my scrollview where the bubbles get added ? Is that what you meant ?

steep warren
tame shell
golden stump
#

Can the default ugui toggle be made to stay a certain color when "is On"? I just want a color effect on the toggle, not an image or animation change

#

But the docs do not even cover the "Selected Color" in the inspector!!

#

I think this is a missing option from toggles which expect the 2 image method, I used a modified button before and custom code

mortal robin
misty thunder
#

Hey y'all, I'm making a book UI for my game and I'm trying to achieve one-sided text so the text only appears on one side of a page. I tried using the same shader that I used for the images but it just screws up the text. Would someone be able to point me in the right direction? Cheers

mortal robin
#

What components is your book made of?

misty thunder
misty thunder
mortal robin
#

We can't figure this out without knowing what we're looking at here

#

are these SpriteRednerers? Mesh Renderers? UI elements (UGUI? UI Tooklit?)?

misty thunder
mortal robin
#

And what Canvas render mode is your canvas using?

misty thunder
mortal robin
#

Ok so I'm a bit unsure what you're trying to achieve here

#

WOuldn't you just disable any UI that shouldn't be visible?

#

Are you rotating it or negative scaling it or something?

#

Also where does a shader come into play here?

misty thunder
# mortal robin Ok so I'm a bit unsure what you're trying to achieve here

I'll try to explain what I'm trying to achieve here the best I can: So what I'm trying to do is make a book UI that you can flip through the pages of. Right now, each page is an image that rotates around a specific point to look like turning a page. Each of those pages have images that use a shader I made to mask them to only one side so you only see whatever images are on that one page rather than all of at once (if that makes sense) and I'm trying to do the same thing with text but unfortunetly the shader doesn't work with TMP as it just makes the text a bunch of black boxes

misty thunder
mortal robin
#

use actual 3d objects, it will be easier

misty thunder
misty thunder
mortal robin
#

otherwise - i would just disable the component when it's facing away from the player

#

that's much easier/simpler than a custom UI shader

mortal robin
misty thunder
covert flint
#

I have 2 bugs. In QuerySlots there is a ScrollRect and RectMask2D. in Scrollable, I have a GridLayoutGroup and a ContentSizeFitter.
The 2 bugs are:

  1. The scrollbar does not update at all
  2. The panel only scrolls when my pointer is over a Slot, if it's between the Slots, it does not scroll.
#
  1. It also lets me scroll out of bounds
#

i fixed 1 and 3, but it still only scrolls when i am hovering over a Slot (The viewport was supposed to be the parent of the scroll content)

covert flint
#

Fixed 2 by adding an image component to the same GO as the ScrollRect, and setting it to transparent

tribal lava
#

i have a curved slider

#

when the sliders value is set between roughly 1 to 0.7, theres no difference

#

only when it gets below that does the slider work visually

#

how can i get it to show for all values

azure flame
#

Put in a solid image, then you'll see how it works and can adjust range with code.
You probably want to limit it to 0.150-0.850, if you put it on a non rotated image.

honest pond
#

i want the image to grow to fit the image at the same resolution

covert flint
#

For redering 3d shapes in a UI, do i really need to put the canvas into a camera object? (Changing it to "Screen Space - Camera")?

mortal robin
#

not sure what you mean by "put the canvas into a camera object" exactly

#

Screen Space - Overlay will always draw on top of everything else

covert flint
#

(Screen Space - Camera) is what i meant

mortal robin
#

There is one other option though - you can render your 3D object to a RenderTexture, then draw that texture in any kind of canvas (including Overlay) with the RawImage component

#

But if you just want to render a regular MeshRenderer over UI, you can't use Overlay

covert flint
#

will render textures be viable for an inventory system?

mortal robin
#

for an inventory system, unless you have a really good reason, I would just pre-render your items as sprites

#

and use the regular Image component

#

If you have a lot of different item types, you can automate this process.

covert flint
#

Hmm... eventually i will have items with custom data that will chnage the visual, i could cache them probably,

#

ok so i am looking at a tutorial that is putting the item itself into a scriptable object

#

it'll be the ground item probably

#

can i can still use a json object for a scriptable object?

mortal robin
covert flint
#

like can i use a json to auto gen scriptable objects (for editor)?

mortal robin
#

a common pattern for inventories is something like:

  • A ScriptableObject defining the item
  • An inventory that contains references to the SOs
  • An "in-game" version of the item that also references the SO
  • A UI element that references the inventory data
mortal robin
#

you can write code to do whatever you want though

#

if you want to define your items in a JSON file, just do that

#

the point of ScriptableObjects is to be able to define and work with, and reference, the objects in the Unity Editor directly

covert flint
#

is a scriptable object like a class where it is assigned for any type of item, or should i have one scriptable object per item?

steep warren
#

a scriptable object is an object, an instance of a class that derives from ScriptableObject

#

make sure you understand the distinction between objects/instances and classes/types

#

each SO represents some static data, a kind or a type of item in this case
then the actual "items" would reference an SO to know which specific item it is and what properties it has

cobalt skiff
#

Is it possible for me to see UI elements in the Scene view?

#

They're all invisible so right now its hard for me to adjust anything

#

All the layers are on as well

wanton jolt
#

i have some text inside the choice button, i want the choice button to expand to fit all the text, and the choices to display the choice buttons vertically. this is working well right now but i want to add animations to it, which apparently i need a layout element for. adding a layout element messes up all the formatting i have already though, i tried it with and without all the other components but it doesnt work. anyone know the proper way of doing this so i can also easily animate it?

wanton jolt
steep warren
bold granite
#

Hey I could use some help, in my game I have split screen with the input system but when I have 2 players the UI doesn't shrink down to show everything so the score at top right corner and the ability icons in the left corner can't be seen. How could I make it work?

low pike
delicate mauve
#

So that it doesn't hit the slider if you resize the window?

low pike
delicate mauve
#

THey are all in a parent as you can see in the hierarchy window

#

but putting it into a sub parent causes more issues with the overall control @low pike

low pike
#

if you don't show what those issues are, you won't be able to get further help..

delicate mauve
#

yes one moment

#

@low pike

#

the top parent is a component from some library

low pike
#

Organise the slider so it has its own parent. Instead of being 3 or 4 sibling game objects

#

Should be something like

horizontal layout

  • left text
  • slider
    -- slider element 1
    -- slider element 2
    -- etc
  • right text
#

you don't want the horizontal layout to be controlling each individual element of the slider, which is what you have atm

delicate mauve
#

oh huhh

low pike
#

When you create the slider from the right click menu, it's all under 1 parent.. that's how it should remain

solid mirage
#

Hey I am trying to access the color part of the Image component in the UI RawImage, in my code. I want to change the colour of the UI Image based on a variable trigger. However when I am trying to run the following code it is making every UI element fully transparent.

If you could help me out with how to change the colour of the RawImage through code.

[SerializeField] GameObject dialogueCard;
public Color horenColor;

public void ColourChange ()
{
        if (colourTag = "horen")
                {CardColorChanger(horenColor)}
}

public void CardColorChanger(Color cardColor)
    {
        dialogueCard.GetComponent<RawImage>().color= cardColor; 
    }
low pike
#

First tidy up the code and get rid of that GetComponent - you shouldn't be doing this everytime, cache and re-use.

[SerializeField] RawImage dialogueCard;
[SerializeField] Color horenColor;

public void ColourChange ()
{
        if (colourTag = "horen") {CardColorChanger(horenColor)}
}

public void CardColorChanger(Color cardColor)
{
    dialogueCard.color = cardColor; 
}
#

What colour has horenColor been set to in the inspector? -> show a screenshot

solid mirage
#

this is the inspector

low pike
#

that black line under the green means the alpha is set to 0

solid mirage
#

I am so stupid

#

sorry I did not even see that

low pike
#

we all make small mistakes like this, no matter how experienced

solid mirage
#

I am completely noob to technical stuff tbvh

#

also why did it make all the UI elements in my project transparent??

#

I only put the reference to the specific UI image object

low pike
#

unknown from the information provided so far

solid mirage
#

ah okay

solid mirage
#

It is working perfectly

#

thank you for helping out

covert flint
#

the "RectMask" won't expand to fit "Credits (TMP)" What's going on?

low pike
lucid trench
#

what is this error? it was fine before, I had just reopen my unity and it's like this now. I don't think I've never mess with GUI or some sort

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

steep warren
lucid trench
#

oh okay thanks

dense token
dense token
# dense token

Hello I was told to ask this question here if someone can help that would be much appreciated

quartz whale
#

any idea why my panel has UI elements passing through it? I thought I fixed it by changing the waiting canvas' sort order to 1 (and keeping the other one at 0) but that doesn't work in play mode for some reason

low pike
#

And just to be clear, the project dice and buttons should be hidden behind the waiting for steam..?

quartz whale
#

I think I fixed it, the project dice canvas didn't have a background panel and that seems to have caused it... maybe?

#

not sure how that works

low pike
#

if you don't put an image on a gameobject, then there is nothing there to block the view

#

a "panel" isn't anything special, it's just a premage game object with an image and assigned sprite

quartz whale
#

yeah I'm just a little confused on why that matters when the Steam account panel should be obscuring the other UI stuff anyway

#

but it works now somehow

celest lodge
#

how can I add a drop shadow to UI elements?

mossy tendon
#

Not sure if this is a good place to ask about this issue
I think the issue may be related to UI layers but not entirely sure

mossy tendon
#

Welp turns out the issue was just I had to adjust the order in layer on the particle system itself

snow junco
#

Anyone have any of the top of their head idea on why my menus don't react to mouse cursor at all? I was building them with gamepad in mind mostly, so they all navigate with gamepad/keyboard. but I wanted to properly support clicking around, added a custom cursor, and a Cursor.visible = true on menu open. (and lockState=None)
made sure only the image component on the gameobject with the "Button" component has raycast target checked (removed them from nested text labels)

I'm using screenspace - camera with the camera set to my scene's main camera. (but I tried to switching to overlay just to test, and still no clicks/hover events)

proud sandal
torpid sun
#

How would one find the center-most selectable item in a scroll view? I'm working on controller navigation and created a script to scroll an active scrollview when the object selected in the event system is a child of the content rect by using the right stick. However, this signal does not signal to the event system to navigate to the nearest visible or available content item. Struggling to think of what the best solution is, or if scrolling via stick is even a good idea.

#

I've seen it done in other games and to me it feels intuitive... if you're in a vertical scrollview, move the right stick up and down to go up and down. Maybe it's not as common as I thought, but, yeah, if I do go with this navigation solution, I would love some ideas on how to navigate to the center-most object.

proud sandal
# torpid sun I've seen it done in other games and to me it feels intuitive... if you're in a ...

You can simply pick the middle item, but if you have many items its often not such a good idea to keep them all instantiated, then your math/pooling/updating gets more complicated. If your items have different sizes, you need to make some sort of 1D spatial lookup where each content item's rect registers its area. On a gamepad pages can be a better UX than a scoll view, but that depends on the specifics of the design.

Transform content;
Transform middleObject = content.GetChild ( content.childCount / 2 );
torpid sun
# proud sandal You can simply pick the middle item, but if you have many items its often not su...

Ah, yeah, in this context I mean the middle item relative to the viewport.

However, you may be correct that pagination would be much better here rather than a scroll view. I may implement that instead for this use case if this gives me any more trouble.

A friend of mine at another studio mentioned instead of controlling the scrollbar programmatically, instead using the right stick to simulate a faster UIVertical input and then snapping to selection. I'm currently trying to use a UIScrollToSelection I found on UIUtils but unfortunately doesn't have a setting for an offset (to overshoot the scroll) and I had trouble decoding it to redo it myself.

Maybe I'm thinking too hard. Console compliace/controller support for the last 2 weeks is frying my brain lol.

#

Here's the video example

proud sandal
#

you can optimize that by adding each rect to a spatial lookup data structure so the "what is close to point X"-question gets cheaper.

snow junco
snow junco
#

But this is breaking other stuff (I'm adding a callback to playerInput.onControlsChanged ) and it looks like disabling and reenabling it looses my bindings? I feel like I'm fighting unity and doing something wrong.

Should my EventSystem driving the canvas use the same inputactionasset as the gameplay player input? Or should I use the autogenerated default one that gets created with a new EventSystem? Whats the best practice for pausing player inputs when menu interactions are open? disabling the PlayerInput? Disabling the player map? (I've seen suggestions to call SwitchCurrentActionMap but this didn't seem to work for me...

#

And bonus question, outside of ui/ux topic maybe, it seems that pressing Escape when playing in editor takes away focus from my game. This seems to be editor specific behaviour, can I turn it off?

sharp pasture
#

I have a text input on the bottom of my screen. When I click on it, it gets completely covered by the keyboard. Can I please ask for guidance on how to handle this? I have no idea what to do but the user experience is horrible as it currently sits.

hollow heron
#

Heya guys, how can I get my items to overflow to the left instead of to the right?

#

I imagined "Middle Right" alignment would do it but nope. They align correctly until it's full and then overflow to the right

low pike
#

middle left?

hollow heron
#

Same, they align to the right/left based on that dropdown but once it's full they shoot off to the right lol

#

I tried changing the rect anchors, pivot, reverse, etc

low pike
#

I don't think I've done this before.. I'm willing to bet there isn't a built in way and you'll have to code something for it

hollow heron
#

Yeah thought so, prob just a unity oversight. Thanks!

#

Was planning to shrink them inside the box anyway, was just curious about this 😛

steep warren
#

ah, you've tried that, never mind

hollow heron
# steep warren try reverse arrangement, maybe?

Yeah I think it's just something unity didn't think of. Everything works perfectly until overflow, it always goes to the right no matter what lol. Can be easily fixed with a nested object though if needed, though tbf the box should just be big enough to begin with 🙂

steep warren
hollow heron
#

Nope it just made the box bigger lol

steep warren
#

does it not make it bigger in the correct (left) direction?

hollow heron
#

It does yeah was just curious about overflow, but that's bad design anyway (I wasn't even using it)

#

So I doubt it'll be a real issue for anyone

steep warren
#

i'm confused, doesn't that solve the issue then

#

it expands to the left so the rightmost element stays in the same spot, no?

hollow heron
#

I was just curious, items aligned to the right are added to the left, but then overflow back to the right. Wasn't an issue I was specifically trying to solve. Just one of those things you kind of expected to behave differently 😛

#

Wasn't planning on using it, just one of those "huh, interesting" moments 😄

wanton jolt
# torpid sun

is this a dating action game or something? it looks so good

torpid sun
wanton jolt
#

thats such a sick idea

torpid sun
#

Thank ya thank ya. Fingers crossed I can get it steam deck verified before valentine's day lol

quartz whale
#

any idea why textmeshpro UI text component's overflow setting doesn't work for me at all all of a sudden? no error or anything - yesterday I was getting the warning that ellipsis doesnt work so it would default to truncate, today it doesnt even truncate

#

wait im dumb text height is too high

#

still weird that it lets me change to ellipsis now tho

quartz whale
#

I feel like I'm going crazy - it randomly changed again and now I can't use ellipsis and it changes to truncate again

#

same font as in above screenshots

low pike
#

at this point I'd reimport the TMP essentials, mebbe something is wrong with that font asset

quartz whale
#

I'll try that, thank you!

#

hmmm that didn't work, but restarting Unity worked

#

so weird

torpid sun
#

Is there a good way to get an event subscription for when a TextMeshProUGUI's text changed?

#

Wanted to make a helper script I could apply to a dropshadow text obj to always mirror another TextObj without the overhead of a loop.

#

I tried checking out the TMP_Events but the documentation has no examples, and I couldn't figure out how to use it.

torpid sun
glacial canopy
#

Does anyone know why this image isn't fully opaque? I have this worldspace blackout screen thats still marginally transluscent.

#

I made sure the alpha was 255

#

the shader is for making it render over everything

#

Apologies if this is the wrong channel by the way

low pike
#

Do you think it's not opaque because you can see the scene grid through it?

glacial canopy
#

I can see the world through it

low pike
#

What type of canvas is it? World space?

#

oh, must be - looks like it's for VR

#

In that case, I'd suggest your material/ shader isn't setup correctly to be rendered last

glacial canopy
#

Yeah probably

#

I set blend to off and it fixed it

#

but this means I can't do transparency like fade to black

#

currently its just a binary switch

#

ill have to revisit this issue tomorrow because I can't keep my eyes open

#

3 am debugging

earnest tartan
#

im fresh from bootcamp when it comes to unity can somebody explain as to why the green doesnt stretch from left to right and just becomes a blob

low pike
#

the image file assigned in the sprite field isn't square

earnest tartan
#

I coldn't find square anywhere

low pike
#

..make one?

earnest tartan
#

yeah mb

#

thanks

low pike
#

or just remove the sprite, the field can be left empty

steep warren
rapid hill
#

Hi, wondering if anyone can give me some advice I have no clue when it comes to designing good looking UI and any feedback and tips on how to improve my design would be appriciated. I don't think it's very good but don't know how to improve it or what about it makes it feel bad. It's the UI for menu in my VR game that appears in front of you in world space when you press the menu button. You select things via a ray interactor originating from the hand.

#

Ignore the font for the discord part I meant to change it to match the font for everything else just didn't notice it

proud sandal
#

This gives you enough understanding to plot your own course towards the goals and topics that matter to you.

rapid hill
#

I wasn't really planning on doing a deep dive into UI as I really don't have the time for it and there won't be much in my game compared to everything else I have to do. Just wanted advice on what parts of my current UI need improvement and ideas on how to implement more aesthetically pleasing elements.

proud sandal
rapid hill
ionic beacon
queen apex
#

hey guys so I will start to design my game's ui like main menu, settings and player hud. So there is a new thing called UI Toolkit with Unity 6 but should I use that or should I use the old canva system. Which one do you prefer?

proud sandal
# queen apex hey guys so I will start to design my game's ui like main menu, settings and pla...

they serve different purposes and arent drop in replacements for each other. toolkit excels with lots of data, panels, menus, UI like the unity editor. Canvas UI excels by being well integrated with prefabs and scene hierarchy flows, it makes it easier to do 'rich' UI, HUDs, 2.5D world-space UIs etc. You can succeed with both. The main selling point of toolkit is that it promises to make style-consistency and maintenance more manageable as a project & team grow.

queen apex
hallow bear
#

Is there any way to add canvas specific grid/guides? I want it so I can align my elements in the corner accordingly.

steep warren
#

assuming that it's anchored to top left, which it should be

hallow bear
#

Let me try

hallow bear
#

What does extrude edges do?

#

I can't notice difference if I change that value.

proud sandal
# queen apex So for a indie game developer, using UI toolkit for main menu and settings scree...

Using two frameworks creates overhead you don’t want. A settings screen or menu can be achieved easily with either. Toolkit is good for ‚lots of menus and data‘, not for ‚the odd panel with a few extra items‘. That said, you can choose either one and be successful, just in different ways. If you’re making, for example, a colony simulation with many inspectors, dashboards and views into the simulation data, toolkit is a natural candidate that solves many practical issues that canvas UI has in that situation.

trail flint
steep warren
#

canvases sort rendering top to bottom in the hierarchy

#

the sort order you see there is for the entire canvas, compared to other canvases

#

so your dialogue there would indeed be rendered on top of the fading screen

#

presumably your fading screen would only be fading at runtime, since that's something that happens over time. so i'm not sure what you're seeing when you say it's behind the fading screen in edit mode

trail flint
#

this?

steep warren
#

what's your question

tame shell
#

Do you have any sub canvases or just the main one?

#

Because your second screenshot omits the useful information of the gameobject name 😐

trail flint
#

oh

#

they are all sub canvas

#

let me rename them

#

but I don't know why the fading canvas is not above all of them

tame shell
#

By using sub canvases and using "override sorting" you fuck with the normal sorting scheme

trail flint
#

oh

tame shell
#

Sub canvases main purpose is to isolate some UI graphics/text to optimise rendering

#

You can use override sorting to force things to draw on top of other things but it seems to have caused the issue and confusion here

trail flint
#

i will check it , thanks

hallow bear
#

If I maximize the game view, the purple UI element moves towards center. I want it fixed towards the corner like the 1st image. I'm not sure what's wrong.

#

It seems like it's happening because of PrimaryObjectives game object. I've set its anchor to center. But that shouldn't cause issue? What's happening is, the PrimaryObjectives rectangle changes its size whenever I resize game view. That's the reason that UI also moves. I don't know why rectangle is not same size as canvas all the time.

#

As you can see, the PrimaryObjectives outline and Canvas outlines are not aligned.

#

Found the issue. I just needed to set anchor as stretched.

mortal robin
#

you want to anchor it to the top left

mortal robin
steep warren
mortal robin
#

and the game view you have set to free aspect, which is why it changes resolution when you change the game window size

hallow bear
hallow bear
steep warren
#

so have the parent stretched and the child anchored to the top left

hallow bear
steep warren
#

hm those are in px so it should be equal

#

keep in mind that the child will be anchored to the top left of the parent, so make sure the parent extends to the top left

#

or you could have the margin on the parent and none on the child

hallow bear
# steep warren hm those are in px so it should be equal

Here. Note the X and Y position values, 200 and -50px. If I put both 200 or -50, the image doesn't have equal margin. I guess it's because image is rectangle, not a square.

But the other solution as you said is, give margin to its parent element which I stretched. That should also work.

steep warren
#

it not being square shouldn't be an issue afaik

#

oh it's because the pivot is in the center

#

you would also move the pivot to the top left

hallow bear
steep warren
#

yep

solid umbra
#

Hi everyone I have a problem with my ui sometimes it disappears in some devices

And I have a video for the issue I have

(Note: I am working on a mobile game for IOS and android)

(Note2: I use pixel art for my game and in the scene menu the ui is still there but in the simulator it doesn’t show up)

mortal robin
#

use the game window settings to test various resolutions, especially those of the target device

low pike
#

When working with mobile, don't use the game view at all. Use the device simulator, change the selected simulation device to test different resolutions

pure moss
#

Hi friends, I’m looking for a blur effect between UI elements. I’ve searched for this, but I’ve only found solutions where game objects behind the UI are blurred. Does anyone have an idea how to blur a UI element that is behind another UI element?

mortal robin
pure moss
#

@mortal robin Thanks for replay, which post processing effect is work for this? motion blur is for moving objects

mortal robin
red wing
#

How Do I Hide Horizontal Scrollbar And Make Vertical Scrollbar Look Smaller

low pike
#

untick the 'show' bool on the scroll area component

red wing
low pike
#

You need to learn the basics of Unity to be able to understand the help given.

#

Things to learn for this:

  • what the hierarchy is
  • what the inspector is
  • what a component is
  • what a gameobject is
  • where values/ vars/ bool/ etc would be displayed for a component on a gameobject.
red wing
#

Sometime... The Chat Was Too Small To Type

steep warren
#

make it anchored and stretched properly to be responsive to various resolutions

slender viper
#

And set the canvas scaler component appropriately

#

I.E. 1280x720, and "match height"

short gazelle
#

Every canvas in my project is set to this and in the player pref i set the preferred size to 540x960, but when I make the web build it has a relatively large excess for scrolling. My display res is 1920x1080, is there smthg im doing wrong ?

red wing
celest lodge
#

I made this mockup in photoshop, but how could I make a per player event system that is limited to a certain set of UI elements to accommodate something like this?

mortal robin
#

to be honest I'm not sure from your mockup what you're referring to exactly though

celest lodge
#

it's hard to explain via text

#

but like basically when you select your character your controller is confined to your quarter and you can navigate that sub menu and only that sub menu

#

this multiplayer event system looks good though

#

thank you!

mortal robin
#

but I understand what you mean

celest lodge
#

but yeah it looks like the multiplayer event system is perfect for this

solid umbra
#

I am using the simulator to see how my game is going

low pike
solid umbra
low pike
#

Pixel perfect camera has nothing to do with this, it won't make a difference to your issue.

#

Set the reference resolution on the canvas scalar to whatever resolution you used to design your UI in Photoshop (or whatever).

In my last job the designer always used 1080x1920

#

can you actually show the issue too

solid umbra
solid umbra
#

I’ll dm you the video

low pike
#

no you wont

solid umbra
#

Here it should be showing the ui

low pike
#

Pls don't share photos, use screenshots

#

and it's helpful to include the whole editor window

#

When it's in this state, you need to investigate.

Look at the scene view, look at the UI in the hierarchy.. is it active? is it setup right? etc

solid umbra
short gazelle
#

is the resolution of the build determined by player preferences or the resolution u select in the game view

mortal robin
pure moss
#

@mortal robin Hi, I have use gaussian and bokeh mode in depth of field effect i got the amount of blur i want from bokeh mode but letter i come to know that its not working on android, so i transfer to gaussian blur but with that i can not get the maximum blur i want. is there any way to do this with post processing?

mortal robin
pure moss
#

Hello, i am using TextMeshPro -InputField in my mobile app and i am facing issue with virtual keyword, like when i select one inputfield and then select another the vertual keyboard kind of flicker first its disappear and then reappear how to solve this issue.

humble yoke
#

Is there a good free resource to look at common ui templates/formatting for portrait-orientation iOS game In-App-Purchase shops? I’m working on one but feel like I’m trying to reinvent the wheel when it comes to where to put things

#

Just reference images

#

I’m not really a UI/UX designer so it’s not super intuitive for me, so referencing common patterns would be really helpful

steep warren
#

i tried searching "shop" and filtered for mobile there, and there are some portrait results, but i couldn't find where to filter for portrait if that's an option

#

ah wait, found it

#

controller & display > display > portrait

humble yoke
onyx coral
#

quick q does this look good for a UI (just the style)

onyx coral
#

instead of having the seperating line being just a red / blue line , make it into an arcade screen effect , also behind the instructions just add a big black transparent box and animate the buttons being clicked

#

since u going wit ha pixel art theme , makee the hearts also pixel art and remove that blue box cus its ugly

cinder swift
onyx coral
#

just add the hearts either on the top of the screen of each character or on the top of the entire screen

onyx coral
cinder swift
#

ah alright

onyx coral
#

ill make smth rq and send u an example holdon

cinder swift
#

alrught thank you

onyx coral
#

@cinder swift smth like this for the death counter (the number is a bit off lemme fix it rq)

#

also add a drop shadow for a smoother look

cinder swift
#

drop shadow?

#

So more towards having an icon than the words "death"

onyx coral
cinder swift
#

Okay thank you so much

#

Ill implement it tomorrow

#

About to sleep

onyx coral
#

also having the same for hearts might be boring so just use heart capsules that become empty when consumed (aka when the player takes damage)

onyx coral
onyx coral
#

unless u are diabetic

cinder swift
#

Heart capsules?

onyx coral
cinder swift
#

Ah man

#

I dont reallt have it on phone

#

isit something like minexraft?

#

for the heart u talking about

onyx coral
cinder swift
#

mhm

onyx coral
#

make them pixel art instead of normal art

#

and put each persons stats ontop of their part of the screen

cinder swift
#

Oh i have camera swapping to shared and all that

#

they have shared health

#

so i decide to put in a general area

#

Its just a part of my game

onyx coral
#

and finnaly add this effect to each screen and add alot of Bloom

cinder swift
#

inspirstiob from pico park

#

1 dies both dies

onyx coral
#

and add a screen shake effect when hit

cinder swift
#

then if i do shared camers i bring the health to top right?

onyx coral
cinder swift
#

I got 2 camera modes

#

During boss fight i only have 1 camera

onyx coral
#

oooh alr alr ye i get it

#

ye put the health next to the death indicator except this time their death counters are 2 indicators in each corner of the screen ( u can change the color of the pixel art depending on the player)

cinder swift
#

Ah alright

#

thanks for the suggestions

#

Will be trying it tmr

onyx coral
onyx coral
cinder swift
#

else i do top right which for the shared

onyx coral
cinder swift
#

Alright nice

#

seems good

onyx coral
#

alr , gl with ur game and gn

cinder swift
#

Thank you bro

onyx coral
onyx coral
#

and i can make u the hearts too if u want

#

ok now it looks like im riding u so hard alr dude imma stop ts gn

quartz whale
#

this seems really wrong @tame shell , whats that red x for one - does it mean its inverted?

tame shell
#

Yes thats correct. The content anchors should only be expanded horizontally and vertically they should both be at the very top of your viewport

#

presuming this scroll rect wants to scroll vertically

quartz whale
#

yes

tame shell
#

And you still need to move its anchor (round blue circle) to the top middle

quartz whale
#

oh wait

#

bro... I somehow set the viewport to be the Uh Oh text and not the actual panel

#

🤣

#

that explains so much

tame shell
#

Ha hopefully it works better now

quartz whale
#

it works way better yeah, thank you!

quartz whale
#

any idea how I can have the text padded away from the left and right slightly, without changing the shape/size of the background panel?

#

changing padding in the layout group makes the background expand as well, and it moves past the edges

low pike
quartz whale
#

thank you, that fixed it

#

struggling so hard with all these layout elements still though 😢 I'm trying to have the text determine background size, and I thought I had it but on playmode the layout group set all elements to y = 0 and broke

steep warren
#

try them in context

azure flame
onyx coral
#

this channel i mean

onyx coral
azure flame
#

It's for UI questions about Unity, if you want to run a poll about your game, use devlogs

onyx coral
tame shell
quartz whale
tame shell
#

If you wanted a bg for the content + text that is simple to set up

robust eagle
#

anyone know how to make ui's actually look good and properly scale. The first image is what the game should look like and is what the game looks like when I make a build and play the game on my pc's monitor but when I try the game on a different monitor the buttons and ui look like the 2nd image. I have my canvas stuff on the 3rd image for anyone who can help me out. Man I just hate when ui's are like this...

low pike
#

You have to anchor everything correctly, and use layouts.

The canvas/ canvas scalar are only part of the required setup.

robust eagle
low pike
#

nope

#

First off, scale should always be at 1,1,1 for UI. You'll run into issues if you don't keep them uniform, and you just don't need to use that for sizes of things, that's what the height/width fields are for.

Second, you do not want to stretch a button to the entire canvas like that. It will change the button size in annoying ways for different resolutions.

#

Those buttons should:

  • be children of a parent with a vertical layout group on it
  • have a scale of 1,1,1
  • not set to stretch
  • have their width/ height set to the correct value
#

the parent will probably want to be anchored to the left side, middle

robust eagle
low pike
#

no, you need to change it OFF stretched

#

change this to...er.. the middle one

robust eagle
low pike
#

You use stretched for panels, images that need to fill the parent, etc

robust eagle
low pike
#

they're all red ;p

robust eagle
#

XD

low pike
#

but there's only 1 middle

robust eagle
#

ight

low pike
#

The layout group on the parent will deal with the anchoring

robust eagle
#

ye I've made a parent called left side and one for right side

#

and basically jus anchored it to the left and right and placed the respective ui elements into them

low pike
#

on bigger resolutions you'll end up with a gap in between them

#

maybe .. test that, the canvas scalar might take care of it

robust eagle
#

ye I'll see tnx for the help

golden seal
#

seems like masking and fallback tmpro fonts don't work too well together (1st image no mask, 2nd mask on the tmpro object with show mask graphic on, same for mask on the child submeshui with show mask graphic off)

#

not sure how to approach fixing this

#

I assume the way that the submesh's stencil values are set up isn't entirely correct for my use case

obtuse shell
#

I put it in the wrong channel, sorry

sharp pasture
#

I'm trying to build an inventory item view page (using Vertical Layout group) and I can't get the spacing correct. I want the image to take up all the extra space (make description height small) and I can't find the correct settings to do so. Currently all elements have a Layout Element component and all have flexible height = 0 except for the image which is 1. Can someone help me find the corret settings?

#

Oh, I forgot...I wanted the image to spaced in the middle so I put it as a child. It can be viewed here:

tame shell
tame shell
#

second make sure to override the preferred height for your image to 0

golden seal
short gazelle
#

how do you make the game screen fit even when you change the display scaling of ur screen ?

mortal robin
#

and test it with different resolutions

#

Also choose the right canvas scaler mode that you desire

quartz whale
#

anyone got any ideas for 2 more colours I could use for 5 and 6 dice that would fit with these? the idea is to try to be colourblind friendly, but also distinct colours

celest lodge
#

How can I fill a complex shape like the bottom curved shape? I want it to follow along the shape, not just like a sweeping horizontal full cus that's not going to look good

low pike
#

I think you'll be needing a shader for that

feral sparrow
#

I got a ui question

#

why selecting one toggles under a toggle group effects everyone?

#

like I have toggles like this
-Toggle set A
-- 1
-- 2
-- 3

  • Toggle set B
    --1
    --2
    --3
#

if i select 1 in A then it deselcts everything from B despite me not wanting it

low pike
#

you must have them linked somehow

ionic beacon
#

You probably have them all use the same toggle group object

feral sparrow
ionic beacon
#

What does that mean

feral sparrow
# ionic beacon What does that mean

i assign toggle group to my button but yet having global behavior. I searched about this a bit but not much result about it. So wondering if I'm missing right keywords which shows how to assign toggle buttons and multiple toggle groups

ionic beacon
#

Make two toggle groups. Assign one of them to set A and the other to set B.

#

It can't know that you want sets A and B behave separately if you assign the same toggle group to both

celest lodge
jagged monolith
#

This is how I would do it. You use the mask as the background. Then for the fill, you just do a threshold on the gradient which will cut it off as you go from 1 to 0

celest lodge
#

what functions would you use to cut off the fill?

#

you mention threshold

mild dome
#

how can stop screen tearing for ui objects without setting vsync to every v blank? when disabling and enabling ui objects

#

one image is with vsync on and the other is without
half way through disabling
i tried limiting the application fps but that didnt help cause i was getting like 3000 fps in my main menu

mortal robin
#

Screen tearing is just part of life if you're not using vSync

#

no?

jagged monolith
mortal robin
mild dome
celest lodge
mild dome
mortal robin
mortal robin
#

although UI is generally pretty static and not updated frequently compared with teh rest of the game so it might just be less noticeable

mortal robin
#

you might need to add some custom code to select all the text when focusing the input field

celest lodge
# jagged monolith

hey sorry just coming back to this, how did u make thst gradient shape? are u doing in it in photoshop or something?

mild dome
#

because when i have vsync off and i disable my black overlay which reveals the gameplay straight away i can see the tear

#

do you know if games by any chance force vsync in main menus and cut-scenes?

#

and then vsync just goes back to whatever the player set it as before in settings

jagged monolith
celest lodge
#

is there an equivalent to OnDrawGizmos for the editor window class?

low pike
green lark
tough sand
#

hey how could i create a curved UI? it's mostly for a visual detail in an animation and I have only found for resources for VR

low pike
#

You need a shader for it, the same shader that works for VR will work (the VR element is not relevant).

You cannot curve a screenspace overlay canvas .. it'll need to be world space or screenspace camera

tough sand
#

Oh okay, thanks :D

jagged monolith
#

CurvedUI plugin should work fine for non-VR, it's a good package

mortal robin
tough sand
#

I thank all of you for your replies and time though ❤️

wild pebble
#

Shaders can distort things quite easily. The only problem with it is that it does not distort the CPU side presentation so if you need to interact with the distorted UI elements, you must take that into account somehow or otherwise the hitboxes for the elements would work where the undistorted elements would lie

obtuse shell
#

What can I do to fix the font texture to be a pixel perfect font?

Its looking like that, an the bar below its pixel perfect, how can I do for the font to look like that?

Thanks a lot in advance peepoHappy

random cipher
#

ok before i attempt to try to recreate the wheel, does unity have a way to have more than one person to select selectable objects at the same time?
im working on a local multiplayer character select screen and i haven't seen any unity examples showing that it's possible

random cipher
#

like in particular, the UI selectable buttons. is it possible to select more than 1 thing without deselecting another?

rapid shard
#

In Scroll Rect, how do you make it not interactable to mouse drag? I can drag the content around if i hold left mouse.

edgy plaza
tame shell
random cipher
drifting gull
#

Hey there 👋 I'm trying to use TMPro to make a UI element.
I've made it so that the text follows the main character(by making the character parent and text chil (It's a counter above it)), it worked perfectly without any issues but now that I've added a background the text is invisible, I can't change the sorting layer of the text and I just don't know what to do.

azure flame
drifting gull
#

like this ?

azure flame
#

Make sure the background is using the same rendering layer. Order of layers overrides positioning

#

(or just put it on the lower render order layer)

drifting gull
#

My background is set to background so there's not problem with that normally ?

#

Even with the canvas on foreground, the background on background the number is still not showing up

azure flame
drifting gull
#

I don't understand ?

azure flame
#

Select background and examine its renderer

#

and compare its render layer with UI text

drifting gull
#

Ok so, I don't know if it's because I'm a beginner or if my english is poor but I don't really understand what you wan't me to do...

#

I'm really lost I just don't understand why I can't change the layer of the text

azure flame
#

Text sorting layer is on the canvas

drifting gull
azure flame
#

If you just want to have text on top of everything make sure your "ForeGround" layer is actually higher in order

drifting gull
#

My main character is on the foreground but not the text

#

I mean

#

My Character is set to ForeGround and IS visible, but the Canva's is also set to ForeGround but not visible

azure flame
#

Anything on the bottom renders last.

#

on top of everything

#

Make a background layer and put it on top

#

don't forget to assign

drifting gull
#

My foreground is last and it is on the character and i see it

#

And the canva is also on foreground

azure flame
#

Right. Did you make sure you can see the text at all, without anything?

drifting gull
#

When i don't have the background i can see it

tame shell
#

Sprites and meshes often have these "sorting issues"

azure flame
#

If text doesn't fit the box it can go to another line etc

tame shell
#

You may need to move the text forward on z some amount untill it magically draws in front.
You can try also setting the sorting layer on the tmp mesh renderer (if using tmp text non ugui)

drifting gull
#

I already moved it

#

still not visible

tame shell
#

id recommend against a canvas + ugui tmp text

#

this only applies if NOT using the ugui tmp text

#

there is a general 3d mesh version too

#

I know from experience mixing sprite renderers and mesh renderers is annoying

#

An alternative is to use an overlay canvas and just make the elements follow the character world pos

#

(using code to convert some world pos to screen pos)

drifting gull
#

Do you have a tuto or smt for this I am completely loss, + I just got another issue that i can't see my colliders on my tileset it's driving me nuts

tame shell
#

You can search for one if needed.
Its a normal solution to have UI elements follow some position in 3d space

tame shell
drifting gull
#

Can I ask something else here btw since I wan't to throw a punch into my screen.
I have this tilemap for collisions for my ground i all of a sudden it decided not to show, now i don't know where are my collisions

azure flame
#

Also, when something doesn't work like it supposed to you do a sanity check. Create a clean scene and drop default components, see how they are sorted. Which by default should work just fine. Then you compare with your setup to see what's misconfigured.

drifting gull
#

I have everything falling apart I don't what to do or what i did wrong but nothing is working as it should, my collisions don't show up in scene, the text is not showing up and i going through ground where i know i have collisions

mortal robin
#

this button shows gizmos

drifting gull
#

I just need to understand one thing...
Why wouldn't my text be visible when in all possible way in front of everything else

drifting gull
#

I managed to fix it by puting everything on the same Default Layer and just moving on the z axis, thanks to everyone that helped me.

tame shell
#

thats why the sorting layers + order exists to help

hasty agate
#

anyone know why this autosizing, single line, text mesh pro ui text just scrunches up like this? done just about everything to get it to not,

#

text comes from random generation from a few text assets, and in code ive parsed out all spaces and escape characters, and also turned it off in the tmp extra settings

#

noting this text scrunched towards the middle

calm root
#

Im VERY new to any coding so its probably something easy to figure out but why doesnt that 0 go onto my game screen?

ionic beacon
#

Select the text, not the canvas

calm root
#

mb

ionic beacon
#

I wonder if the tool sidebar changes the screen aspect ratio

#

Try to change the anchoring to top left (the red crosshair looking button in the inspector)

azure flame
# calm root

Why do you have Z position set on UI? It could be removed by distance. Happens at -1000 anyway. Also should not be using Legacy component, use TextMeshPro (TMP) text

calm root
ionic beacon
#

Can you show a screenshot of the game view?

azure flame
#

Do you have Game view zoomed in by any chance? It would cut off your 0 in the corner

#

Scale slider on top, make sure it's all the way to the left