#📲┃ui-ux

1 messages · Page 37 of 1

edgy plaza
#

If you game is about to cube u can use pixelated font and image for buttons it will suit more

#

Just an example

sonic citrus
#

ok tysm

tulip topaz
#

i want to make a bitmap font for use with tmp and i have a .fnt file (text based) and the atlas png. i also have an XML version if that's better. How do I create the font? I'm stuck and trying to right click on the .fnt file to create a tmp bitmap font asset but nothing happens

wise temple
#

hey chat, how can i make this better

storm mica
#

why is the text black?

mortal robin
#

Note you're not using the UI version

storm mica
mortal robin
#

The 3d text uses a lit material by default afaik

low pike
#

Why would you post this in a channel that's not related to 3d ?

Besides, this server doesn't allow job posts. see below

#

!collab

marble pawnBOT
# low pike !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

mossy spruce
#

when i make the scale of Goals (circles) 1 then it looks like at photo 1 like i want. and when i want to make scale 0.1 of circles, i have to make the cell size of gridlayout X from 3 to 30 but now Arranged vertically (downwards) what i dont want and when i add another circle which the size is bigger then there is a problem because it looks like shit can someone help me?

steep warren
#

you usually don't (shouldn't?) scale ui components iirc?

mossy spruce
#

wdym irrc?

mossy spruce
steep warren
steep warren
# mossy spruce what should i do then?

you would adjust the height/width
you might need intermediate objects to work with the grid
im not super versed in UI stuff so i couldn't tell you what exactly you'd need to do, sorry

tough sand
#

Hey erm i am extremely new to Unity UI and I have a question

#

so I have this Panel in a canvas

#

my panel has a FFFFFF set as its colour

#

Transparency is 0 as well

#

and yet it looks gray

#

I changed Rendermode to Overlay as well

valid rivet
#

iirc the default image it uses isn't pure white

tough sand
#

Oh that erm sucks

#

So I just create a new image thats pure white?

valid rivet
#

you can change what the image is tho, the bits in the create menu aren't set in stone components - they're just templates

valid rivet
tough sand
#

Oh i just changed my sprite to none

#

that fixed it

#

Thanks for the help!

#

This was erm interesting

valid rivet
#

i recommend you make prefabs for it so you can change it project-wide, it'll save you a headache later on

thin creek
#

Hey, i tried to do something with layout groups, and content size fitter), I want the three white square to be in the middle of the purple square. However with a vertical layout group on the purple rectangle, and i increase the padding of it, it increases the size of the purple rectangle, i don't know how to fix that

tough sand
#

ok so like I just generated a font using the Font asset manager thing and when i scroll out the text has this werid gray ackground thing which disappears when i come closer

#

Ah nvm fixed it had to change the shader

#

ok how do I fix this though

#

cannnot find the alias related features

mortal robin
tough sand
#

TextMesh Pro

steady kraken
#

I have 3 Images for my pumpkin's mouth, eyes and nose. I also have an image for the inside of the pumpkin that I want the mouth eyes and nose to show. I know outside of UI you can do it but I'm not entirely sure about how possible it is in UI.

steep warren
#

you would use masks

steady kraken
#

yeah but I don't want to see if there's an alternative from having 3 different pumpkin insides or setting up sprites for each different variation of pumpkin

honest saffron
steady kraken
#

I only need one inside I want to remove them. But I ended up making a custom reverse mask by combining the 3 textures and removing it from the base image and allowing the inside to show

mortal robin
twilit heath
#

how do i make a font out of a sprite sheet? I've tried every tutorial I can find, and caligraphr is not an option as i need around 115 characters.

im on unity 6

twilit heath
#

dont understand what im doing wrong here

also I absolutely need to use png because its a handwritten font, and I want to keep that texture, it wouldnt rasterise well + would take too much time to manually trace.

twilit heath
clear pulsar
tame shell
golden sonnet
#

Why is making Blur UI this difficult. There should be an inbuilt feature to make it blur just like apple ui. It should be ameture friendly atleast...!

tame shell
# golden sonnet Why is making Blur UI this difficult. There should be an inbuilt feature to make...

UITK has no such option provided and still doesn't support custom shaders yet (to my knowledge).
There was an old unity example project that had a UGUI blur shader. However there is this third party package that you can use instead
https://github.com/lukakldiashvili/Unified-Universal-Blur

GitHub

UI blur (translucent) effect for Unity. Contribute to lukakldiashvili/Unified-Universal-Blur development by creating an account on GitHub.

golden sonnet
#

Thanks buddy. I have used some paid and some open source packages for blur ui. But Having an inbuilt features is more convenient for newbies than configuring an external package. Hoping that official unity team could add this in URP. Just a toggle to enable blur ui.

inland gyro
#

I'm using an image as a cursor for a project and am manually setting the position of the rect-transform to the position of the mouse minus a hotspot/offset Vector2, however depending on the scale of the play-window (in editor), the image is set to a different position for some reason.
I'm using Unity 6000.2.7f2. My canvas scaler is set to Scale With Screen Size at 0.5 Match. The image has a pivot of (0, 1) (top left corner), and the anchor doesn't seem to change anything.
My code:

CursorImage.rectTransform.position = mousePosition - cursorOffset;

The attached image is an example with the top being the smallest play-window and bottom the biggest, the blue box is the cursor's actual position (in this case the cursor is suppose to be in the centre of the image).
Anyone have any clue what's going on here or how I can remedy this?

mortal robin
#

generally you shouldn't be touching it for UI stuff

#

directly getting at screen space coordinates can be tricky

#

You want something like:

public static void SetRectTransformAtScreenPoint(
    RectTransform rect, 
    Vector2 screenPosition,
    Camera canvasCamera = null // null for Screen Space - Overlay
) {
    RectTransformUtility.ScreenPointToLocalPointInRectangle(
        rect.parent as RectTransform,   // convert into the PARENT rect space
        screenPosition,
        canvasCamera,
        out Vector2 localPoint
    );

    rect.anchoredPosition = localPoint;
}
inland gyro
high walrus
#

lets say i have an UI here, where the part circled can be zoomed in on phone

#

how can i do that?

#

to be more exact, i want to do something like this

#
  1. only the blue zone can be zoomed, other part cannot
  2. grid will not show anything when far apart
  3. each grid will show detail if zoomed enough
thin creek
#

Hey, i have a lot of slots in my UI, and i have multiple slots, which have a script that implements IPointerClickHandler.
The method is the following :

    public void OnPointerClick(PointerEventData eventData)
    {
        Debug.Log("test");
        if (currentItem == null)
            return;

        Debug.Log("we have this item " + currentItem.itemNameLocalization);
    }

If i click on a random slot, it says "test" and the item in it, but if i click again, or i click on an another slot, the methods is not called.. Does anyone have an idea ?

mortal robin
#

you may also want to print something when currentItem is null

thin creek
#

I don 't have collapse, but the "test" print must be printed in any case, right ?

mortal robin
#

Yes - assuming you have set up the scene properly. I asked about collapse because it could make it seem like it's not being printed

#

Check your event system - you may have some object(s) blocking things

thin creek
mortal robin
#

you can also do a manual RaycastAll with the EventSystem in your code for debugging purposes if it comes to it

#

and no not the sleected object

#

the object your mouse is over when you click/release

thin creek
#

It's probably because my left click is binded to another action which is not disabled when the canvas is opened ?

#

And also, i don't know how can i see in the inspector, my event system is only showing the first selected, and some values, but not the one I expect

thin creek
thin creek
#

Ok i found... The selection sprite (the 4 yellow arcs) had raycast target set to true, my bad

tacit jasper
#

I don't understand, how does the image for the fill in slider works? I already cut it into 9 pieces so that it won't stretch out

steep warren
tacit jasper
past skiff
#

Hi is there anyway i can move a small section of the maps with all the layers at one go?

#

As in i want to move a specific section but the move tiles only does it layer by layer

mortal robin
past skiff
#

I think so? Isn't this a UI thing

low pike
finite plover
#

Hey all, does anyone know if there's a way to prevent canvases from sitting over each other when they get created, in the scene view only, or is hiding the above canvas the only real option? Behaviour wise I'm thinking like Photoshop Artboards.

mortal robin
past skiff
low pike
tame shell
finite plover
tame shell
#

do you need multiple canvases? do they all need to be in the scene from the start? anyway you can hide the others with the scene visibility controls or do like I suggested

sharp dirge
#

is there a way to put a game object over ui objects?

mortal robin
sharp dirge
# mortal robin Use a screen space camera canvas and set the plane distance farther away than th...

thank you for the advice,
for future people reading i guess.. i ended up getting help from a teammate and changed my game object to a 2d image and used a script for having it follow the mouse

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ImageFollowCursor : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
       // Cursor.visible = false;
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = Input.mousePosition;
    }
}
plush vine
#

Hi guys, I don't know if it's here that I should write.

It's been a long time that I don't create on Unity. I use Unity 6 (6000.2.6f2), for a mobile game.

I heard about UI toolkit, but sometimes I like it, sometimes it's pain of ass...
For example I tried to create a Pannel with a list view of players. Take me few times to understand it, it works.
Items generated by Unity are grayed out. So, I thought like website I needed to search or create class or ID to change them.
I found the class .unity-scroller and in my UXML, I want to disabled it. So in my custom USS I added this class, and change the value of display. I launch the game to test it, wrong, I still see it.

Edit : i'm dumb, I forgot to save my USS, and I change the display & visibility, it's work now. But I still ask the question, because it's interesting to see how you works

So I'm here to talk about the UI today, should I use the UI Toolkit because it will be the future, or should I use the "old system" and maybe need to recreate all of my game in the future (because it will be mostly a UI based game).

Thanks in advance ❤️

ionic beacon
#

If you want to use UGUI then just use it. Nobody's going to come and take it away in the middle of you working on the game.

plush vine
low pike
plush vine
alpine goblet
mortal robin
#

you've presumably placed that ui element at a specific position without using layout options. Changing the reference resolution changes where that specific hardcoded position lies on the screen

azure tinsel
#

Hello i have a question why when i use 2d sprite image in my canva and i click play the image do not appear ?

low pike
#

Sprite renderer is for the game, not UI.

#

You need to delete that game object and create an image. Right mouse click -> create -> UI -> image

#

then assign your sprite to the sprite field on the image component

azure tinsel
#

ahh ok thank you man

low pike
#

UI isnt really well suited for gameplay though. You should probably keep the gameboard as a sprite renderer and just position it correctly

azure tinsel
#

how to positiion it correctly ?

low pike
#

put it in front of the camera

azure tinsel
#

ok thank you

winged hare
#

Is there a limit to how many canvases you can have on screen before it impacts performance? I ask because of the whole "Everytime a UI Element updates the whole canvas updates"?

steep warren
#

the more work being done, the more time it takes. every canvas being dirtied technically impacts perf

#

the limit is whatever the hardware is

winged hare
#

The idea was to have all of the frequently updating canvas bits on 1 canvas, and the stuff that doesn't update often can be on another.

So in a Diablo like game the healthbars / Mana bar / floating damage numbers are on 1 canvas along with cool down indicators, but other elements of the HUD are on another.

I would use UI Toolkit but trying to reason with a sane way to do an inventory is hurting my head right now.

steep warren
#

keep in mind there's also stuff like batching draw calls and such...

#

i'm not super familiar with this stuff tbh, so i can only really give vague guidance

hollow sleet
#

balancing batching and canvas dirtying is a very situational dependent problem to solve afaik

steep warren
#

but imo, as with all things perf - just make something that works and makes sense and worry about perf when it becomes an issue

low pike
#

The idea was to have all of the frequently updating canvas bits on 1 canvas, and the stuff that doesn't update often can be on another.

This is the recommended solution

hollow sleet
opal yacht
#

I'm having a really weird issue with buttons. I have a button of type animation, and when I click on it and move my mouse away, it does not switch to the Normal state properly.

minor ocean
#

Did you see what is happening in the animator when this happens? Maybe your triggers aren't set up quite right.

opal yacht
#

Idk what the issue is. But when i click elsewhere, it returns to normal.

minor ocean
#

Open a tab with the Animator for the button next to the game view and watch what is happening to triggers and transitions to help see what is wrong.

low pike
opal yacht
#

Ive no idea how to use animator...

low pike
#

it's not the animator, I beelieve

opal yacht
low pike
#

Dunno, something for you to google

minor ocean
#

One way to cheese that is to change the "Selected Trigger" to the same as your "Normal Trigger" in the button transition settings. Most likely you would be changing "Highlighted" to "Normal".

opal yacht
#

Well, I have an animation for the button when you click it

minor ocean
#

That should fire with the "Pressed Trigger" still. It's the Selected state that seems to be giving you issues.

opal yacht
#

Also, why is it if I hover my mouse over or off it, it plays the selected animation at lightspeed?

minor ocean
#

These are all things to be controlled in the Animator. If you want it to look as good as possible, you'll have to take some time to familiarize yourself with how it works and make adjustments. The generated controller for the buttons with the default words is a good setup to poke around in and see what is happening.

opal yacht
#

I have every state connected to any state, would that do unusual things?

minor ocean
#

There are a lot of factors. That on its own isn't a problem.

opal yacht
#

Im not able to be on my computer until tomorrow. Anyone using buttons, do you have the same issue with the animations?

#

If so, do you know a fix?

#

Wait its not just for animation
Its with color changes too

opal yacht
#

Saw somewhere that i need to disable "Send Navigation Events" on the event system gameobject, or whatever its called. Will that really work?

opal yacht
#

ok. It didn't really work
had to make a script on the EventSystem

alpine goblet
#

i want to change this label to something like

#

this

#

i can't set it to have curved corners

valid rivet
#

weren't you using ui toolkit?

alpine goblet
#

umm dunno what you mean by that but i am editting it from inspector

valid rivet
crisp tendon
#

Hey everyone! I’m building a mobile game in landscape mode, and I’ve been thinking a lot about the best Canvas settings for different device layouts.

I’ve seen many people on forums recommend using Canvas Scaler → Scale With Screen Size (1920x1080, Match = 0.5) as the “best” setup. But does it really have to be that way?

My current settings are 1920x1080 with a 0.5 match, and everything looks fine when I preview different iOS layouts in the Game view. However, when I switch to tablet layouts, I start to see some serious overlapping issues.

So my question is: what’s the best approach to make a single build work well on both phones and tablets? Should I focus more on fine-tuning individual UI components (anchors, layout groups, etc.), or is it better to handle these differences via code (e.g., layout adjustments at runtime)?

alpine goblet
#

i want to use a starry background for my 2d spaceship game. any ideas as to how i would be able to make one?

valid rivet
alpine goblet
valid rivet
#

then any other photo editor/drawing app

alpine goblet
#

oh wait...i do have photoshop

alpine goblet
#

a static background might not be that immersive....

valid rivet
#

then draw a single star and instantiate and move a bunch of them in unity

alpine goblet
valid rivet
#

i mean do you need anything to collide with them?

alpine goblet
#

nah

#

yes

#

wait a sec

#

i don't want the stars to somehow move out of the background

#

but if they were to bounce off of the boundary, that would look weird too...is there a way to somehow loop the animation so that if a star does touch the boundary, it gets destroyed and another star pops up somewhere in the background?

valid rivet
alpine goblet
valid rivet
#

just instantiate a new one

#

and destroy the old one

alpine goblet
#

O_O

#

lemme try that then i guess...i will ask for help again though...rn trying to load up photoshop

valid rivet
#

yeah but might wanna do it in a different channel next time

alpine goblet
#

this isn't for particles?

valid rivet
#

well you aren't really doing particles right now are you?

alpine goblet
#

oh no

valid rivet
alpine goblet
#

damn i was there a few moments ago

molten hill
#

@alpine goblet if you need UI particle you can use UIParticleSystem.cs from UIExtensions repository it converts particle system into UI particle system

summer pike
#

Pray tell, is this where we ask questions, like how to make an HUD (Heads-Up Display)?

minor ocean
#

I mean, you should have a more specific question than that probably.

summer pike
#

How specific exactly? Just making sure.

steep warren
#

general questions like that would work better in google

#

if you then encounter an issue, you'd then ask about that (errors? can't find a menu? doesn't work like the tutorial says?)

brittle radish
#

Hi, is there a way to crop an image with in unity? I have tried using the filled image type method but I'm looking for something closer to a traditional cropping.

alpine goblet
#

i checked it out...it converts 3d ui into 2d if i am not wrong?

minor ocean
high walrus
#

im using traditional UI, is there any existing new components or classes that can force a Button double click only?

#

or i need to make one myself

minor ocean
#

Think you'll have to make it yourself.

honest saffron
crisp dew
#

idk how to make good menus

you can see the one that i made in this video, anyone got any tips?

https://www.youtube.com/watch?v=_VRNs6C9YaA

I decided to make a horror game that exploits YOUR phobias… and instantly broke the main menu.

Welcome to Phobic EP.1, where I try to make a simple menu and end up fighting Unity itself.

Subscribe before my sanity disappears completely.

-LINKS-
Discord: https://discord.gg/9QDjPsE7bQ/
Website: https://pxsl.dev/
TikTok: https://tiktok.com/@...

▶ Play video
minor ocean
#

Look through sites that have lots of game UI images, like this one (https://www.gameuidatabase.com/) or look at similar games you thought had nice UI setups for a similar theme.

If you're just game jamming or something, using a decent font and free button assets in place of the default Unity ones, that can make it adequate for a jam. Otherwise, it will take some research and iteration.

Game UI Database

The ultimate tool for Game UI and Interface designers. Explore over 1,300 games and 55,000 UI screenshots. Browse and filter by category, animation, colour, material, layout, game genre, and more.

timid pollen
#

Hey I got 1 last issue For some reason my Textmeshpro button doesnt highlight no matter what (I am using a physics raycaster on the camera but even when removed i get the same results) wondering if anyone had the same issue and Im using 2022.3.19f let me know if this is just an "update and youll be fine" issue

steep warren
#

is it supposed to show double?

timid pollen
#

yeah one is the normal ui

#

and the other is worldspace

timid pollen
#

Its just to show that simply changing it is enough to make it not react

steep warren
#

it looks like the screenspace one is reacting fine though?

#

are you trying to get the world one to highlight or what exactly?

timid pollen
#

Yeah but I NEED the world space one to work

#

because I have other buttons in the game that use world space

steep warren
#

is there perhaps something blocking it?

#

what if you disable the screenspace canvas, for example

timid pollen
#

I think disabled everything blocking it but let me see

steep warren
#

did you try disabling the screenspace canvas

#

also check if those errors are relevant

timid pollen
#

Thanks for the help

#

I think I need to move the canvas back

steep warren
#

hmm, it's screenspace, not sure that'd work

timid pollen
#

Now the next issue because I do need the screen overlay AND the worldspace ui

steep warren
#

not sure about that, then

timid pollen
#

Thats fine Ill try to just adjust my game so that it ONLY uses worldspace

misty lagoon
#

Hey, I am using a prefab for my settings. The prefab is a bunch of UI elements on a canvas. Since the menu in our game is supposed to be playable the prefab is used too, but on a world space canvas. In the actual game, it is used on a screen space canvas. This forces me to aggressively scale down the prefab on the world canvas, to 0.0025 actually. I think that's the reason why the TMP is having a hard time rendering and is actually a bit fuzzy. Do you have an idea how I can keep the prefab alive? Or do you think the only solution is to create a second prefab that is smaller and works in scale 1?

jagged monolith
misty lagoon
#

I tried scaling down the canvas instead, still bad quality. Especially when I zoom away the quality really goes bad noticably.

minor ocean
#

I think in the past, I've had to have the parent scaled similar to what you have (~0.002), but then done some wacky inverse scaling on the text to get it to look right. That was probably all with Unity text, though, but seems like it's acting similarly.

low pike
misty lagoon
#

I don't instantiate the settings prefab during runtime.

Right now the world space canvas is scale 1,1,1 and the settings prefab is 0.0025 and looks ugly.
If I scale the world space canvas to 0.0025 and the settings prefab to 1,1,1 it still looks ugly.

low pike
#

leave the worldspace canvas at 0.0025, the prefab at 1,1,1 .. and investigate further

#

what font size are you using on the TMP's?

misty lagoon
#

Nothing out of the ordinary, I think it's around 32 (I checked it's 36). In the screen overlay canvas everything looks fine.

#

Its just that I need to scale it down to work in world space and this is where the problem occurs

jagged monolith
#

I always have the canvas at smaller scale and the contents at 1,1,1 like Carwash says. This is how you should do it, or you'd be using a tiny amount of a huge canvas

minor ocean
#

I agree with all of that, but have had to make an exception for text in the past. Making the font size really large and then scaling the text down as I recall. I kept this funky scaling localized to only the text elements themselves.

I didn't like doing it, but it was the only way I could overcome text blurriness.

low pike
#

In my ~decade of using TMP with worldspace cavnases, I have never had to scale the UI.

worldspace canvas - 0.002 is my goto
everything else - 1,1,1
font - whatever it needs to be
change width/ height where needed

#

TMP doesn't like font size/ scale < 0.0x (i forget the value exactly)

minor ocean
#

Curious to see what @misty lagoon figures out as a solution.

low pike
#

This is a super simple example. The prefab just has an empty parent, 2 children - 1 with an image, 1 with TMP. Scale on everything in the prefab is 1,1,1

tacit jasper
#

Isn't supposed to be like.. filling up the bar instead of moving thebar itself?

steep warren
#

hm actually, i don't remember if it uses that

edgy plaza
tulip topaz
#

for some reason, these particular buttons from my ui shrink to what I assume to be their original size when I load a build of my game. I do not know why they are shrinking as I have set the canvas to scale with screen size. the other buttons are not shrinking, as you can see with the 3 large ones above. If it helps, the 3 small ones are inside of a horizontal layout group because i need them to be that way.

mortal robin
#

Show details of your UI layout if you want a better idea

tulip topaz
mortal robin
tulip topaz
mortal robin
#

What you should do is drag your prefab into the scene under Dice and resize the game window a bit

#

See how it behavres

#

you can debug this easily in the editor that way

tulip topaz
#

i don't know why but it behaves like it should

#

i mean the buttons don't turn small

#

they are small only when i build the game

mortal robin
#

(assuming you are on Free Aspect mode)

#

if you're ona fixed resolution you'll need to either switch to free aspect or switch resolutions to test

tulip topaz
#

and did resize a lot

peak ridge
#

Hello, i can't find any mentions if it's possible to set all new canvases to scale with screen size automatically since i keep forgeting to do so and then all my ui shrink. Does it possible? And also is it possible to scale my old ui back to normal size with new scaling?

valid rivet
#

or if you don't wanna make a custom menu item, you can make the canvas a prefab and add that instead

peak ridge
#

Thank you, will try it later

mortal robin
peak ridge
#

Will see, thank you

peak ridge
#

Managed to make new canvases to scale with screen size thru Preset Manager, thank you again. As of restoring ui size, its either not working or i am missing something as "Reference Pixels per" set to 100 as it was on Canvas with default scaling but its not changing scale in any way

valid rivet
#

in the rect transform

#

or just set it to something close enough

low pike
#

The canvas scalar component needs changing to 'scale with screensize' and then the slider setting to the weight for which axis to scale with (width/ height)

warm moth
#

Hey! I have a quite advanced topic and It involved the URP pipeline and UIs:

My UI is very blury and I need the UI to render at a different internal res then the game.
The issue I have is that , I can't edit the URP settings because I always want to internal res to be lower than the res set by the user .
SO I need a way to make the UI overlay camera that is in screen space - camera render at a 1 or 2 render scale and the main camera at 0.5 or half
the core issue I also have is that I do not want to use a render texture if I can avoid it

proud sandal
warm moth
proud sandal
#

you can also use "camera" mode for UI and render game/ui to separate cameras at arbitrary resolutions and compose them as you like

proud sandal
#

your UI would have to be "on top" only

warm moth
proud sandal
warm moth
#

alright

#

This has been quite a consistant reccomendation

proud sandal
#

otherwise you render to the backbuffer and that will always have one specific resolution

warm moth
#

Guess there is no easier or better way around it

proud sandal
#

easiest way is to do the low-res as a post effect

#

if your graphics aren't fill rate sensitive, that would make minimal performance difference

warm moth
proud sandal
#

meaning if you aim for PSX/PS2 era graphics and effects, your raw resolution is irrelevant

proud sandal
#

to make an actual PSX pipeline is a fun project, but low value

#

you kinda need the actual PSX pipeline to add the various vertex jitter glitches, but do you really want/need those?

#

you can probably approximate those in post too

warm moth
proud sandal
#

got it, then do post

warm moth
#

but Ya, I get you. REs is not that big of an issue. It's just trying to keep the UI clean and readable while keeping the psx res look

proud sandal
#

unless you want raytracing/GI, then fill rate will be bad

warm moth
#

so I will have a look

proud sandal
#

so you want to make a low-res HDRP project?

warm moth
#

The game is already super low as I am texture packing a lot and only using albedos with near no Polys for pretty much all the geo in the game

proud sandal
warm moth
proud sandal
#

imo, try the render texture approach, see where it fails and if its actually too complicated to get it to work

#

you can always drop the render texture approach later

warm moth
proud sandal
#

fwiw, multiple cameras eliminate many performance optimizations in the SRPs

#

you can stack cameras in URP such that they can reuse passes of previous cameras, but its a bit tedious to get right.

warm moth
#

I am trying to get this look

proud sandal
#

and usually the multi-cam setups exist precisely because the previous passes don't yield the needed data

proud sandal
#

you can't get that look, way too much goes into that

#

or do you mean just the 3D UI?

warm moth
proud sandal
#

the UI is a standard camera UI with a distortion post effect

warm moth
#

Post?

#

no way

proud sandal
#

its rendered to a separate camera that uses a different post processing stack from the game world

proud sandal
# warm moth Post?

post for the subtle curvature, the perspective is actual 3D, you could make a custom camera that does the curve projection

warm moth
#

Any links I could look at ?

proud sandal
#

no links, its just what i would do if you gave me that as a spec.

warm moth
warm moth
#

I just switches the order of opperation . Instaed of setting the entire render stack to half the res. I keep the render stack at full res but use a render feature to half the resolution on the camera I want.

#

silly fix .

#

This fix works not as a post process but as a render pass by just halfing the res or I could set a fixed resolution

peak mirage
#

I am trying to have the ObjectiveText, and EnemyCountVisual, stack on top of eachother by applying a Vertical LayoutGroup on the ObjectivePanel. I am using a Vertical LayoutGroup because the content under Objective Panel might change during run time, and I want all the child objects to fit. However, the content doesn't seem to be stacking correctly.

warm moth
harsh basin
#

Hey! I'm having an issue with TextMeshPro. For some strange reason, the letters have turned into these black squares. I've checked and the Font Atlas is correctly applied. What could be causing this issue?

low pike
harsh basin
#

whaddya know it was the essentials

#

thanks!

wicked mural
#

Hey everyone! Not sure if this is the right place to ask, but I’ll give it a shot.

I’ve been using Screen Space - Camera for my UI for a while, but I recently switched to Screen Space - Overlay. That change ended up breaking some of my mouse position logic.

From what I understand, I should now be using Input.mousePosition, which seems to work, but I’m not entirely sure if that’s the correct approach.

I also have an icon that follows the cursor with a set offset, but the offset now seems to be in pixels, so it changes depending on the screen resolution.

If anyone has some advice or resources on how to handle this properly, I’d really appreciate it!

mortal robin
#

What are you trying to accomplish

wicked mural
# mortal robin What are you doing _with_ the mouse position?

I have a tooltip that appears when I hover over an item in my inventory, and I need it to follow my cursor, with a bit of an offset.

Same when I pickup an item - the icon of that item should be next to my cursor.

Not sure if it changes anything, but I am using a canvas scaler on my canvas as well.

This is how that method looks right now (and works with screen space camera)

https://pastecode.io/s/9j2zx1jk

#

I am a bit rusty by the way, haven't worked on this project in a bit (or in Unity in general) and I'm trying to rediscover it.

rugged coral
#

Has anyone ever heard of or figured out a way to pass-through events on Unity UI?

I need to have a Graphic overlaying the whole screen and detect events, while letting those events still pass-through when detected to regular UnityEngine.UI.Buttons beneath it. My setup is essentially a transparent raycast target Image + my own IPointerDownHandler Component, and that would need to still allow other elements behind it still receive those PointerDownEvents.

Been like hitting my head on a wall:

  • EventData.Use() implies that not calling it would leave the event still bubbling through, but there's no difference whether I call it or not in my case; I understand that GraphicRaycaster hits the Image and the event is only sent to its GameObject and nothing else.
  • Removing the Image Component or setting raycastTarget=false obviously makes GraphicRaycaster ignore my event catcher IPointerDownHandler Component
  • GraphicRaycaster.BlockingMask doesn't seem to work: I set my IPointerDownHandler GameObject on a "UI-Passthrough" layer, then made sure to disable that layer on the GraphicRaycaster.BlockingMask, but nothing changed. The raycastTarget Image is still hit and blocks all clicks, making any Buttons or other UGUI elements behind it unable to receive input

I would just use InputSystem to detect the Mouse/Touch pointer down action events, but I need to know whether the regular UGUI is blocking the view at time of clicking... hmm. Maybe I could workaround to somehow poll the EventSystem on whether there's a UI element currently overlapped by the GraphicRaycaster... But it would still be great to hear anyone who knows or is on the UI team to answer the issue specifically with UGUI tools (in discussion/forum groups all over there were many people asking similar questions, none truly answered, all worked around their problems and UGUI).

mortal robin
rugged coral
#

Compacting my use case: Rotateable 3D globe with interactable header and footer UI and some buttons in the center. It feels bad that interacting with the UIs (which have ScrollRects and naturally invite drag motions) simultaneously rotates the 3D globe "behind" the UIs.

The solution I was seeking for was to have an UI element that detects the UI system's events for PointerDown/PointerUp, so I could then sort this detector UI element in front of or behind whichever other UIs based on whether I want those to prevent the globe rotation or not, then check my detector for whether I allow the globe to rotate.

#

I'll probably have to workaround by polling EventSystem.IsPointerOverGameObject(), but that won't allow me to pick and choose what UI elements count as blocking the drag-rotate and which don't (some UI buttons overlay the globe and having the drag input over them actually cause the rotation does not feel bad unlike interactions in the header/footer which visually obscure the globe and have their own ScrollRect drag elements).

#

Minimal hierarchy example of my use case:

  • 3DGlobe
  • Canvas
    • SmallCenterScreenButtonWhichCanAffectGlobeRotation
    • Detector
    • Header
      • ScrollRectThatShouldNotAffectGlobeRotation
    • Footer

Only presses that can reach the Detector should be allowed to start a dragging input for 3DGlobe. Presses that are blocked and used by Footer or Header don't reach Detector and globe won't rotate. Pressing at SmallCenterScreenButtonWhichCanAffectGlobeRotation and dragging is allowed to also drag the globe as its visually set to be clearly part of the same thing and it's obvious to user they're simultaneously dragging both the button and the globe.

rugged coral
# mortal robin there's no builtin way to propagate the event down to lower or "blocked" element...

Well, at least I got the compromise-workaround using EventSystem.IsPointerOverGameObject() to work.

Explanation below, sorry for bad big-server etiquette not replying/pinging clearly before - will be more careful next time.
What do you mean by firing off a manual, second raycast? Like somehow do that via GraphicRaycaster? How would you propose the second graphics raycast goes past my Detector GameObject/Graphic on this second raycast (especially when GraphicsRaycast.BlockingMask seems to do nothing)?

mortal robin
#

All of those raycasts give you a list of all the hit objects

#

you can sort/ignore them any way you choose

rugged coral
silk obsidian
#

Hello

#

I want to render a VFX effect on top of UI element

#

I did kind of solve it by creating another camera to only render the VFX
save output to a render texture
use raw image with that texture

#

But now the issue the the scaling and make it anchored like UI elements

#

and honestly all of this feels like fighting the engine

I've also ran into inconvenience of animating sprites (on the Image component and such)

Should I convert to using sprite and normal 2D objects instead?

honest saffron
mortal robin
outer edge
#

Hello, does anyone know why my UI moves off-screen after I change the resolution? I'm trying to make the UI responsive for all devices. I have already set the canvas scaler to fit the screen size.

low pike
low pike
timid needle
#

I have an issue, where my text is going to that one standard unity font texture. but like the whole alphabets i dont know how to explain.

honest saffron
molten hill
# silk obsidian Hello

In uiextensions there is UI particle script that converting particles effect into UI space

timid needle
molten hill
#

You need to create billboard script that will rotate your world space text to face your camera always

timid needle
#

i dont want the text to look at me

timid needle
#

but thats for trying to help me

molten hill
#

If you just need word space text it should work fine

molten hill
#

It should be visible from good angels

timid needle
potent swan
#

get a fresh TMP package

low pike
outer edge
# low pike that is not UI, that is a sprite renderer

Hello, I have updated the map to use a UI with a screen space camera since my player was behind the UI elements. However, I have encountered a new problem and would appreciate some suggestions.

When I activate a panel, my player does not move behind that panel. I created my player using a 2D object sprite in the shape of a circle. How can I resolve this issue?

#

also I'm having an issue with my base map. when I change the resolution to a different size, the tiles become slightly misaligned as the player moves.

I'm setting all the tiles with a transform reference. How can I fix this? Do you have any suggestions?

mortal robin
outer edge
mortal robin
#

And you'd need to show the settings on the canvas too

mortal robin
# outer edge

A sprite renderer on its own will not interact with the UI event system in any way

#

It's not a UI element

#

More likely it's whatever your "canvas panel" object is

stoic zenith
#

button is not working for some reason (fresh scene with default settings)

mortal robin
#

Also the Canvas object

stoic zenith
mortal robin
stoic zenith
#

the new one

mortal robin
#

In your game view can you disable this "low resolution aspect ratios" thing

#

your game view is currently zoomed in 2X

#

not sure if that's affecting things

stoic zenith
mortal robin
#

From what you showed I'm not seeing what the problem is. I will say that it definitely looks like it's not an issue with the code or the button, your mouse input is just not interacting with the event system at all

#

the normal checklist is:

  • Make sure nothing is blocking the button
  • Make sure raycast target is enabled for the image
  • Make sure there's an event system in the scene with an appropriate input module
  • Make sure there's a GrahicRaycaster on the Canvas
stoic zenith
mortal robin
#

you seem to have all those as far s I can tell 🤔

stoic zenith
#

Do you think this is an issue with unity?

wild juniper
#

hey, I have some small issue. I have object with grit layout group. Cell size are 75x75. That object is inactive on scene. I instantiate new elements as children of that grid. When I get the size of their rect it returns 100x100. But when I SetActive(true) that grid, then they update to 75x75

#

can I somehow update that when grid is inactive?

mortal robin
wild juniper
#

cuz I'm initializing inventory procedurally. I don't want to show it to user

#

inventory shouldnt be open by default

mortal robin
#

but let's get back to the root of the issue here - why do you need the size to change before activating the UI?

#

In fact why do you need to even add elements to the UI when it's not visible?

wild juniper
mortal robin
#

not the inventory itself

#

The actual inventory itself should be separate from the UI that displays it

wild juniper
#

oh true true

#

yeah, I'm not using my brain currently

#

thanks for pointing that out

#

I like to overcomplicate stuff

wild juniper
#

but still, just for my curiosity

#

how can I force the correct sizing?

mortal robin
wild juniper
#

performance wise

mortal robin
#

It most likely would have little to no performance impact on your game

shadow delta
#

Hi guys.
I'm having an issue, not sure where it is.
But, I'm creating a card game, but the card visual (inside a Canvas) is getting jagged edges/pixelated.
I already tried to change the configurations on the Image Import Settings, and on the Canvas, but none made they clean or correct.
Maybe I'm forgetting something to change, or I made some changes incorrectly, not sure.

If anyone could help me figure it out, I would be glad.

Example here, but the print is a little worse than in live.

molten hill
#

@shadow delta Maybe try to use preserve aspect of image but I'm not sure if it helps

red nova
#

need help in attribuutions.

I have this 3d model i got in sketchfab and i also got the credits, my question is do i still need to mention that i changed some part of the model or not in the credits?

ionic beacon
#

Depends on the model's license. But it would be very unusual if it required to specifically mention modifications

#

also wrong channel

red nova
ionic beacon
#

None of the CC licenses require mentioning modifications. Either you're allowed to modify or not

red nova
stark sleet
#

Hello, I am a new unity developer
I want to know , is there any blending mode, package or any script to apply in unity screen space overlay ui?
Like multiply, darken, lighten etc.

frosty pewter
#

Not really sure what this has to do with this channel. It seems like more of a #💻┃code-beginner problem.
You should understand what a NullReferenceException is https://unity.huh.how/runtime-exceptions/nullreferenceexception
and if you are going to post screenshots of code (unadvisable), don't cut off the line numbers, as that's an important part of the error.

trim granite
#

oh sorry i wrote this in the wrong channel

#

excuse me

wild juniper
#
    InventorySlot newSlot = Instantiate(_inventorySlotPrefab, transform).GetComponent<InventorySlot>();
    _slots[x, y] = newSlot;
    _slots[x, y].Init();
   public void Init()
    {
        RectTransform rect = GetComponent<RectTransform>();
        LayoutRebuilder.ForceRebuildLayoutImmediate(rect);
        _slotWidth = (int)rect.sizeDelta.x;
        _slotHeight = (int)rect.sizeDelta.y;
    }
#

for some reason, the sizeDelta is 100x100

#

i tried with rect.rect.width and its also 100x100

#

why?

covert ice
honest saffron
minor ocean
# wild juniper ```cs InventorySlot newSlot = Instantiate(_inventorySlotPrefab, transform).G...

ForceRebuildLayoutImmediate is rebuilding your slot and all of its children, so I assume not rebuilding using the parent's grid layout parameters.

You should just get those parameters after the entire grid is populated and you do one rebuild. Running a rebuild command like that with every "slot" is going to be a big burden when instantiating. You could also just pass the grid parameters to the slot if you need those stashed on the slot for whatever reason instead of doing a rebuild and reading them in.

wild juniper
covert ice
#

im just going to remove the background thing, i dont need it there

honest saffron
covert ice
#

i have 1 player canvas with 2 different screen. When i try to show one, both of them are shown at the same time. Help

#

it makes sense to me why this is, but i just don't knnow how to fix it

mortal robin
#

When i try to show one, both of them are shown at the same time
How are you showing them?

#

showing your code might help

covert ice
#

alright, give me a second.

#

I was looking through my code and realized it was a stupid mistake on my part. Thanks for replying tho

high walrus
#

is there any direct way to turn a traditional UI button (i mean UGUI button , this one) into double click only

#

or i need to make an integer, increments it and reset it to mimick double click

low pike
#

that is not an inbuilt feature

high walrus
#

thats okay, because i just want to see if theres a better and direct implementation to that

#

before i code my solution

low pike
#

I don't know what you mean by "direct"

#

you'll need to have your own timer and counter

high walrus
low pike
high walrus
high walrus
#
private List<int> plotValidClicks = new();

button.onClick.AddListener(() => { CurrentSelectedGrid = slot; });

private BatchPlanSlot CurrentSelectedGrid
{
    get => currentSelectedGrid;
    set
    {
        plotValidClicks.Add(value.SID);
        
        if (plotValidClicks.Count < 2)
        {
            return;
        }

        if (plotValidClicks[0] != plotValidClicks[1])
        {
            plotValidClicks.Clear();
            return;
        }
        
        if (currentSelectedGrid != null)
        {
            previousSelectedGrid = currentSelectedGrid;
        }
        
        currentSelectedGrid = value;
        Plot();
        plotValidClicks.Clear();
    }
}```
#

it does work, for now

#

i have a unique ID for each buttons, so i record them into a list, maybe a int tuple in the future?

#

if list.count = 2, it means double clicked, so i will check and reset

low pike
#

requiring two clicks != double click

#

A double click is 2 clicks in a short space of time.

#

This isn't something I'd be doing in a property either

high walrus
#

i think i will do it on a function instead

silent shale
#

I am trying to make a slider however when my slider value is 0 there is still some of the filled area inside the slider how can I make it nothing 😭

mortal robin
edgy plaza
static ice
#

So how can I take this slider in this component inspector and
• Control its length
• Hide the bar component of the slider

old linden
#

How can I prevent clicks interacting with my world for movement etc through UI Toolkit Visual Element

static ice
#

Is there a reason the width of graphRect displays differently from the EditorGUI.Slider's width despite using the same parameter?

Rect graphRect = EditorGUILayout.GetControlRect(false, 150);

testScript.timeToApex = EditorGUI.Slider(new Rect(graphRect.position.x, graphRect.position.y, graphRect.width, 0), testScript.timeToApex, 0.1f, 4.9f);

if (Event.current.type == EventType.Repaint)
{
    Handles.BeginGUI();

    //Draw container
    Handles.color = Color.white;
    Handles.DrawLine(graphRect.position, graphRect.position + Vector2.right * graphRect.width);
    Handles.DrawLine(graphRect.position, graphRect.position + Vector2.up * graphRect.height);
    Handles.DrawLine(graphRect.position + Vector2.right * graphRect.width, graphRect.position + Vector2.right * graphRect.width + Vector2.up * graphRect.height);
    Handles.DrawLine(graphRect.position + Vector2.up * graphRect.height, graphRect.position + Vector2.right * graphRect.width + Vector2.up * graphRect.height);

    Handles.EndGUI();
}```
silent shale
#

then viola it works

swift egret
#

feel like the ui is a bit bad and wonky. Any ideas on how to fix it?

edgy plaza
finite plover
# swift egret feel like the ui is a bit bad and wonky. Any ideas on how to fix it?

Solid start, you've got the base design requirements in place. To improve it I would recommend exploring what some other UI of this genre are doing and then use that as inspiration for making a subtle improvements!

I created a Youtube video recreating part of the New World UI using Photoshop, it's hard to tell from the game screenshot but that type of style might suit.

https://www.youtube.com/watch?v=OIcQSLqFEXs

☕ If you enjoy my work and want to see more, consider buying me a coffee—every bit helps keep this going!
https://buymeacoffee.com/warrenwinters

Sharpen your blades and let's step in to a New World.

In this speed build we get a preview of a full tutorial where we go through various different tips and techniques to achieve a UI in Photosho...

▶ Play video
prime ore
static ice
low pike
static ice
primal ermine
#

hey any tips to make the TMP look smoother and less pixelated? I tried messing with the Canvas Scaler but no luck there

ionic beacon
#

First change the game view scale back to 1x

primal ermine
#

I know, i just zoomed in for the screenshot, it's really noticeable even when at 1x scale

ionic beacon
#

Don't do that, it makes it look worse than it is. Show the inspectors for the elements (text, canvas, scaler etc)

primal ermine
ionic beacon
#

Does the text look better if you move it out of the image and make it a direct child of the canvas?

low pike
#

Maximise the game view, you'll find the text looks fine when it's not being shrank to fit

primal ermine
primal ermine
#

could this be an anti-aliasing issue? any way I can check that?

low pike
#

make sure the scale of all UI elements in the hierarcy are 1,1,1 (canvas can be whatever its set itself too, you can't change it anyway)

And as a test, just try the default font

primal ermine
#

does look better, maybe the problem were in the font creator settings?

low pike
#

Scales < 0.1 can cause rendering issues with TMP

If the default font looks fine, then try re-making the font asset for the font you're using.. tweak the settings, it could be packed too tight or something

primal ermine
#

All the scales are at 1,1,1 so I'll try messing with the font creator settings, thank you

amber trout
#

How do I generate a drop shadow .mat for my custom font here?

finite plover
silent island
#

This took some time, but i finally manage to decently understand anchors and some UI, this first week of unity has been rough on me haha

minor ocean
#

Awesome! Glad you're getting the hang of it.

silent island
quasi apex
#

What is the easiest way to display dynamic icons for inputs based on your bindings?

dapper elbow
#

Do you need icons or letters?

serene compass
#

im having some isues where idk why but this scroll isnt working

quasi apex
dapper elbow
#

Just give me sec I will open my project, I will have a snippet for you

quasi apex
#

Oh thanks that's neat

serene compass
dapper elbow
#
        private string GetKeyLetter(InputActionReference inputActionReference)
        {
            if (inputActionReference == null) return null;

            var interactionBindings = inputActionReference.action.bindings;
            foreach (var binding in interactionBindings)
            {
                if (binding.isPartOfComposite) continue;

                if (binding.path.Contains("Keyboard"))
                {
                    return binding.path.Replace("<Keyboard>/", "").ToUpper();
                }
            }

            return "";
        }

This returns an exact key value for a binding that is a key e.g. "E", but similar way you will get bindings for e.g. controller but the values won't be single letter, you'll need to debug what you will get.

#

Things you will get for controller will be like "<Gamepad>/leftStick" - so, you will have to create a mapping between the 'value' and the 'sprite' with the icon.

quasi apex
#

Thanks that helps a lot

dapper elbow
#

Give me a couple of minutes, I will try to write something becasue I will actually need it too - I was supposed to make it tomorrow :D

quasi apex
#

I am used to working in other engines where I have my trusty plug-ins doing these things for me ^^'

#

thanks you a lot^^

serene compass
dapper elbow
dapper elbow
# quasi apex thanks you a lot^^

So to get the sprite I would do something like this:

private Sprite GetGamepadButtonSprite(InputActionReference inputActionReference)
        {
            if (inputActionReference == null) return null;
            if (_gamepadButtonMappings == null || _gamepadButtonMappings.Count == 0) return null;

            var interactionBindings = inputActionReference.action.bindings;
            foreach (var binding in interactionBindings)
            {
                if (binding.isPartOfComposite) continue;

                if (binding.path.Contains("Gamepad"))
                {
                    // This one is the thingy I talked about before that checks if mapping is for gamepad. It will be like "<Gamepad>/buttonSouth" -> "buttonSouth"
                    string buttonName = binding.path.Replace("<Gamepad>/", "");

                    foreach (var mapping in _gamepadButtonMappings)
                    {
                        if (mapping.ButtonPath == buttonName)
                        {
                            return mapping.ButtonSprite;
                        }
                    }
                }
            }

            return null;
        }

The mappings would be stored in:

[SerializeField] private List<GamepadButtonMapping> _gamepadButtonMappings;

and the mapping class itself:

    [Serializable]
    public class GamepadButtonMapping
    {
        [field: SerializeField] public string ButtonPath { get; private set; }
        [field: SerializeField] public Sprite ButtonSprite { get; private set; }
    }
serene compass
#

im having some isues where idk why but this scroll isnt working

dapper elbow
serene compass
#

its not scrolling

#

its the same setup as the text

dapper elbow
#

Let me convert the file to mp4 so you will be able to watch it without downloading

serene compass
#

oh ok thx

quasi apex
dapper elbow
#

My pleasure! :) Good timing haha

ripe mirage
#

any idea why this ui panel is stretching when i change from 16:9 to free aspect in the game view?

#

like the aspect ratio is increasing

#

but why would the button stretch

tame shell
sudden pawn
#

Is there a way to get the text from the current TextMeshPro page?
Tried finding it in the documentation and on the forums but had no luck with that so far.

Putting a debug statement with the text value of TextMeshPro only gives me the first two lines, skipping the third one, even if I've changed the page.

low pike
sudden pawn
low pike
#

As you're using rich text, you might need to add the \n so the deebug log knows there's a carriage return

#

oh, but that won't be the case because you get the first two lines

#

ignore me, I clearly didn't get this at all - sorry !

sudden pawn
#

No worries, it's an annoying and confusing issue lol

minor ocean
# sudden pawn No worries, it's an annoying and confusing issue lol

I think the issue is that Debug.Log doesn't support the <page> rich text tag. So you are probably retrieving the string fine, but Debug.Log doesn't know what to do with that tag so it just ends the string there. You could remove and replace the <page> tag with some kind of acceptable symbol for your logging.

sudden pawn
#

As I'm working on a dialogue system, where the writer who doesn't really do unity stuff can write dialogue of arbitrary length, and it then splits the text he writes into pages automatically (or if he writes down a tag)

minor ocean
#

Looks like the TMP_Text.text will return the whole string. So you'll have to parse the text and look for <page> in your code if the writer adds one in. Then split the text string into pages yourself for whatever you've got planned next. So if you want just a particular page, just split the string up into a List<string> (or whatever you choose) and then you have access to each page individually.

sudden pawn
#

That however does not take into account new pages created due to overflow

minor ocean
steep warren
compact canopy
#

Hi, I'm making prefabs for UI elements that use png sequences for the animations. If I select all the files of a png sequence and drag them into the scene, unity will automatically make me a game object with a sprite renderer and an anim controller and an anim clip that animates the png sequence.
But I don't want a sprite component, this is for UI. I want an anim controller on the top object in my prefab, that animates child image components but I can't find a way for unity to automatically populate my anim clip with the png sequence keyframes? Using a clip that Unity generated for the sprite object doesn't work. The sprite component doesn't exist so the label for it in the anim keyframe editor window is yellow.
I swear years ago I could edit the anim clips in notepad to make them find the image sequence but it's all disguised with GUIDs now

compact canopy
#

Ah, don't worry, I asked Gemini and it told me the answer. All I have to do is select the images and drag them directly into the 'image > sprite' property in the keyframe editor.

sudden pawn
#

... unless they did change that in some newer version and forgot to document it as it does not show up

#

nvm I'm stupid, it's an array of pages

low pike
steep warren
#

(unrelated to the original question)

low pike
#

I was thinking maybe the debuglog was missing the carriage return that can be seen in the text box. and adding a \n would allow the log to see it and print it.

It wasn't that because I missed that the log was seeing everything upto <page> which is on the 2nd line already

steep warren
#

im not seeing a carriage return there, are you referring to the newline/line ending

low pike
#

yes, it is across three lines. Enter was pressed after the . and >

steep warren
#

ah ok. thought there was some interaction between newlines and carriage returns in a debug log or something that you were referring to 😅

low pike
#

With my first reply I thought the log was just doing the first line. I know for sure that \n works in a debug log - so adding that to the next would get it into the log.

Isn't needed because that wasn't part of the issue and I'd just failed in reading the problem correctly

shrewd meteor
#

How can i improve my current inventory screen? I'm mostly happy with it but it feels a bit to clean and lifeless. With items of varying rarities in the stockpile, backpack, slots, etc. there will be a bit more color, but what can I do with just the base menu(s)? I dont want to lose the clean, modern aesthetic but I would like it to have some personality if that makes sense.

low pike
#

you've got a massive amount of empty (wasted) space

dark marsh
#

why does my UI disappear when I try putting it in screen space camera?

#

I have the camera assigned, scale and resolution seem correct and I have the culling mask of the camera set to "everything"

low pike
dark marsh
#

everything becomes invisible

low pike
#

That view isn't useful. Take 2d mode off, and make sure the canvas and camera are visible

#

also, do not crop the screen - you might be cutting out useful information that you're not aware of

dark marsh
#

Console only says this

The project currently uses the compatibility mode where the Render Graph API is disabled. Support for this mode will be removed in future Unity versions. Migrate existing ScriptableRenderPasses to the new RenderGraph API. After the migration, disable the compatibility mode in Edit > Projects Settings > Graphics > Render Graph.
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

which is unrelated i believe

#

it just kinda disappears

low pike
#

yeah that warning isn't related

#

where's the camera? -> select both camera and canvas

#

are you 100% sure something is enabled to actually see on the canvas?

low pike
dark marsh
dark marsh
low pike
#

but you can't see the UI in the scene view for either render modes

dark marsh
#

Not sure right now why it couldn't be seen in scene mode for Overlay canvas, but the Ui is done anyway I just need it to appear in screen space camera so I can apply post processing to it

low pike
#

record a video - go through and select each UI gameobject that should be visible so I can see the inspector

dark marsh
#

Alright give me a minute

low pike
#

You've also go the sort order on the canvas set to 100.. doubt it'll make a difference for this issue, but that's rather high for no reason

low pike
dark marsh
dark marsh
#

Okay well I am back

#

and my UI is also invisible on scene view for some reason I cannot fathom

#

(it is still fully functional in the game view though)

#

The objects are there and apparently not hidden as far as I can tell

#

so I have no idea where it went

#

the UI layer is visible and UI and transparent fx are both assigned to URPs transparent layer mask...

minor ocean
dark marsh
#

I cant for the life of me get windows to take a screenshot while the menu is open

#

so skybox, flares, fog, post processing and particle systems

minor ocean
dark marsh
#

Everything in the layers is set to visible

#

hiding UI hides the big rectangle that my screenshot shows

#

but unhiding it doesnt show the actual elements in the canvas

minor ocean
#

Do you have a CanvasGroup in the hierarchy and the alpha set to zero?

dark marsh
#

I am not sure what a CanvasGroup is

minor ocean
#

Oh, well you probably don't have one then. It's a component that you can put at a level in the hierarchy and ime mainly used for fading in and out.

dark marsh
#

yea I looked it up

#

none of my objects have it

minor ocean
#

That still wouldn't explain why scene view isn't showing but game view is.

dark marsh
#

ah

#

I have found it

dark marsh
#

for some reason my UI does not render with compatibility mode active on the render api

#

but only for scene view

minor ocean
#

oh, huh.

#

Glad you got it figured out at least.

low pike
sudden pawn
mortal robin
#

there isn't really much more to it than that AFAIK

sudden pawn
#

As getting textmeshpro’s text component just gives me the full thing

sudden pawn
#

Yes
But pageinfo does not have any text variable

hollow sleet
#

it gives you first and last character index, presumably used to sample the full text

mortal robin
sudden pawn
#

First and last characterindex kinda seem to not work too

#

As when changing pages firstcharacterindex is always 0

mortal robin
#

how are you trying to access it

#

Can you show your code?

#

how are you indexing the pageinfo array

sudden pawn
#

I’m away from my pc rn so can show it a bit later, but basically I get the current page, and try getting its firstcharacterindex

hollow sleet
sudden pawn
#

So in short, there is no way to know what is actually written on a specific page?

mortal robin
#

no...

#

you just have to access the correct PageInfo

sudden pawn
#

Damn, that sucks

mortal robin
#

by "no" i mean, yes there is a way

sudden pawn
#

Ah

#

Then which pageinfo would allow me to access that?
As first and last character indices do not seem to help much

hollow sleet
#

would need to see code but first step would probably be iterating through the pageinfos and logging their results to see if the indicies are wrong or if your sampling the array wrong

mortal robin
#

you may be reading the first page info every time

sudden pawn
#

Ah
Sorry for misunderstanding
Will double check when I get back to the project

mortal robin
#

but can't know without seeing the code

terse mist
#

wat is your dudes simplest way of making pixel fonts look the best

#

ive tried making its rendering mode into hinted raster but sometimes it still gives off a blurry look

#

just wondering if theres a lil more i could do to make it look smoother

sudden pawn
sudden pawn
#

it updates lastcharacterindex, but for some reason the firstcharacterindex is always the same

#

so it leads to this behaviour when the text is being copied to a different text box

#

I know I can just work around this one by subtracting the previous index, but I'm just curious as to why it is not working like it should

sudden pawn
#

without that first character index it looks kinda horrible, but it finally works

sudden pawn
#

oh yea, forgot to say that earlier, but wanted to thank y'all for taking your time to try helping me out

minor ocean
#

The way firstCharacterIndex is working does seem off. Nothing in the docs about it explaining anything, so I don't know why it's that way. Glad you worked around it, though.

sudden pawn
#

Will try reporting that as a bug on the forums, hopefully it'll help the devs

formal carbon
#

how should I go about making it so my cursor goes into an animation state whenever you hover over or exit a valid ui element? ik how to do it for every individual element, but I'm wondering about a global callback on those events (like every time it hits a on enter event, it runs a function, and everytime it hits an on exit event, it does a different one, regardless of the object it enters or exits)

formal carbon
#

how does one use this lol, never touched this in my life and I'm fairly new to more involved ui stuff in unity lol

mortal robin
#

You use the Raycast method (linked)

void scarab
#

Hello everyone 👋 I’m a passionate UI/UX designer who loves creating intuitive, user-focused, and visually appealing digital experiences. Excited to connect!

frigid bough
#

Hey I just added some ui to my scene just a canvas with a few buttons, it worked fine before but suddenly it's gone in game? Like I don't see the ui at all anymore and I don't recall making any changes to it

#

nvm it seems my resolution changed causing it to go outside the screen

low pike
hallow bear
#

You know how to add and swap images in the UI. Apply these skills to make your UI elements look even better. You could have the settings button use a custom image instead of the default one, or you could add borders around the background to make it stand out more.

#

It says you can add border to this button. I can't find option to add border.

tired shoal
#

(New to unity)Hey I dont know if anyone else is facing the same issue but when I try to add a button to my menu, its super large, and the resizing is really confusing

ionic beacon
#

You'll have to explain a bit more what you find confusing about it

mortal robin
# tired shoal (New to unity)Hey I dont know if anyone else is facing the same issue but when I...

This is a bit vague so I'll just give you some general tips on how to deal with UI in Unity:

  • Make sure your scene view and game view windows are both visible, side by side
  • Make sure you have Gizmos enabled in the scene view (should be a little button with a sphere in it all the way top right of the scene window)
  • Make sure your Canvas render mode is set to Screen Space (Overlay is simplest, but Camera will also work)
  • In the hierarchy window, double click your canvas (or select it and press F). This will zoom your scene window to look at the whole canvas. You should see a big rectangle representing the canvas.
  • Make sure you have the Rect tool selected in scene view
  • You can now properly work on UI. Drag a Button or Text or whatever from the Create -> UI menu into the scene inside the canvas rectangle and watch how it appears in the game view window simultaneously. Move it around a bit and see how the canvas rect corresponds to the game
final oasis
#

How to make UI scale with screen because my 1920x1080 looks normal but QHD (2560x1440) looks smaller

mortal robin
final oasis
mortal robin
#

!collab

marble pawnBOT
# mortal robin !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

hallow bear
#

I'm trying to show/hide the text (ARCHITECTURAL RENDERING) with a checkbox toggle. It doesn't seem to work. I'm probably not using right function from drop down. Please help

hallow bear
#

It seems to work if just use "setActive" instead of "setActive (bool)". But I want opposite result. On toggle enabled, it should hide instead of show.

mortal robin
#

You won't be able to do it in the UI

#

You need to invert the bool, which the UI can't do directly without some code

hallow bear
ripe turtle
#

do you guys think the slight offset in the hud elements here is achieved via some kind of shader to give it that curved almost fish eye lens effect or by just rotating and offsetting the elements slightly...

#

better pic

void light
#

bc it doesnt look like it's js rotated

ionic beacon
#

The red line is straight so probably not a fish eye lens effect

#

It looks like it's skewed rather than rotated

azure flame
#

Camera space slightly rotated canvases on both sides probably would be the easiest way to make it look like one.

ripe turtle
ripe turtle
#

nah i understood that lol

#

its just that youre suggesting using 2 canvases?

#

am i getting that right?

azure flame
#

Having subcanvases is an optimization, you can have as many as you like.

#

It confines redraw to one

ionic beacon
#

The elements on the left are skewed to a different direction than the ones on the right. That's why they need to be on different canvases so that you can rotate them separately

ripe turtle
#

ill try it out

#

thank you

honest saffron
ripe turtle
#

Hmmm i guess i know a lot less about ui in unity than i thought

#

i set up my reference resolution to be 1920x1080

#

with screen size scaling

#

but i also notice that now all my ui elements are hot blurry shit when the game view is set to 1920x1080 and only stop being blurry when i set it to higher resolutions

#

🤔 am i missing something obvious here or is there no way to ensure that my ui elements maintain constant scaling but also dont look like garbage at lower resolutions

#

it could be some aliasing at play perhaps 🤔

#

same exact resolution and everything but the left is screenspace camera and right is overlay...

#

🤔

#

yeah the overall scaling is slightly off but i got them to be pretty similliar in size when viewed in game view

#

this is with the game view at 4k with the screenspace camera and it looks like its supposed to.

vivid path
#

Hi. Im making a portrait (640x1136) unity app that is designed to run in windowed mode on macOS/Windows/Linux. I was wondering if there is a graceful solution to automatically resize the game window to a specific size so it doesn't go over the actual monitor resolution. Any help is appreciated.

slender viper
#

Might be off by a pixel at times but you can deal with that

vivid path
#

Awesome! Thank you so much.

shrewd meteor
#

Is there a way to make a spline slider? Like a slider that moves along a custom curve?

wild pebble
wild pebble
# shrewd meteor uGUI

I couldn't find any ready to use solutions on asset store or elsewhere so you probably have to implement that yourself. The splines package can be good starting point. With it you can quite easily calculate the distance from the mouse to such curve and how far along the curve the closest point is (needed for placing the handle/knob along the spline). When it comes to visualizing the spline, you can generate a mesh out of the spline using the package though I haven't used custom meshes in UGUI, don't really know how that will work. The second option is to use a shader that draws the spline, the UI shader graph samples might be good place to start with that: https://docs.unity3d.com/Packages/com.unity.shadergraph@17.1/manual/Shader-Graph-Sample-UGUI-Shaders.html

shrewd meteor
crisp otter
#

Hello everyone. Can you tell me what to do in this situation? Do I need to create a copy of the scene for portrait, or can I use scripts to change the layout group from horizontal to vertical? Does Unity already have the necessary tools?

slim sequoia
#

I have about 30 icons. Everytime a new level loads, there will be 5 icons displayed on the screen out of 30. Should I have all the icons(.png) separate or combine them into a large atlas[Tile sheet]?

steep warren
#

use whichever makes the workflow easier

slim sequoia
#

alright. Thanks!

jagged monolith
rough summit
#

Hi all, I am currently attempting to figure out why my UI button isn't working
For testing purposes, I have put the button in a brand new scene with the automatically-created Event System, and it works fine in this scene.
However, when I try to load the button scene via another scene, the button refuses to acknowledge any input whatsoever, and doesn't show the hover transitions etc.

Is there a specific thing I need to do when loading a scene that contains UI to ensure that my button will work?

jagged monolith
rough summit
winged glacier
#

I am trying to remove all padding and space between this set of buttons. 12 in total in a 3x4 grid , button size is 64x64

but even with padding and margisn set to 0 there are gaps , can youone advise?

steep warren
winged glacier
#

certainly can!

#

I have checked the parent objects for content size fitters etc and did not see anything either

#

and no RectTransforms are on Stretch , Top left is used for most objects

steep warren
#

it's pretty easy to see in the sprite preview, actually

winged glacier
#

oh jesus

#

I spent hours on that , thank you so much

#

worst part is that was just a placeholder sprite that unity applied as default! , thanks again.

merry bridge
#

when I click on 1 in redirection me to to 2

#

and to modification mean reduce the width an height

#

The buttons in the Chapters menu are not working correctly because their RectTransform hitboxes are much larger than the actual button graphics.
This makes the clickable areas overlap, so when you tap Chapter 1, Unity detects the hitbox of Chapter 2 or another button.
Resetting the RectTransform and using the sprite’s native size fixes the problem.

hallow bear
#

I'm using "World Space" render mode for UI so I can place the UI elements in 3D. Now in the image, you see the canvas and the UI elements are far from the objects of scene. How do I transform (rotate and move) them where I want to place them? Should I transform the Canvas or the individual elements?

#

Also, does it even matter if UI elements are inside the Canvas or not? For example, it does matter in Screen Space overaly UI.

tepid orbit
#

Ello! Trying to make a workable Menu Bar which somewhat works in Vertical screen but now I'm trying to make a workable Horizontal ver so that the Player can use it no matter the orientation of the screen. Is there a way to make it work?

At least Vertical works, not so much for Horizontal.

prime panther
#

I’m trying to create a similar. top bar like in the picture, but it’s not really working.

Here’s what I’m doing:
• Creating a Canvas
• Adding a Background as a child
• Adding a SafeAreaRoot as a child (with the Safe Area script)
• Inside the Safe Area, I put my Top Bar
• LeftGroup → UI Panel with a Horizontal Layout Group (for the hearts)
• RightGroup → UI Panel with a Horizontal Layout Group (for the coins)
• Both groups have “Control Child Size” enabled

But it’s still not working correctly.
The hearts and coins don’t display or position properly, and on some phones the top has too much space while on others it looks normal.

Can someone tell me what I’m doing wrong?

supple basalt
#

Can you cause the problem to happen in the editor, or do you only see this issue on actual devices?

prime panther
#

i see the issue when i use simulator - but when i have 9:16 it seems normal

supple basalt
#

okay, good, so it'll be easier to debug

#

I am not familiar with this "SafeArea" component

#

what is it from?

prime panther
#

what do you mean?

#

do mean what the safearea is?

supple basalt
#

yes, I'm not aware of a component named "SafeArea"

prime panther
#

using UnityEngine;

[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
public class SafeArea : MonoBehaviour
{
private RectTransform panel;
private Rect lastSafeArea;
private Vector2Int lastScreenSize;
private ScreenOrientation lastOrientation;

private void Awake()
{
    panel = GetComponent<RectTransform>();
    ApplySafeArea();
}

private void Update()
{
    if (Screen.safeArea != lastSafeArea ||
        Screen.width != lastScreenSize.x ||
        Screen.height != lastScreenSize.y ||
        Screen.orientation != lastOrientation)
    {
        ApplySafeArea();
    }
}

private void ApplySafeArea()
{
    if (panel == null)
        panel = GetComponent<RectTransform>();

    Rect safe = Screen.safeArea;

    lastSafeArea = safe;
    lastScreenSize = new Vector2Int(Screen.width, Screen.height);
    lastOrientation = Screen.orientation;

    Vector2 anchorMin = safe.position;
    Vector2 anchorMax = safe.position + safe.size;

    anchorMin.x /= Screen.width;
    anchorMin.y /= Screen.height;
    anchorMax.x /= Screen.width;
    anchorMax.y /= Screen.height;

    panel.anchorMin = anchorMin;
    panel.anchorMax = anchorMax;
}

}

supple basalt
#

okay, so it just resizes the target RectTransform

prime panther
#

So your top bar is automatically moved below the notch so it stays fully visible.

supple basalt
#

While in play mode, resize the game so that the problem happens. Then, select the "SafeAreaRoot" object and look at its bounds in the Scene view.

#

with Gizmos on, you should see a rectangular outline showing you the space that it covers

prime panther
#

I'll try

supple basalt
#

You're looking to see if it is shrinking the rectangle too much

prime panther
#

thanks,
but would you normal do it like this?

Adding a Background as a child
• Adding a SafeAreaRoot as a child (with the Safe Area script)
• Inside the Safe Area, I put my Top Bar
• LeftGroup → UI Panel with a Horizontal Layout Group (for the hearts)
• RightGroup → UI Panel with a Horizontal Layout Group (for the coins)
• Both groups have “Control Child Size” enabled

supple basalt
#

oh, make sure that both of the groups have their anchors set properly

#

the LeftGroup should be anchored to the top left corner and the RightGroup should be anchored to the top right corner

#

otherwise, as the groups resize, they may slide around your screen

#

the default is to be anchored to the middle (0.5, 0.5)

night sinew
#

Hi everyone,

Currently I'm working on accessibility in my game and one issue I keep running into is the fact that some of my ui elements get lost off screen. My game is being developed on an aspect ratio of 1980x1080, however when i port the game over to itch.io using a webgl build, some people can't see my ui elements due to their smaller overall screen sizes. What are some best practices/solution in terms of preventing or solving this issue?

azure flame
#

Should not be hardcoding UI size, make it resizable with dynamic anchors

night sinew
#

Okay so I looked into dynamic anchors and am trying to implement them for some ui elements to get the hang of things but my anchor for my score text box never moves after choosing a different location, what could be causing this?

As you can see in the first image the anchor of my ui text element is set to the middle in Rect Transform, but the next image i select it to be by the top of the screen yet the anchor doesn't move from the middle?

#

okay nvm, i found out it was a hierarchy problem bc my gameHUD objects anchor was set to the center, overriding child objects below it

slim sequoia
#

I've disabled the UI map of my inputaction asset. I know with 100% confidence because, If I click the middle mouse button it should print "middle mouse" but it is not.

The problem is even after disabling the UI map and selecting my input action asset into InputSystemUIModule, my UI button are functioning. But it shouldnt be funcitoning right?

mortal robin
#

how are you getting a reference to the action map to disable it?

slim sequoia
#

Ive used the generated c# class and get the inputaction into a Singleton. After that, I use it throught my project

mortal robin
#

If you actually did this I assure you it would work:

public InputSystemUIInputModule inputModule;

void DisableMap() {
  inputModule.actionsAsset.FindActionMap("UI").Disable();
}```
mortal robin
#

the Input module is not going to be using the same instance you created when you do new MyGeneratedClass()

#

so you're disabling a different copy of the ActionMap

slim sequoia
#

Makes sense

mortal robin
#

Actually if you do (pseudocode):

inputModule.actionsAsset = MySingleton.instance.myGeneratedObject.actions;```
#

that would make it use the same instance too

#

then it would respond to what you're doing

slim sequoia
#

But we can only plug the inputaction asset into the InputSystemUIModule and not the reference from my singleton?

mortal robin
slim sequoia
#

^^@mortal robin Would this still count as two different instances?

mortal robin
#

If you are just assigning the asset in the inspector to the input system ui module, yes that's a different instance than the one you create with the generated class.

slim sequoia
#

I dont think the asset and the generated class are two different instances? @mortal robin

mortal robin
slim sequoia
mortal robin
#

right so when you do:

inputSystemActions = new InputSystem_Actions();```
You are creating a _new instance_
slim sequoia
#

So how do I fix that?

#

But I'ts still not working

#

@mortal robin

mortal robin
slim sequoia
#

In that case, I can either stick to the InputActionAsset or the generated class

mortal robin
#

you can have your input module refer to your singleton

slim sequoia
#

hmm, ill try that.

mortal robin
slim sequoia
mortal robin
#

What you have:

  • Input singleton creating an instance of the generated class
  • BiggerManager referring to that instance from the input singleton and disabling the UI action map on that instance
  • Your input system UI input module referring to the asset in the project folder directly and therefore unaffected by the above
#

What I'm recommending:

  • Input singleton creating an instance of the generated class
  • BiggerManager referring to that instance from the input singleton and disabling the UI action map on that instance
  • Making your input system UI input module refer to that same instance so it will be affected by what you do in BiggerManager
river maple
#

How would I put a text infront of an image in the canvas?

mortal robin
#

that has the layout you are talking about, and you can look at that example to see how to do it yourself

river maple
mortal robin
#

The hierarchy window and inspector window are very important

river maple
#

my fault

mortal robin
#

I was recommending creating a button and taking a close look at what that actually creates because it has exactly what you want, an Image and a text overlaid on it

river maple
#

I'm not great with UI

river maple
#

Sorry I just didn't understand what you meant

plucky sinew
#

how does layering multiple ui's on top of each other? i have 2 UI items overlapping each other and one is overriding the other and preventint interactability

river maple
#

Oh wait no it works

#

im just a bit special

#

I forgot I had other Images infront of it so It looked like it was wrong

mortal robin
#

Lower in hierarchy goes on top

#

As for "preventing interactability" that will depend on the "blocks Raycast" property of the one on top

plucky sinew
mortal robin
plucky sinew
#

depth as in the Z values?

mortal robin
#

No

#

Depth as in depth

plucky sinew
#

not sure i understand

mortal robin
#

Actually I guess it's called different things depending on the unity version

#

Sort Order in some versions

plucky sinew
#

currently using the 2023 version

mortal robin
#

What is your canvas render mode?

#

Show the inspectors of your canvases

plucky sinew
#

both canvas

#

im assuming its the sort order

mortal robin
#

Sort Order yes

plucky sinew
#

lower the number the higher in the order?

mortal robin
#

I don't remember, should be easy enough to test

plucky sinew
#

got it fixed, thanks for the help!

slim sequoia
#

I've done this in a new project.
https://paste.ofcode.org/kZSXtCN5cXJt3mJ6HzvHja

I've changed the Singleton. Now the InputSystemUIInputModule's action asset is referenced properly.

But the UI buttons still seems to click, despite disabling the UI ActionMap.

Disabling the InputSystemUIInputModule disables all UI interactions, this works.

I also wrote this code which finds the object of type InputActionAsset>() during runtime. After running it, seems like two instances are present. However looking at their hideflags -- one of them is flag: None and the other one is flag: NotEditable . So we only have one actual InputAction asset and the other instance is a clone?

https://paste.ofcode.org/3a6myKfb9eZfhNd8xUdwatw

slim sequoia
#

@mortal robin

mortal robin
winter zenith
#

What does this yellow lines mean?

slender viper
crystal kettle
#

I'm trying to create a prefab with some text on the object, I'm confused on how the canvas system work and how the text renders so how can I make it so that the text is part of the prefab and moves with the object?

mortal robin
#

Assuming you mean the UGUI versions, you would make a prefab with those components on it, and you would instantiate it as a child of an existing canvas in the scene, generally

#

When you say "object" though, that's a bit vague

#

What kind of object are we talking about?

mortal robin
crystal kettle
mortal robin
#

It really depends what you're trying to do exactly

#

If you're trying to make it follow a 3D game world object, you can just use the 3D version of it

#

and then it's not UI related at all

crystal kettle
#

I just want to overlay text on top of the box, the box itself is not going to move ingame but I might create multiple instances of that box, so I want the text to just be ontop of the box wherever I put it
Like a Sign on multiple doors kind of thing
the game is 3D

#

I want something like this (which what I ended up doing by making the canvas a part of the prefab)

mortal robin
#

you don't need a canvas

crystal kettle
#

oh
the canvas was automatically created when I added text

mortal robin
#

But you need to use the correct version of TextMeshPro component

mortal robin
#

3D Object -> Text - TextMeshpro

crystal kettle
#

Oh that's plenty helpful

#

Thank you, I had the wrong idea.

mortal robin
#

UI - based approaches are valid and potentially viable too

#

it kind of depends on the details of what you're going for

#

If you're looking for like "3d text floating in the world" then this makes sense

#

if you want like... a UI label in screen space that is pointing to the 3D object, you would use UI

verbal mauve
#

hallo

#

im looking for a bit of guidance and advice with unity UI

#

ive been messing around with it for a while and from what i can tell it looks like you can take two approaches

#

one being: items with a defined size are at the end of the heirachy, and everything shrinks until it can't shrink anymore

#

the other being that everything expands till it can't anymore, with the define size being the container at the start of the heirachy

#

it looks like you can set up your UI rects in such a way where this behaviour can change in the middle of the heirachy too if you want

#

but when im making my horizontal and vertical layout groups, each approach seems to require different settings for the layout group

#

so this affects how i set up my generic Row and Column component, and i'm not sure if one approach is better / more useful than the other

#

or if i should make both, an expanding row/column next to a shrinking row/column

#
  • i'm also not sure what the 'control child size' options in the layout group are actually doing, cos the doc just says "control child size: controls the size of the child object"
verbal mauve
#

i made a practical example

#

i made this text deliberately too big, and it correctly results in a height of 111 in the text transform

#

now i just need the parent object to represent the 111 height of it's content, but it's not doing so, and the content fitter doesnt do anything here either

#

ok i was able to achieve the behaviour by utilising LayoutElement and LayoutGroup blobnod

rapid ferry
patent sleet
#

Hi, does anyone know why the Vertical Layout Group component introduces an X offset in children and how to prevent it (other than just offsetting the parent)? Padding is all 0, parent has no offset.

low pike
lofty trout
#

What do you think about this text size? I feel like it's a little big.

flat crystal
#

Hi, I have a weird bug whenever I spawn another UI inventory object in my grid layout system. The objects are all tilted to left as if I haven't spawned the slots inside the object. When I move (resize) the play window, or deactivate and then reactivate the horizontal layout group that hold all the other UI inventory objects, it just works. I tried manually calling LayoutRebuilder.ForceRebuildLayoutImmediate AFTER spawning the inventory slots in each object but it didn't change anything. Any clue why that happens?

#

The top bar is the newly spawned inventory bar, as you can see, it's tilted to the left, as if it's centered WITHOUT item slots (the lighter brown squares)

#

if I close and reopen the hud, it gets set correctly

flat crystal
mortal robin
flat crystal
#

Another example of a 2x2 inventory

#

A great classic, while copying code I noticed that i was spawning the slots in another method and not in the intended one, so it first gets ordered in the grid THEN it spawned slots

#

thanks 🤣

grizzled inlet
#

Hey guys unity localization change fonts
I need to make it so that when I change the game language, the font also changes to match that language.

minor ocean
#

Whatever code you're using to apply the localization to text can also just apply a font change when needed. Not sure what you're asking.

patent sleet
hallow bear
#

The arrow cursor disappears as soon as I click on in game view (that's default behavior I guess). So I'm not able to click this Button UI I've created. What do I need to do?

#

Actually I think the default behavior is that cursor stays in the game view too. So something must have disabled it in my case.

ionic beacon
#

You, probably. That looks like an FPS game so if you've locked the cursor or hidden it for the normal gameplay then you'll have to unlock/unhide it for UI prompts

hallow bear
ionic beacon
#

In the code that shows that UI prompt, unlock the cursor. When you click the button, lock the cursor again.

dreamy timber
#

Howd u guys like the UI I've been working on? =3

slim sequoia
#

Can I use a Panel object with only Rect Transformer as an empty placeholder?

I'm not using an empty object because, at scale = 1 -- it does not fill up the canvas.

azure flame
mortal robin
slim sequoia
#

Is there a guide for the best practices, such as this

mortal robin
slim sequoia
#

There seems to be 2.0 as well ?

hollow heron
#

Heya I'm having an issue with toggle groups and toggle

#

Everything works fine in game, but in editor setting an item to 'IsOn' does nothing, and it's off in game

#

should be yellow in editor, but it doesn't actually toggle on -- only in game

mortal robin
hollow heron
#

IsOn -> should be enabled by default & Yellow

#

I saw this on some UI asset I bought a while ago but implementing it myself here doesn't work

mortal robin
#

enabled by default for which ui element

hollow heron
#

This, it works fine in game if I click it

#

Like it works, just not in editor

mortal robin
#

it's not going to run the transition in the editor

#

that's for runtime

hollow heron
#

Wondering if that's expected behavior, like if it should be enabled by default through code?

mortal robin
#

Yes you can and should enable it first through code

hollow heron
#

works here just fine though

#

exact same implementation

#

(ignore the disc call sound )

mortal robin
hollow heron
#

So I guess unity can't just 'select' a button in editor, but it can hide/reveal a 'selected' image

#

which is how that vid was setup

slim sequoia
#

I run a custom shader in my project. On my Scene window the UI assets run through the shader(not intended behaviour). On the game window -- the UI assets don't have the shader look and runs properly.

Is there any way to make my UI not run through my game's shader on my Scene view?

lethal pumice
#

hello I have a problem
I have a canvas set to screen space overlay and 2 cameras
1 rendering the world and 1 rendering some UI indicators on top , suing a compositor

the canvas does not render ... at all no matter what display i set it to
what am i missing here ?

prime panther
#

I want the Middle to automatically fill the space between the Top and Bottom sections.
But when I change the anchors or positions, the Middle section never looks the way I want.
On some devices (like the Samsung Galaxy Z Fold), the Middle area becomes stretched or either too big or too small.

What I want is a responsive layout that looks good on both tablets and mobile phones, with the correct proportions.
The picture in the Middle should always look the same on every device — just scaled a bit smaller or larger, both horizontally and vertically, so the visual proportions stay consistent everywhere.

night lake
#

Hello I have a question regarding mobile UI that I hope some guru can spread some light on.

I am trying to recreate the horizontal scrolling UI from the game Clash Royale and I think I have gotten pretty close but theres a few things that are bugging me:

  1. I noticed that on any device thats not a tablet the "panels" of each UI are overflowing on the horizontal axis. I am using masks so if anyone could enlighten me as to why a UI designer might decide to do this its greatly appreciated.

  2. I was able to see from their publicly available assets that for some backgrounds they use huge sizes i.e. 2674x3334 however If I am using a canvas scaler and matching height, with a reference resolution of 1080x1920 my viewport is almost always far smaller than even the actual device size let alone the background image size it feels so wrong to me that this is the behaviour we aim for

If anyone can take a stab at explaining these things to me id greatly appreciate it cause as of right now I cant help but feel im doing something wrong

mortal robin
#

They render directly on screen after all cameras have rendered

#

Did you mean to use a Screen Space - Camera canvas?

#

Having an overlay canvas as a child object of a camera is... weird to say the least

lethal pumice
mortal robin
#

Even if you use Screen Space Camera it shouldn't be a child of the camera either

mortal robin
#

It certianly isn't helping

#

it might be causing issues yes

lethal pumice
#

ill look into is
can it be the child of the player ?

#

or not even that ?

prime panther
mortal robin
prime panther
mortal robin
#

refer to the article I linked

lethal pumice
prime panther
#

thanks

lethal pumice
normal cove
#

I'm working on building a stream overlay in unity, have two items in a Horizontal Layout group, both set to flexible width, which allows them to each grow to fill the space of the row. However, when I start adding children to one of its children, it grows, even though there's so much free space. Similarly, adding a Text Mesh Pro child causes it to expand way beyond the size of the text.

#

I cannot seem to figure out why

normal cove
#

The "solution" seems to be setting the min AND preferred width of the row containers to 0. This doesn't actually make then size 0 though, it just stops them from growing randomly.