#📲┃ui-ux

1 messages · Page 4 of 1

mortal robin
#

or just not anchored at all

agile grove
#

the hearts are anchored to top left and the other meter is anchored to top right

sterile wedge
#

and also your canvas scaler in your Canvas

agile grove
sterile wedge
# agile grove

set your reference resolution to an actual 16:9 resolution in your Canvas Scaler

agile grove
#

set width and height to 1920 and 1080: the UI shrank and still does the same problem

prisma pendant
#

tried match width or height

#

then set match to 0.5?

agile grove
#

same problem

#

it's like the canvas is staying the same size

#

when I go up the resolutions the UI goes closer and closer to the bottom left corner

#

when I get that UI problem and I switch to the scene it looks like this

#

so the canvas is changing size with the resolution change, and the anchors are correct

#

do you think it might be a parenting issue

#

if the game is not playing and i change the resolutions it snaps correctly it just screws up when the game is playing

#

is that a Unity setting maybe?

soft sail
#

Drag the game screen out of the tab and resize it yourself to maybe get a better idea how they are moving

agile grove
#

it's acting the same, if I change resolutions during gameplay, meaning the resolution settings in the top left of the Game window, the UI goes wrong

#

if I resize and drag it around on the original resolution i set, it stays in the corners just fine

#

if I change resolutions in the drop menu, the ui messes up

#

same thing is happening when I hit full screen on my game on the web page

gilded quest
#

New dumb question! I have an object with a vertical layout group, and I'd like the children to follow one after another, with no spacing between them. However, when I hit 'Play', the objects are automatically laid out vertically with an equal amount of space between them, which means they are not laid out vertically adjacent to each other.

mortal robin
#

one of those checkboxes does it..

#

(you can do this while the game is running to quickly experiment)

gilded quest
#

Yeah, have been playing around with it. Can't seem to get it to... rrrrgh...

gilded quest
#

Still trying to get this to work. I must be missing something obvious, there's no way this isn't possible with the UI system... Very frustrating.

mortal robin
mortal robin
#

works when that's disabled

#

With it on you get this

gilded quest
#

Ah, but when I have that everything overlaps.... =/

#

This is so flippin' stupid. Up until today I would have said I was reliably capable of handling the UGUI. Rrrg.

#

Setting the Vertical Layout Group to 'Control Child Size: Height = true' means that nothing is overlapping. Really goddamn confused by this.

#

It's working, but I'm not especially happy. But thank you, @mortal robin .

agile grove
#

sooooo, update on my anchoring issue, I remade the canvas (works good), remade the heart meter (works good), put when I put in my panic meter, which is a slider with scripts on it, it starts being wonky again

#

I put a blank slider in, still working fine

#

as soon as I made the hearts inactive it all broke again

#

i don't know if scripts are doing it or what, I'm not getting any errors

#

am I not using a namespace I should be or something?

agile grove
#

I think that's it, as soon as scripts are involved it messes up the positioning for the UI elements

#

i don't know why

agile grove
#

I FIGURED IT OUT

#

I can't believe I did this hahaha

#

I added a UI shake to the code

#

it saves the original position when the UI is created

#

so changing the resolution screws up where it is in that code

#

how do I save it's anchored position

#

I was using it's regular transform position instead of its Rect Transform

#

but it's still not working

agile grove
#

so my situation is I need to save the Pos X and Pos Y of the Rect Transform but it doesn't seem to be doing it

#

I guess this is no longer a UI question

coral violet
#

Hi, I want to create a shadow of just my outline, and not my image, so that the shadows of both don't overlap like in the picture, how do I do that?

#

Nevermind, had do swap my shadow and outline component around, now it works 👍

outer oriole
#

hey,
my canvas is filling the whole screen in play mode, but that its not what I aim for, Im looking for a way to limit it to a computer screen. in side the scene , how do I do that ?

mortal robin
outer oriole
# mortal robin you'd need to use a world space canvas

I did that but I have noticed that I need to resize every child the canvas has, so instead, I've created a gameobject and made it parent to the canvas and scalled that gameobject down and that is it, it does look as if it worked but I dont know if that is the right way to do it, is it?

vagrant silo
#

How do you import a TMP gameobject into script?

#

nvm i just didnt import TMPro

coral violet
frosty pewter
coral violet
frosty pewter
# coral violet Here:

Hrm. I'm interested to know why it would work in one and not the other... maybe you can gleam some information when in play mode by looking at the preview pane at the bottom of the event system when hovering some stuff?

frosty pewter
coral violet
devout crypt
#

is there an easy way to make unity synchronize the EventSystem's selected object with what the mouse is hovering over? it seems intuitive to me that hovering over a button would make it the selected one, but that doesn't seem to be the case

toxic pasture
#

guys will too much UI drain fps?

past shuttle
#

Another question I have. It looks normal in the editor, but wrong in the game?

soft sail
#

Pull out the game window and resize it manually and you'll find out why

past shuttle
soft sail
#

What I'm trying to say is that your elements are being modified by the aspect ratio/resolution of your game

#

You can usually resize your game window to get an idea how it's all being positioned.

obtuse tangle
#

Is it possible to mask an Image under multiple Rect Masks?

grim fog
#

is there a version of GUILayout.box that outlines the content instead of darkening its background?

sonic lily
#

how can i mask out my ui so that my character doesnt shoot if im just clicking somewhere over ui

tepid torrent
#

Is there a way to make it so Unity does not automaticlly disable canvas?
I am working on a Scene switch between one of our Lvls and the main Menu.
The main menu has a video background and an canvas in front for the Buttons and overlay. When I move from one Scene to another (within the game) it disables the Canvas with all the buttons inside wwhich I do not want.

royal marsh
#

Hello. Why does the text written in Russian disappear when half of the object is behind the camera, but this does not happen with the text written in English?

severe herald
#

apparantly shader graph doesn't work with UI

soft sail
#

it does though

somber mortar
#

how do I fix this?

severe herald
# soft sail it does though

From what I've noticed the part that breaks it specifically is having it on sprite mode tiled. Maybe the two things I'm doing doesn't mix well together.

soft sail
#

use tiling from fragment and not from the vertex maybe

#

ive got a lot of tiling and wrapping on my mobile game and it works fine

obtuse hemlock
tender drum
#

hello there, we started using the device simulator included in 2021 to adjust our different devices and resolutions and it would become handy to know by code if we are inside the device simulator or not, is this possible somehow '

#

?

low pike
somber mortar
low pike
#

You can't anchor the canvas itself, it changes with the screen

#

You need to anchor each UI element to where it makes sense to anchor it

soft sail
#

If you're searching for something by the base class of the objects then it'll return everything that derives from it. If you extend from the class, usually you can reduce the amount of searches.

forest sedge
#

Hi how i cen add whole psb img's to ui? so i dont have place it from 0

prisma pendant
#

can i make frame be shown at front while keeping this hierarchy?

mortal robin
prisma pendant
#

hierarchy is not an option

mortal robin
#

Then you are stuck with this render order

#

Why not just make the border image live on a separate object which is a sibling of the portrait

prisma pendant
#

thanks for reminder

somber mortar
chrome rivet
#

Anyone know how to fix TMP_Text from looking slightly pixelated/blurry in-game? I've tried many suggestions from forum posts but nothing seems to make a difference. Everything looks great in the Scene view. My game display is set to Full HD 1920x1080, I've set my Project settings to use this resolution, my Monitor uses this resolution, I'm using a World Space Camera with a width/height of 1920x1080. I've tried using the default Font settings, then upping the Font Size, and messing with the TMP Atlas settings when creating the Font, but nothing seems to make a difference.

soft sail
#

Have you tried it with an official build? I notice it does look jaggy when scaling it the simulation, but I've not really notice the issue in the build.

chrome rivet
#

Yeah, that picture is from the Build. It looks bad in both game view/build.

somber mortar
low pike
#

The fix is still the same. Anchor to the correct corners and align them to those anchors

#

You don't anchor them all to the same corner.

weary flare
#

whats the best bunch of video tutorials out there over an hour long?

haughty drift
#

I have changed canvas to screen space - camera to get a particle to work, but not my text has gone, does text stop working when its not longer on default space

mortal robin
#

Note that your plane distance is 100 so you probably just have other objects in front of the UI

haughty drift
#

Thank you i also notice another issue maybe not right channel but my particles are running at different times, but i have no delay set

somber whale
#

How to show FX on UI canvas, That don't show my FX. I tried something but on other hand i see my FX but not my game...

orchid apex
#

how would i have it so the transparent parts of the ui actually act transparent and aren't black for some reason"
and by transparent i mean theres a gap between 2 images that i want to see the background from

drowsy plinth
#

question, and apologizes if this is in the wrong channel,but is there a button to expand all of an armature at one time?

#

nevermind

#

its alt lol

weary flare
#

Can someone tell me why my icon dissapears when I apply horizontal layout?

#

I basically have a button with an icon to left

somber mortar
#

Do I anchor them to the nearest corner?

low pike
#

then anchor to the center..

#

You should be anchoring all things to the closest point that it makes sense to anchor them to

tropic comet
#

can anyone explain this

low pike
#

recttransforms not being the correct size of the image.. maybe

tropic comet
#

isnt the grreen the hitbox

somber mortar
low pike
tropic comet
#

what colliders do you mean

low pike
#

🤔

#

Unity doesn't use the term "hitbox"

tropic comet
#

like the hitbox where you can press or whatever its called

low pike
#

The green squares are colliders.
UI doesn't need a collider component.

#

They're also not alligned correctly

tropic comet
#

it doenst have a collider component

low pike
#

that game object doesn't, I'm sure there's more than 1 game object making up each one

#

All UI elements should have a scale of 1,1,1 and use the height/ width to resize

tropic comet
tropic comet
low pike
#

because it fucks things up, and there's no need to change the scale.. the height/ width are there to change the size

somber mortar
tropic comet
low pike
#

if you change the scale of something, then change the scale of a parent...that child won't scale correctly

#

what about the colliders?

tropic comet
#

the green box that is the area u can click to toggle the button whats it called

#

i mena that

low pike
#

I can't see your hierarchy to know why those colliders are there, or what they are on. They should not be there. Find them and remove them.

somber mortar
tropic comet
low pike
#

You're working with mobile, why have you changed it off the device sim?

tropic comet
#

this is the hieracrhy and none of them have any colliders

low pike
low pike
tropic comet
#

there arent any

somber mortar
#

now there is nothing

low pike
low pike
somber mortar
#

ok

tropic comet
#

it was like that originally mainUI was disabled and there is still no green boxes

low pike
#

It's not going to be "change 1 thing and everything stays ok/ works" .. you have to engage ya brain and update things to work with the correct way to do something

low pike
tropic comet
#

just shopUI

#

and selected the button

low pike
#

put t:collider in this search box for the hierarchy

tropic comet
#

did and no buttons or any of shopUI

#

or any of main UI as well

#

its not a collider am 100% sure

#

i didnt just randomly add it

#

its just button padding

#

why is it off was my question

low pike
#

Buttons don't have green squares¯_(ツ)_/¯

tropic comet
#

mine do 😄

low pike
#

Change the scale to 1,1,1 and update the height/ width to the correct size

tropic comet
#

it changes the button size and messes up the aspect then only the green box extends 🤣

low pike
#

You have to go through ALL your UI and change it to 1/1/1

tropic comet
#

i set them all to 1 but with this canvas i cant why

#

oh cause its scale with screen size stilll that shouldnt be a prolbem

#

i am so confsued

low pike
#

Yeah, the canvas being like that is fine

#

You can only change the canvas scale when it's set to world space

tropic comet
#

then i have no idea why it odenst wokr

low pike
#

nor do I, not got enough information

tropic comet
#

what more information can i give

#

my credit card number adress?

low pike
#

That'd be great, but won't help with this issue 😄

#

Do a screen recording to show me each inspector.
Select the ShopppUI -> wait 2 secs -> select bg -> wait 2 secs -> select BuyPet1 -> wait 2 secs -> carry on until the last child of BuyPet1

#

Need to see the hierarchy + scene view + inspector

#

scroll down on the inspector if there are components off screen

tropic comet
#

first part gyazo lets me record for very little

#

all the other buttons are just copies so i just needed to show you that one

low pike
#

Yep, they're not prefabs though - you should look into prefabs if you don't know about them already

tropic comet
#

what

#

prefabs for what?

#

i mea nwhy

low pike
#

the buttons, anything you have multiples of

tropic comet
#

i just ctrl c ctrl v

low pike
#

so you can just change things in 1 place and have it update in them all instantly

tropic comet
#

yeah i know and prolly shouldve done that when i look at it

#

doesnt matter i give up on the problem ill figure osmetin out

#

thanks for the help anyways

low pike
#

Also, press T and use the UI tools when working with UI

#

The RectTransform for your text is massive on the width.. I'd change that so it doesn't extend beyond the button it is on

#

set the padding back to 0

tropic comet
#

where

low pike
#

it's hidden in here

#

Margins, sorry, not padding

#

that's the yellow square

tropic comet
#

ye ye i see it thanks

#

but that still wont fix the issue : P

low pike
#

Text gets hit by raycasts too.. the RectTransform for your text goes over all the buttons... resizing it to be within it's own container will stop the possibility of the text blocking the raycasts incorrectly

tropic comet
#

can i just disable text cast raycasts?

low pike
#

Yes

tropic comet
#

this?

low pike
#

But you should still resize the recttransform to be the correct size anyway

#

yep

#

It's good to untick 'raycast target' on anything that doesn't need to block/ be hit by the raycast

tropic comet
#

IT WORKS thank you so much bro

#

you took literally 1 hour of your day to help some random stranger ur a legned

low pike
#

🙂

weary flare
#

Can I ask why preferred size is locked in content size fitter

#

I cant reduce my button any further than this width

#

You will see its greyed out in width above

#

I absolutely hate the unity gui as someone new to it

#

coming from Figma this feels like hell

low pike
#

because it's being set by a layout (Horizontal/ Vertical/ Layout element)

#

or content size fitter

weary flare
#

Is there anyway to adjust it? The content size fitter is set yes but that essentially has no settings to adjusr

#

adjust

#

I set horiz to preferred size

#

but it seems to just create some arbtrary preferred width or size I cant change, which is 180px above

weary flare
#

This is driving me insane. Why when I set preferred width does it expand the box 😦

weary flare
#

nvm sorted it

#

urgh

coral violet
livid shell
#

help

real arch
#

and another tip for desining UI
set your game view to some fixed reference resolution you like to design your ui for

coral violet
weary flare
#

I've asked this before but is there any way to control how much something scales with scale with screen size

#

instead of it scaling 1/1

#

At larger screen sizes the ui looks toy sized

#

giant ui

tribal parcel
#

There a way to make UI builder go from like camera to worldspace? I want to use to for health bars above enemys heads

#

If not is there something else I should be using that can "format" the shapes and text and things really well also?

orchid apex
#

should i use ugui or ui toolkit for a fps game

mild kernel
#

Ugui has been used for many games for a long time. UI toolkit is new. You can research it (they have a sample project) to decide if you want to use it.

dull loom
#

hey i have a question. For my unity project I have multiple canvas's for different gui's. So i might have one for the shop, or one for a warning message. Is this good or is it bad?

mortal robin
#

it's more efficient to update each smaller canvas

dull loom
#

phew

#

ty

low pike
hard abyss
low pike
hard abyss
#

from this searchs its basicaly a png sequence

rapid ferry
#

doe sthis look good this is my first time making a menu

worthy karma
#

nice

elfin river
#

Is there a way to use UIDocument in the world renderer instead of needing to take over my screen?

weary flare
#

If you have a canvas that is set to scale with screen size

#

is there any way to actually select certain items to not behave in this way?

#

For eg: I want this chat box to not look giant sized when you start getting beyond 2k

mortal robin
warm wolf
#

Hey guys, any idea why my rawImage is completely transparent?

#

In fact none of my raw images are showing up. Sprites are fine though, any idea what this could be?

#

MIght have fixed for now, though no idea what going on there still

hollow silo
#

Im trying to make an element stretch to the current aspect ratio

#

but when I swap aspect ratio this happens:

#

The rects are "flipped" offscreen, rather than staying within the screen canvas

#

Im using canvas scaler with the correct reference resolution

haughty drift
#

I am so confused as to why the text shows in scene mode but not game mode when i play mode

somber mortar
trail oar
#

Hopefully I can explain this... I had a player UI prefab that was a gameobject with a canvas and the actual ui as gameobject(s) within it. I wanted to create prefabs of the inner gameobject (so I can support swapping them). I am sharing the object with the canvas (acts as the parent) as the UI requires a canvas obviously. But now that I separated my inner prefabs they are not directly visible in the editor because they aren't wrapped by a canvas. Can I place a separate canvas on those inner prefabs without any grief?

trail oar
vocal knot
#

Hi is there any way I can do font conversions from a spritesheet to a TMP Font.

#

I know there's the option of converting it to a sprite atlas, but the current spritesheet I have consists of numbers for a score, so if I would need to increment it would be quite annoying, since I would have to convert a number like 31 to <sprite="3"> <sprite="1">

rapid ferry
#

If text is entered into an inputfield, the text doesnt change to the second line if the first line is full of characters.
I also increased the size of the inputfield, but it stays the same

#

Also hprizontal oveflow is set to wrapping

#

But when I play it changes to overflow again

rocky holly
#

I have a panel, Width being 800, Height being 600. On some situations, this is too large.
I want to make this scale to the screen width, but cap it at 800x600

#

Is there a way to do this?

toxic pasture
#

hi
should i keep doing this?

civic notch
#

Im coming to the part of my game when i need a UI, both for menus and some user input.

Im fairly familiar with unity's UI but i find it to be messy. (Especially working with grids(?) And their children)

Whats you guys opinion on it? And is there any alternatives?

tropic comet
#

what canvas scaling should I use for this

#

i use this rn

white plover
#

why is this white thing in background,
when i added 2 layers, one background and one foreground

mild kernel
#

It's an image ...? If it's supposed to be transparent, make sure the art is actually transparent background.

white plover
unique forge
#

Is anyone here good with custom UI and the animations/coding after art is finished?

#

I am seeking to find someone to help me get a custom UI

mild kernel
oblique plinth
#

hi, someone help me pls, how can i use blending mode in unity? m use 2021.3 vers

whole night
#

Does anyone have any good UI framework recommendations? I've been using https://github.com/yankooliveira/uiframework for awhile, but Unity gives me trouble when instantiating UI prefabs at runtime -- the alignment at runtime always looks different from the prefab even after tinkering with the anchors.

whole monolith
#

guys a question that i dont understand the answer to...so UI elements need to be under a canvas... but in my game i need the text to follow a sprite ... how do I do that ?

#

do I have to create a canvas under each sprite i need to make ?

brisk sandal
halcyon heron
#

Is there a way I can make a button target graphic only its sprite rather than the whole Rect? I think that changed since I used the new input system, now some buttons are overlapping which is annoying.

sturdy anchor
#

Hello, does anyone know if there's a way to draw an arbitrary diagonal line between two points in UI toolkit or IMGUI? Either framework works but I would prefer UI Toolkit. I would prefer to draw a spline over a line if possible as well.

rich wren
#

How can i apply multiple Rect Mask 2D on one element?
I have an image that moves along the screen. Then I have multiple Rect Mask 2D that are separated. I need that that image is visible when passing by a mask. Usually you just make the image a child of the mask object. Thanks in advance.

somber mortar
#

Hello I am using Lean Tween to animate my Ui I heard that it performs really well but whenever I run these pieces of code I run into major Performance issues
public void Open()
{
show.transform.LeanScale(new Vector3(4, 4, 4), .6f);
}

public void Close()
{
    show.transform.LeanScale(Vector3.zero, .8f);
}                                                                                                                                                                                   And             

Item.LeanRotateZ(-10, .4f).setEaseInBounce();

thorn zinc
#

Any guides out there for making UI work properly for common ratios?

flat nymph
#

how come the zoom in the editor slows down to a crawl seemingly at random

#

extremely annoying

#

its like it sets a new focus point and not allowing to zoom past a certain point anymore

elder tangle
#

hey there can i post any Ui related questions here?

mild kernel
#

Any is a broad term, but that's the topic of this channel, yes.

mortal wharf
#

when is this "selected sprite" used for a button? I had it set to a really noticeable sprite and it never changed to it.

mortal robin
mortal wharf
mortal robin
#

That's not a smart ass response

#

It's the answer to your question

native shoal
#

Can't manage to do this, even with layers or separate camera (UI & Player)

molten tartan
#

why isnt my ui showing up?

low pike
#

because you've got your eyes closed?

low pike
#

(No one can tell you why it's not showing without any information as to what is happening)

elder tangle
#

hey! i have some issues with my uiManager script, basically i have my manager for my gameOverMenu whichs i enable in the uiManager, once it's enabled the uiManager makes the menu play an animation

my menu has a button to reload the scene, but once i reload the scene my menu refrences is set to null, why does this happen?

here is my UiManager script : https://gdl.space/acudoqexof.cs

little hazel
#

What should I make of this?

#

Every single RectTransform emits this warning when I enter play mode

#

No stacktrace

#
SendMessage cannot be called during Awake, CheckConsistency, or OnValidate (ActorHealthBarsCanvas: OnCanvasHierarchyChanged)
#

Ah, maybe this is caused by NaughtyAttributes

rapid ferry
#

this is supposed to be centered but it's aligned at the top for some reason, how do i fix this?

#

is there a tutorial on how to set this up to align properly?

pastel mountain
#

"how can I show a button like it is pressed, any ideas?"

#

I posted this on code-general, but it seems like the question is for here

normal flume
rapid ferry
#

nope
it's specifically that font, other ones work fine

rapid ferry
ruby igloo
#

How could I disable click and drag scrolling from the default UI Scroll View?

#

Oh lord, if I uncheck Vertical/horizontal before runing the game, the scroll bar appears but doesn't work, even if I check them at runtime. But if I check Vertical/Horizontal before running the game, they work toguether with drag to scroll functionality, but if I uncheck them at runtime, drag is disabled and the scroll bar works

#

Is this suposed to be working as intended?

wicked patio
#

Its happening again.
1: the menu looks ok in the editor.
2 the menu looks ok first time in the game.
3 when i close settings and open it again in menu, some of the elements go behind the background...

lilac pivot
#

Hi all, is there any way I can put my sprite in front of the button?
And for the button, I want it to span the size of the yellow grid size, without any text. Is it possible to do that?

floral crow
#

and for spanning the yellow grid size you just have to make it stretch to is parent

#

bottom right

lilac pivot
#

I tried reordering it, but it kept defaulting back to this order

#

I tried to drag the button on top of the object sprite, then clicked "open prefab," reordered, and it still went back to this order

floral crow
#

that's weird

#

there's a canvas compoenent overide sorting option

lilac pivot
#

ah okay i got it to work somehow, but now my edited prefab is no longer blue (turned grey). how can i get it back to the blue?

floral crow
#

don't think you can

#

unless you make another prefab

lilac pivot
#

gotcha, and is there any way to remove the "button" text?

#

basically i just want the player to be able to "click" anywhere within the yellow grid cell (which is why I thought of a button), but there doesn't need to be any text present

#

oops i got it! just had to change the button's image to "textmeshpro"

halcyon vigil
halcyon vigil
#

Nevermind for now, I think I found that I can just rotate the UI element 180deg and the rendering is how I'd like. Just need to create a backwards font and display it backwards now too

dim slate
#

No idea if this is the right channel to ask (pls lmk if its not), but,

I want to get a TextMeshPro text (just in the world, not on a ui canvas) to, given a font size, display at the actual scale of that size as if it were being printed.
So, a 12pt font would be 0.00423 meters from the descent line to the ascent line.
Looking at the font and it's FaceInfo struct, I can get the sampling point size of a font as well as the metrics for its ascent and descent line, but have not been able to find any information as to the conversion factor between those metrics and actual world space.

Using the default LiberationSans typeface, I can see it has a default sampling point size of 86. If I place the descent line at 0, then when rendered at TMP fontSize = 86, the ascent line extends to roughly 9.6m. This sorta tracks with the fact that this distance is 96.07 in the font face info metrics... but why is it divided by 10? Where does the 10 come from?

Apologies as everything I know about typography at this point has just come from trying to solve this problem, but,
What in the world are the units on TextMeshPro font assets and how can I convert them to meters so I can use them with the rest of unity?

(it looks like maybe I need to find the "units/em" used for these metrics, but where do I find that? Looks like this might explain the weird factor of 10 from before, but no idea)

somber mortar
#

What do any of you recommend for learning how to make a good looking UI

rapid ferry
barren wigeon
#

where can I find ui ux similar to this style

edgy copper
#

how can i make that button's background transparent?

mild kernel
#

Use a transparent image

wicked patio
#

png file has transparency

rapid ferry
#

does anyone know of a good tutorial on layouts? i kind of understand them but not really, so i find myself just clicking buttons until it works kind of how i want it to

zealous garnet
#

can i make TMP text position and size itself according to the display size, like a panel?

mortal robin
pine solstice
#

Does anybody know if there is a Spinbox Component available anywhere? For the life of me I cannot find it. Seems like a very basic UI component to me that should be available somewhere.

mortal robin
true sedge
#

so I have this button using a USS selector "focus". So it turns "Yellow" to indicate that it has been selected but when I click the "play audio" button it takes the focus off, how can I prevent certain buttons from removing focus? (the play audio button has its focusable property set to false by default too)
https://gyazo.com/5d41ecb48cb29ce278c5de4920f7e4df

mortal robin
true sedge
#

Done something in c#

#

Got it figured out I think

#
    directionBtn.clicked += () => selectDirectionBtn(directionBtn);

    private void selectDirectionBtn(Button directionBtn) {

        deselectSelectedDirectionBtn();
        selectedDirectionBtn = directionBtn;

        directionBtn.style.borderTopWidth = 2;
        directionBtn.style.borderBottomWidth = 2;
        directionBtn.style.borderLeftWidth = 2;
        directionBtn.style.borderRightWidth = 2;
    }

    private void deselectSelectedDirectionBtn() {

        if (selectedDirectionBtn != null) {
            selectedDirectionBtn.style.borderTopWidth = 0;
            selectedDirectionBtn.style.borderBottomWidth = 0;
            selectedDirectionBtn.style.borderLeftWidth = 0;
            selectedDirectionBtn.style.borderRightWidth = 0;
            selectedDirectionBtn = null;
        }
    }
somber mortar
#

why is this in a different position when the rect transforms' are the same

thorny bloom
#

I am noticing that the canvas scaler for a horizontal layout group is causing craploads of memory allocation for me when I change fill amount / color of child UI images. If I turn off canvas scaler = no allocs (can change fills / colors just fine)... anyone experienced this?

clear terrace
#

Hello, I have a question, how can I show several 3d objects on a canvas?

I'm making an inventory with 3d gems that rotate and I don't know how I can show them in my inventory. I'm using urp as pipeline.

mortal robin
clear terrace
tranquil hazel
#

Hello, I think asked this question in the wrong channel cause I wasn't getting any responses. Hopefully, this is the right one.

Any help? My camera currently looks like it's positioned above my objects but the view shows it looking at the objects from below. How do I readjust the camera's position? I can only adjust the angles and zoom in or out at the moment.

mortal robin
#

I see a view of it looking at the mountains/sky

#

which seems to match with the gizmos in scene view

tranquil hazel
#

Bottom right corner shows the camera looking up at the car and box object I believe

tranquil hazel
mortal robin
#

just make sure your tool handle poosition is set to pivot and your tool handle rotation is set to local

#

and you'll get an accurate view of the position and orientation of your camera.

#

I can't really see from your image what's going on

floral crow
#

what could be preventing my text from appearing?

#

UI works when my pause screen is on

jagged monolith
floral crow
#

Oh thank you

#

I feel like the UI version should be the default one

#

oh well I guess it goes against the name

tranquil hazel
zealous prism
#

my player cant interact with world space canvas buttons (or anything else on the canvas), is this normal, and are there workarounds?

low pike
#

Hello I think asked this question in the

azure flame
zealous prism
azure flame
zealous prism
azure flame
#

Make sure canvas has graphic raycaster. That is also why I said to create one on the clean scene, because everything you need will be added by default and will work out of the box

zealous prism
#

yup, all i did to get this worldspace canvas was to press the create button thing in the menu, which creates a default canvas, and then switched it to worldspace (with a bit of rotation and resizing to get it in the right place), i dont think my setup could get much defaulter

azure flame
#

Collider could be obscuring the raycast if you don't get anything in eventsystem

zealous prism
#

ooh perhaps, ill try those debug draw line things on a raycast and see if anything is blocking my camera's racasting

azure flame
#

You can also add 3d or 2d raycaster depending on your objects, on the camera and it will tell you exactly which collider it is hitting in world space

zealous prism
#

ooh that sounds simpler than my strategy lol, ill try that thanks!

azure flame
zealous prism
azure flame
#

You add it to a camera and it will capture pointer events from colliders, like if something in-front of the UI EventSystem will then tell you in debug window exactly what it hits

zealous prism
azure flame
#

You use it generally to turn colliders into pointer interactable objects

zealous prism
#

ok fascinating

#

also im not quite sure how to read the event system debug thingy, is this good?

azure flame
#

you just need the one that tells you which object pointer is hovering over

zealous prism
#

which one is that?

azure flame
#

pointerEnter is good enough

zealous prism
azure flame
#

At runtime you mouse over the object and look at the inspector

zealous prism
azure flame
#

The game window must be active

zealous prism
#

ok here!

azure flame
#

Pointer position tracking must be active at the very least

zealous prism
azure flame
#

Make sure you've clicked on the game screen at least and see it tracking mouse position.

zealous prism
#

and see what tracking mouse position?

#

i really feel like im missing something obvious lol

azure flame
zealous prism
#

huh, my settings look pretty much the same as far as i can tell (except im in 3d), but none of that mouse tracking is happening for me

azure flame
#

Is your project using old input manager or both?

#

I don't know how new one behaves

zealous prism
#

old input manager, i really wanna use the new input manager, but only later on, for now i just wanna get a basic something working

#

i have a feeling im doing something catastrophically wrong lol

azure flame
#

At the very least EventSystem will always be tracking pointer position. So if that doesn't work make sure you are using at least the old system

#

Player > Other Settings > Active input handling

zealous prism
#

ill check that thanks!

azure flame
#

also do the thing with entirely clean scene, add clean components and see how they work

#

If that doesn't work then something project wide misconfigured

zealous prism
zealous prism
azure flame
#

Ctrl+Shift+B Player settings bottom left

zealous prism
#

ah thanks

#

this good?

azure flame
#

yes

zealous prism
#

and i dont think my scene could get much defaulter, it is a simple rigidbody based player, a map that consists of a floor and some walls, and not much else

azure flame
#

When it does work examine your components

zealous prism
#

ill try, but am i atleast allowed my player in this clean scene?

azure flame
#

you only need a canvas in world space with some interactive element and event system

zealous prism
#

ok, il try it and report back

#

ok what the hell, it works, for seemingly no reason it seems, welp that tells me that in my main scene either normal cubes or my player are breaking it somehow

#

ill test my player first and see if it breaks it, brb

#

huh, ye my player breaks everything, weird

#

all it is, is the keyboard axis grabbing stuff, some custom gravity, and the mouse axis stuff, dont see why this should be breaking everything

azure flame
# zealous prism ok here!

if your event system doesn't register any pointer movement, it won't be sending any UI interaction events. Something could be manually setting pointer or its event data to -1,-1 there every frame.

#

You can test if the scene itself has something that is doing that by turning off everything and running it with just event system

zealous prism
azure flame
#

One probable thing that is happening is that you have component somewhere deleting and creating event system constantly. When it was suppose to make just one that it was on the scene...

zealous prism
#

perhaps, but like i said it wont be something i made, cause ive pretty much never used the event system before this conversation, any components known for doing that kinda thing?

azure flame
zealous prism
#

im just tryna work out why

#

i know im doing something terribly wrong, but i aint got a clue what, are there any commonly used functions known for affecting the event system perhaps?

azure flame
#

Now that you've narrowed it down to a script, do the same for the script itself. Comment out everything and find problematic line.

zealous prism
#

wow, i got so lucky, the first line i tried was the problematic one.... ```cs
Cursor.lockState = CursorLockMode.Locked;

azure flame
#

locked cursor can still raycast, only in the middle of the screen.

#

so if you are locking it you need to point it with the camera instead

zealous prism
#

im afraid im not really certain what that means, im quite a noob

azure flame
#

Here -1,-1 is the left bottom corner of the screen though. I think it's possible to lock it and set it in the middle so you can use camera as pointer

zealous prism
#

ok that makes sense, so i just need to set the cursor position to screenwidth/2,screenheight/2 then?

azure flame
#

yep

zealous prism
#

unless there is any unity inbuilt method, guessing im gonna have to do a bit of dll interop to set the cursor position (meaning a different function for each operating system, but i suppose i can deal with that using #define)

zealous prism
azure flame
#

or you can raycast manually to the center

zealous prism
autumn gale
#

For some reason my text mesh pro doesn't have any fonts

wild pebble
autumn gale
autumn gale
zealous prism
#

world space buttons are really buggy in general ive noticed, you can only click them on the very outside, no matter where the cursor is, nor whether it is locked or not, this is most unusual, are there work arounds to make them more easy to click on?

zealous prism
zealous prism
dawn rain
#

Hello everyone, I have 2 canvases
They're both 1920x1080 and have UI elements suchs as buttons and such in them.
However, when clicking on the 2nd display, it also clicks at the same position but in the first canvas....
It seems like they overlap for the Event system.
Is there a solution to this issue?
Thanks in advance!

mortal robin
dawn rain
#

I have 'Display 1' and 'Display 2' game tabs in the unity editor

#

and when clicking in the second display it also clicks the first display at the same position

#

As if the canvases are on top of each other

mortal robin
dawn rain
mortal robin
#

I've never worked with such a setup

#

Is the idea that the final game will be multi-display?

dawn rain
#

Yes

mortal robin
#

Ok - yeah I wouldn't be surprised if there's bugs with that, it's a somewhat obscure feature

#

Not sure if there's a workaround

dawn rain
#

Like, two people on the same computer but clicking on different stuff at the same time, because the monitors are touch

dawn rain
#

Well, if someone knows a solution for this issue please leave a comment, thanks!

dawn rain
remote trellis
#

Okay. I have no idea why this happens, but I was trying to create a settings menu when I experienced this odd bug in which if I select another option in a TMPro dropdown, the menu does not close and the previous option is still selected. It only closes either when I click out of the dropdown, or select the same option twice. Any fix to this?

hot roost
#

I'm trying to make a UI Panel which grows/shrinks to fit whatever is inside. So example if I put a 200x200 image as a child, then the Panel would be 200x200 to fit it.... I would think this would be using Content Size Fitter, but that doesn't seem to do this?

sterile wedge
hot roost
#

Preferred size on the child?

#

For example I want to have a Panel which contains a grid of images up to 3 across. I may fill the grid with any number of images. Each image will be 200x200. The parent panel would resize to fit however many images are in the grid.

merry apex
hot roost
#

I put the Content Size Fitter on the parent panel and tried all the different settings (unconstrained width, min, preferred etc...)

#

Put the parent panel is not adjusted in size

#

As you can see the image in this example is set to size 100 x 100, but the panel is not expanded to fit it

sterile wedge
#

oh i just saw it

hot roost
#

The first image is the heirachy. Just Canvas -> Panel -> Image

sterile wedge
#

so Panel has Content Size Fitter?

hot roost
#

Yes

sterile wedge
#

try putting a vertical layout group on Image

#

then enable force expand on both width and height

#

sorry, on Panel

hot roost
#

Oh i see on the panel yes it seems like it's doing something now

#

Thanks

pastel sage
#

Hey, how can I programmatically create text? (scene doesn't have canvas)

merry apex
pastel sage
#

Game that I'm modding doesn't have textmeshpro

merry apex
pastel sage
#

😐

#

what's the difference ??

low pike
#

Modding a game will require you to do things specific to that game, no one else here will have experience with it, thus they won't know the way to do things for that game mod.
While you won't get help on how to do specific mods for that specific game.. you may find the odd person who'll have an abstract chat about modding.

#

If by "modding" you mean you've ripped the game and decompiled it.. then no, you won't get any help.. that's against the rules to talk about.

pastel sage
#

I just don't understand what the difference is. For example, let's say I'm making my own game. I don't have textmeshpro. How do I do that?

#

I know that making a game and modding a game are two different things. But as far as I know, modding doesn't change anything in my case.

low pike
#

If you're making your own game, you would just add TMP to the project..

vale lodge
#

Sup ! I'm using a UI panel with a RectTransform. I instantiate it on Update() and I try to access this component but it is null. Weirdly, I try to access it on ONGUI, and it is not null ! I kinda need this info on the same frame that the object is created. WOuld be weird to wait for 1 frame before setting its properties.

vale lodge
#

First image is on Update(), second is on ONGUI (all in the same frame)
Correction : It is not null after all, simply not initialized and seems to retain default values

#

Sorry, code :

#

(RectTransform)object.transform and GetComponent<RectTransform>() don't return anything different in my case,

sterile wedge
#

please dont crop so much out. can't see any context to your code. See #854851968446365696 on how to post code

#

I want to see how it's instantiated and what component you're accessing

#

and where you're checking the values

orchid wyvern
#

Hello, does anybody knows why is the button "hitbox" so big?

#

Like, i can click the button without even puttin my mouse on it

mortal robin
#

Use the rect tool and adjust the rect

orchid wyvern
#

I tried that, but nothing

mortal robin
#

You need to edit your image to remove the padding

#

yeah in fact you can see in the bottom right of your video

#

that is has a bunch of empty padding

#

You can also check the "Use Sprite Mesh" checkbox in the Image component

#

that way it uses only the sprite mesh and not the full rect

#

I believe you can also make the mesh "tight" in the import settings for the image

#

lots of options here

orchid wyvern
#

Tight option is enabled

#

Thanks

honest saffron
#

Hi!

I heard having everything in my game in one canvas is bad for performance, is that true? And can I put multiple canvas children inside one canvas to fix it instead of needing to have multiple different separate canvases?

frigid cobalt
zealous prism
#

wondering if there is anyway to make a smooth scrollbar, as the default limit of 11 steps leaves the scrollbar feeling quite jerky?

zealous prism
#

another oddity, when trying to set a RectTransform's position to 0,ScrollBarThingy,0 it somehow messed up the x and z, and refuses to set them to 0

mortal robin
#

.position is world space position

zealous prism
#

oh whoops, welp thanks so much for that!

halcyon heron
#

Hey, I set all my UI for full HD and wanted to change it so that it's adapting to the resolution. Is there any tricks to it? Basically change everything so that all positions are at zero playing with anchors?

mortal robin
tough wharf
#

hi i am having a hard time fixing my text size and configuration, it appears very stretched and not sure how to deal with it

mortal robin
tough wharf
mortal robin
#

basically none of the objects in the hierarchy should be scaled manually

tough wharf
mortal robin
#

you shouldn't size UI elements by scaling

tough wharf
#

how wouldi go on about making it larger then?

mortal robin
#

you should size them via the rect

#

use the rect tool

#

and/or set up anchors and pivots

tough wharf
#

ah its fixed tyy

nimble orbit
#

There are a number of bugs in this screenshot that I'm being infuriated by trying to fix

#
  1. The "Display Resolution" text is not vertically centered with its dropdown despite its parent HorizontalLayoutGroup alignment being set to MiddleLeft and the correct height of the container being reported
#
  1. If you look at some of the text in the main scroll view (where the dropdowns and toggles are), you'll see that the text is cut off ever-so-slightly on the left. This is DESPITE their layout being automatically calculated by vertical layout and horizontal layout groups, and their X coordinates all being set to 0 as they should be.

This is particularly noticeable with the "UI scale" text, where it almost looks like "JI scale"

#
  1. The text in the dropdowns are misaligned compared to their highlights
#

Does anybody know what's going on?

minor oak
#

Hi everyone, I'm trying to successfully 9Slice images but I'm having trouble making it work, any help is appreciated

#

I have 9 slice set up like this atm and am trying to stretch this button... I have it set to FullRect, applied it, added a spriterenderer, set that sprite to both the spriterenderer and the actual image component, and set the image component to sliced, but it's turning out like this

#

Its simply ignoring the actual things I want to stretch, can anyone let me know what I'm doing wrong?

#

this is when I resize it

minor oak
#

okay nvm i tried it again and it suddenly is working fine now...?

mortal robin
# minor oak

Looks like you're scaling it instead of resizing it

mortal robin
zenith thunder
#

I find this really funny for some reason. The UI selection can move from the game's UI to a random prefab I happened to have open in Scene view

minor oak
#

Thank you though’

low pike
minor oak
#

Thanks for the advice

halcyon heron
#

Hey, I'm not understanding why the canvas scaler has to be matching width OR height, and why wouldn't be able to do both. Does it do that to respect proportions? You can use anchors to set the object to be proportional to the screen size (in both directions), why is there no options to do that with the canvas scaler?

#

I can't actually set one UI for all resolutions this way, if I match with width 9:16 looks wrong, if I match with height 21:9 looks wrong. Or am I supposed to set the value in script according to the aspect ratio?

mortal robin
#

The reason is when the screen stretches horizontal for example, you want a choice between it moving things and scaling things. Same for vertical.

halcyon heron
#

Tbh, I don't think there's a way to make an UI with 16:9 aspect ratio look good in 9:16 anyway, should do a custom UI entirely for that

honest saffron
#

i'd rather use transform.localscale than start messing around with the width and height

mortal robin
honest saffron
low pike
#

Not having a uniformed scale on all the UI will mess things up and not display correctly.

dense plume
#

Hi there,
I'm trying to make a UI component that's basically just a rectangle that sits inside the Rect Transform's bounds, with a material attached that renders that material, UV 0,0->1,1
I imagine I need to draw a rectangle in an 'OnRenderObject' method or something but all I'm getting is a big red 'X'

#

There are no 'DrawSquare' routines in the 'Graphics' class where I'd expect them to be- is there a higher level library that can draw shapes directly?

frosty pewter
#

Just an Image component is all you need

dense plume
#

Is an 'Image' a texture here or a material?

#

and yes, was reversed 😄

frosty pewter
#

It's a component, like I said

dense plume
#

I see it - it takes an image and a material

#

What's the image for? Is it passed on to a texture slot on the material if one exists?

low pike
#

an image component takes a sprite

#

or, can be left empty and it'll just be a square

dense plume
#

Thanks guys

median juniper
#

My UI unrounded itself, at least thats what It seems like because everything is now square. How can I go about fixing this

low pike
#

UI (when using the Image component) is only round when it has a sprite, that is round

median juniper
#

The UI has sprites which are round

#

So I find it really odd

low pike
#

then to get help you'll need to show the hierarchy, inspectors, etc

median juniper
#

Okie dokie one moment

median juniper
#

So yea the issue is that the UI for some odd reason unrounded itself. This happened after I added the discord game SDK, and I dont think that would cause it

tulip gust
#

guys, i wanna ask. how to create map in unity ? not a tilemap, cause when i search in google it's always show tilemap or minimap. i want the map can be draggable and it can be zoom in out

#

for open world games

median juniper
#

What the heck? Discord game SDK caused this issue, odd

honest saffron
deft sierra
#

whats the correct setup for in my case vertical layout group I cant get it to scroll normally, either its completely unrestricted, not scrollable at all or snaps back to starting point when what I want is scroll down to last element no matter the size

deft sierra
#

nvm everything works correctly when I use content size fitter on container itself instead of parent with scroll rect warning saying I shouldnt use it on container threw me off but it doesnt work any other way so idk

low pike
hardy rose
#

why does the ui look blurry when i render it on camera compared to overlay

devout nimbus
#
  • Whenever i put tiled/9sliced image to my canvas (screen space - camera, scale content for target resolution), it shrinks to f#cking nanometers size for idk what reason. After enlarging it remains so small that only center is seen. How to avoid it?

On screenshot, there's a comparison of the result image and a single tile of a tilemap

devout nimbus
#
  • Solved. It turns out canvas size is measured in units, not in pixels, so pixels per unit setting is different from the world
storm adder
#

i have a complex prefab for a powerup item that has moving parts and animations, and i would like to display it as part of the ui during the instructions screen so the player knows exactly what the powerup looks like. i have tried everything i could find on online forums, and nothing seems to work, it always displays behind the ui when i set it as a child of the ui object it should be placed on. is there any way to do this?

mortal robin
storm adder
#

yes indeedy

mortal robin
#

you'll need to either use a RenderTexture and RawImage with a separate camera to get it to be a real UI element

storm adder
#

interesting

mortal robin
#

Or do some tricks with screen space camera or world space canvases to physically put UI behind the object

storm adder
#

i do have a screen space camera at the moment

#

but i messed around with the positions and order in layer to no avail

mortal robin
#

then just set the plane distance farther than the object's distance to the camera

storm adder
#

ah ok lemme try that

#

thank you!

mortal robin
#

It's literally a plane in the world

#

you can see it in scene view

storm adder
#

ok it seems that may have fixed the issue

#

tysm!!!!

#

the object appeared to move along with the canvas as i increased the canvas plane distance, but at a certain point, it displayed...

#

strange behavior lmao

mortal robin
#

If so try turning off 2d mode and viewing things from the side - it should become clear what's going on.

storm adder
#

yeah i was looking at it in 3d mode

night storm
#

hey

#

why does this happen?

mortal robin
night storm
#

I did

#

It’s red

mortal robin
night storm
#

Wait

#

Did you mean by configured, the inspector?

#

@mortal robin

mortal robin
# night storm

Looks like you're using an animator - I presume the animator is changing the colors then

tribal turtle
#

How would I use masks to make only the white part invisible? I was trying but it just made the green part behind the middle white circle the only visible part.

cyan sentinel
#

so you want to mask out the green one?

tribal turtle
#

I want only the green ring showing

cyan sentinel
#

why not have a sprite with a ring then?

cyan sentinel
tribal turtle
#

I just want the green ring. I figured being able to change the proportions of the ring rather than using a pre made ring sprite would be better but idk maybe that was a bad idea

cyan sentinel
tribal turtle
#

Oh well. Thanks for the advice.

cyan sentinel
rapid ferry
#

How do I fix this happening when I set TMP to Raster Hinted? This is in a separate project from my main one which had the same issue. This happens a lot and I can't find anything on how to fix it.

rapid ferry
#

Anyone?

polar thistle
#

Hi - I'm looking for inspiration for a "your turn" animation. Requirements - the entire animation has to be about 1.5 sec (or less).

rapid ferry
#

No one?

deft sierra
#

ui channel mad dry concern

#

is there a way to scale panel but keep its initial aspect ratio other than through calculating size from screen width and height through code

deft sierra
#

ty

halcyon heron
#

Hey, I'm overriding the sorting layer of an UI element to be above another one, but the one below still catches the raycast. Is that normal? I thought the raycast hit the layer that's on the above layer. Is there a way to sort that outside of orders in the hierarchy?

mortal robin
halcyon heron
#

public class RaycastSortingLayerTest : MonoBehaviour, IPointerDownHandler
{
public void OnPointerDown(PointerEventData eventData)
{
Debug.Log(this);
}
}

#

Might be cos I'm using the new input system

#

Ok there's something really weird happening actually. If the image has a canvas and its sorting layer is overriden, the other image gets the raycast, even if it's below in the hierarchy

#

Nevermind, the object with a canvas on it doesn't even catch the raycast at all

#

Forgot to put a graphic raycaster on it, thought that was automatic 🤦‍♂️

mortal robin
lyric sinew
#

Any idea why deleting the text object of a button prevents the button from working?

#

Really confused why the text would be required for it to function

low pike
low pike
#

wrong channel, you were pointed the correct one before 🤔

tribal parcel
#

oh whoops...thought I had forgot to hit send and it didn't work...I was just in the wrong channel 😄

lyric sinew
low pike
#

I dunno, you haven't given any information for us to work it out

#

Using my magic 8 ball says, you've done something wrong

flint lava
#

how do I make sure different components don't overlap when I change the type of phone or even to an ipad?

olive lintel
#

how do I go about making text stay where it is, and not moving?

#

I got this text here, but I want it to stay there, and not move

minor oak
#

nvm got it

tulip gust
#

Guys, i wanna ask. How can i create interactive map like this? It can be set a point, pinch zoom, and draggable.

#

I already search for tutorial, but internet sugest me a minimap not a map

#

Or world map with pins

somber mortar
#

How would I check if the player is in Landscape or Portrait mode in my game I see the auto rotation in unity but it doesn't seem to scale correctly? (Yes I do anchor everything)

low pike
low pike
quaint hazel
#

My UI behaves like I want it to, but I need to update any field in the editor for it to update and go to the right place.

Any ideas on how to get over this problem ?

quaint hazel
#

Canvas.ForceUpdateCanvases(); // didnt do it

#

LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
did work

inner dagger
#

In TextMeshPro text objects, is there a way to use the <mark> tag behind the text it draws on?

#

Or a similar tag

inner dagger
#

Nevermind, I was able to find a work around. Apparently this is a feature that will eventually be added into TMP default, but that was posted by a Unity employee more than a year ago.

flint lava
#

I downloaded some assets, is there a way to fix the blurrieness for the white outline, or is that just the asset?

old egret
#

hey so i have a public tmpro and i want to set a float to be the text displayed and i followed several tutorials but when i went to assign the tmpro to the component slot, it wouldn't let me do it. Any reason why not, it says Text Mesh Pro in the grey area where you assign external things btw.

#

any reason why this isnt working

mortal robin
#

You should use TMP_Text

#

TextMeshPro is the world space version.
TextMeshProUGUI is the UI version
TMP_Text covers them both.

old egret
#

Ok

#

Thanks

lilac wing
#

Hello, I'm making my own game and I can't figure out the UI, I get it like in the picture below, but I need it like this: (3rd picture)

prisma pendant
#

what font would this be?

#

Seems some basic font but cant find exact

low pike
old egret
mortal robin
#

It's instead of TextMeshPro

sudden pawn
#

when showing characters in a typewriter-like effect and using text mesh pro in the page overflow mode, how can I check check when the typewriting effect gets to the last character of a particular page?

mortal robin
#

depends how you're doing the typewriter effect

sudden pawn
#

it increments a value every few frames, which is equal to the amount of characters that are visible, however it does not stop when it gets to the next page, so when I switch pages after waiting a few seconds after a page finished being typed, then the next one is already partly or fully typed in

#

hope that makes sense

mortal robin
sudden pawn
#

I guess knowing which character id is the last one in a current page would solve it

mortal robin
#

Do your Text objects span over multiple pages?

sudden pawn
#

yes

mortal robin
#

I wouldn't even understand how you did that 🤔

sudden pawn
#

an example of how it looks

mortal robin
#

what does it do? Scroll? How do you paginate that

sudden pawn
#

I just increment the page number, and the issue is I can't find a way to check what the id of the last character on a page is

#

so the typewriter effect just carries on regardless

sudden pawn
#

no, I mean what is the id of the last character on a page, like, if there is 10 words on page 1, and 15 on page 2, then the id of the last character of page one should be 9, and page 2 it should be 24

mortal robin
#

Yeha I know

#

I'm asking if you're using pageToDisplay to set the page

sudden pawn
#

yes

mortal robin
#

Not sure how to grab it though 🤔

#

Oh I think you have to get the TextInfo first

#

and PageInfo is a property on that

#

so it's like myText.textInfo.pageInfo

sudden pawn
#

sweet, now it does show me that needed character

#

will now check if it works with the typewriter like I hope it does

#

it seems to be working, though some numbers are off on my part, so will tinker on that for a bit

#

thank you for all the help!

whole monolith
#

guys I think this is the best place to ask my question

#

so

#

as you can see i have created a table... yet the tmp text isn't accessing it ... doesn't even see it... how do I change that?

dense crystal
#

Sorry, this is a better example -- How do I get these TMP Texts to appear on top of the images? I cannot find anywhere to access z-indexing for these.

mortal robin
dense crystal
#

Right they are each within their own cell in a grid layout, so I can't quite figure out how to get the text on top of the next grid child without messing up the grid sorting

mortal robin
#

Maybe put them in their own grid

#
  • CellGrid
  • NumberGrid
dense crystal
#

changing the sorting here to Upper Right works for example but then theyre all pushed to the right

dense crystal
mortal robin
#

Reverse the grid order is another option right?

#

You can do that, right? If you change the start corner to bottom right

#

Probably kinda weird for your inventory code...

mortal robin
dense crystal
dense crystal
whole monolith
halcyon basin
#

Quick question- is there a UI grid snapping tool in unity? or is this directly tied to the grid snap in scene view? I notice some snapping happens when two elements overlap but not with the canvas space itself. Like say i want to snap ever 2 units on a 1920x1080 is that possible?

zealous prism
#

how would i get an image in code, it seems they are not called Image?

jagged monolith
#

UnityEngine.UI.Image

#

Your IDE should tell you this if you have it set up correctlyy

low pike
#

Well, you'd have using UnityEngine.UI; at the top, and then just declare Image. But yeah, having your IDE setup correctly would auto suggest/ do this for you

dense iron
#

Hey everyone, I am looking to make a cool transition between my scenes something ismilar to the sponge bob one.
https://www.youtube.com/watch?v=I50cWpN3G7Y&ab_channel=SISIGELAP

ofcourse the theme of the game is dark etc and I will make something that suits it.
But what are your suggestions, what tools should I use?

Another Idea that I'd like is the transition "Jetpack Joyride" uses where a door closes and the reopens.

zealous prism
pastel hornet
#

Hey guys, I just started working with UI stuff in my game. For some reason every time I click something under the hierarchy of my Canvas, the Canvas borders disappears from the Scene. It makes it really hard to line stuff up. I don't see this happening in any of the tutorials I'm watching, and I dont know why this is happening! Does anyone know? I'm using Version 2021.3.15f1.

It's driving me insane

#

also I can't click on the Image under Canvas, I have to actually select the image in the Heirarchy before I can drag it around

pastel hornet
#

Nevermind I sort of figured it out, something to do with Layouts

warm moth
#

Hey! I am trying to make a wolfenstein style weapon wheel. Can anyone suggest a good tutorial to look at? I feel most of the inventory Tuts on Youtube is a drag and drop system etc

pastel mountain
#

IPointerClickHandler is not checking the clicks correctly

#

seeking for help about canvas and pointerclicks on the thread

muted shuttle
#

Container has vertical layout group, and other four buttons have an image component whose alpho is full 255 and its white, but I am unable to see any while background, this happens after adding vertical layout group in the container

#

How can I fix it?

tepid torrent
#

How do you include effects in a UI?
I am about to make a screen that appears after finishing a game.
For that I want text, objects and buttons to appear after a certen event. Just making them appear would look pretty boring so I want some animations/effect for them. (Like the text should come like a twister)
2D Game

whole monolith
#

guys I tried to put a canvas on a sprite and made it worldspace render mode, and picked up the event camera.... I PUT A BUTTON INSIDE OF IT AND THE BUTTON WOULDN'T WORK.... where is my mistake please (I put a debug and it is not showing anything because probably the button isn't being pressed)

sterile wedge
whole monolith
whole monolith
#

SO MUCH

#

I would have wasted sooooooooo long more

twin forum
#

Hello, I'm currently using TextMeshPro to render my main menu title, with a custom _FaceTex texture, and I'm wondering how I can make the texture repeat/tile instead of stretching. The m_Scale property works and scales the texture down to X amount it's size (and tiles it together) but when displaying long characters like the lowercase letter "l" the texture gets stretched, and I want to tile it instead.

#

This is how the letter displays,

#

And this is the texture (in grayscale, TMP colors the texture)

twin forum
#

Bumped, any help is appreciated

mortal robin
#

I haven't seen such an issue so maybe you can share some more details? Under what circumstances are you seeing it?

mortal robin
#

Have you added log statements? Attached the debugger? Are you sure it's not just a bug in your code? In what circumstances are those "sometimes"?

#

I think it's more likely something about your scene

#

and perhaps other objects blocking raycasts

#

Lots of games use drag functionality with no problems though

#

so there's probably some common element between the cases you've found

#

As you drag perhaps there is something blocking it during the drag

#

I suspect for OnEndDrag you need to have the raycast hitting the object as you release the button

#

so if the raycast isn't hitting as you release, then you don't get it

#

Recommend adding some more events like OnPointerExit to see if those are happening while you drag

#

I really wouldn't be surprised if that somehow screws with it

#

Basically - to diagnose the problem we'd have to be scientific about it. Start with a very simple scene and a very simple script. Then add things until we see the problem

grim fog
#

how do you make gui elements like handles appear when the transform parent of the object that the ui elements are supposed to show for is selected? Like how when you select the parent of a group of objects with colliders you can see them all.

mortal robin
grim fog
#

I think you misunderstood my question

#

im talking about dealing with transform children that have their own ui elements to draw

#

like here, where the box colliders are on the children but I can see them both by selecting the parent

#

I wanna do that for my own handles

feral pumice
#

I have a problem with the Scroll View, respectively the horizontal scrollbar: When exiting play mode, the content of the Scroll View gets shifted to the right (by 255 pixels). The shift will be undone when I change ANY value in the Scrollbar component of the horizontal scrollbar, but when entering and leaving playmode, it will be shifted again. I've tested various settings in the Scrollbar as well as the ScrollRect components, but nothing fixes it. Anyone knows a solution for this problem?

#

RectTransform of the content before

#

RectTransform after

rapid ferry
#

can panel height be increased automatically with the increase in contents

muted gazelle
#

When a an interactive world-space screen like in the picture, with realistic lighting, would you guys use a World-Space Canvas, or do I need to use a Camera in Screen-Space Camera mode and then add a rendertexture, in order to be able to have it emit light at the sides of the monitor, as well as add a CRT shader?

mortal robin
muted gazelle
#

Hell, I can't even tell in he picture

mortal robin
muted gazelle
#

Is it possible to add a CRT or screen warping shader to a canvas in world-space though? I read some conflicting info about it

muted gazelle
#

lmao, fair enough man

#

I'll use a rendertexture, thanks lad

stone flint
#

Hello everyone 🙂 I wanted to implement a button in a 3D enviroment.
Eg. Person in a room looks at around theres a computer standing with buttons on the screen.
Right now ive just seen the UI canvas Buttons and they are always in the middle of the screen of the scene -
is there already something like that that i can use in order to implement a button that can only be seen from specific angles in a 3D enviroment?

I was thinking now to create a flat capsule and use a Collider trigger to open the Link etc. But then i cant use Text Mash Pro again i think cause when i tried to put a text on the capsule it created a big canvas again and im back to having a huge 2D canvas in my 3D enviroment 😄

rancid swan
tender berry
#

What are some good examples of videogame pause menu/menu ui?

frigid cobalt
foggy heron
#

need some help
it's not very obvious from this image, but there are these strange artifacts around my TMPro fonts

#

it shows up when antialiasing is enabled

#

these are my settings

#

mostly happens with FXAA

true spade
#

my ui isnt showing up

mortal robin
true spade
#

thats not it cuz i put a random image and thats fine

mortal robin
#

you have it zoomed in right now

true spade
#

i put a random image in the ui and it showed up fine but not the red one

mortal robin
#

show the inspector for it

#

is it an Image or a SpriteRenderer?

true spade
#

and theres a slider on it but the value isnt 0

mortal robin
#

in the same place?

true spade
#

in the middle

mortal robin
#

Ok well

#

the red one is not in the middle

#

so it's getting cut off

#

like I said set scale down to 1

#

you are zoomed in

true spade
#

ohkay

#

thank u

rapid ferry
#

apparently this happens on some android devices for my game for some reason
it affects the normal weight text but not the bold text
there aren't any difference in the text materials other than the bold has 0.1 a thickness outline
anyone have any idea why this could be happening?

low pike
warm moth
#

Hey!

I would love to get some advice on making a MGS style inventory. I am not to worried about populating the inventory with pictures or text. I would just like to know how to do the UI.
The thing throwing me off is the scrolling of the item and having the bottom most corner item be the one that is selected . How would I go about making an equip slot like that?

Some images for reference:

rapid ferry
low pike
#

all parent objects at a scale of 1,1,1?

#

The canvas won't be.. but that one is ok

rapid ferry
#

oh actually they do set their scale automatically depending on the orthographic size of the camera

#

so they do scale up and down

low pike
#

scale or font size

rapid ferry
#

scale

low pike
#

scale should always be 1,1,1 for UI anyway, but TMP can mess up when it's below 1

#

It's been ages since I had it happen, can't remember how far below 1 it starts messing up

rapid ferry
#

weird, seems like it's fine for most people

#

but how would i scale UI with camera size then?

#

so ui elements don't get super big or small

low pike
#

canvas scalar component on the same gameobject as the canvas

rapid ferry
#

change the pixels per unit or what?

low pike
#

The reference res there is just what my designer used.. can be anything

rapid ferry
#

that just ends up scaling the canvas, so either way it ends up scaling, is the canvas better to scale still?

#

and i don't know how i would translate the zoom into pixels like that

low pike
#

You might want to match with width not height.. I dunno, gotta play with it

#

the canvas scale changing is fine, it's the elements below that should be 1,1,1

rapid ferry
#

gotcha ty

honest saffron
novel arrow
#

does anyone reccomend any UI asset ?

#

mobile ui*

rapid ferry
novel arrow
#

how can i make this 3d mesh always on top , it get hidden by other gameobject that have sprites in them

mortal robin
#

UI elements should use the Image component to display sprites, not SpriteRenderer

novel arrow
novel arrow
#

The parallax effevt work by scrolling the sprite then duplicating it . When it duplicate it hides my 3d mesh

mortal robin
mortal robin
#

and don't make it part of your canvas

novel arrow
novel arrow
ebon storm
#

Does anyone have experience with interacting with World Space Canvas?

mortal robin
# novel arrow Its not

I can see from your screenshot that it has a RectTransform which would only happen if you made it a child of a canvas

ionic wharf
#

I'm usinga gridLayoutGroup
Is possible to make the chidren in the center?
The last square are in the left, but I want get in the center

sterile wedge
#

so a Grid layout group, with only one column, and each row made up of a horizontal layout group that is centered

low pike
#

What are the options for "Constraint"? As it's set to a fixed column count, that might be forcing it to the left.. try changing that

ionic wharf
#

But not have a option to center it :/

low pike
#

What are the options? Did you try anything else? Or just see there's no 'center' and give up? 😄

ionic wharf
#

I'm trying, but only have this option (I'll send an image)

low pike
#

and did you try 'Flexible' ....?

ionic wharf
#

I'm doing something wrong?

low pike
#

Nope, you'll have to do what @sterile wedge said

near folio
#

I have a canvas in overlay mode with the scaler set to "Constant Physical Size" and pixels per unit set to 16. I have a sprite with a pixels per unit of 16. Under the canvas, I have an Image which uses that sprite as its source image.

When I click "Set Native Size" it acts as though the reference pixels per unit on the Canvas Scaler is 12, not 16: The sprite is scaled down 75% from where it should be. I cannot figure out why this is happening. It happens in a completely new project as well.

Unity 2021.3.16f1, created from the 3D template (built-in renderer). The canvas was created in SampleScene.

Edit: This seems to be caused by Canvas.referencePixelsPerUnit being set to 12. You can manipulate this by changing "Default Sprite DPI" on the canvas scaler. If it is set to 72, then the reference pixels per unit is correctly set to 16. Why is this? 72 doesn't exist in any setting I can find...

Edit 2: 72 comes from the definition of a point; there are 72 points per inch. Shouldn't the "Default Sprite DPI" default to 72 then? Why does it default to 96, causing sprites to be scaled by 0.75?

Edit 3: In trying to solve this problem, I was going after the wrong issue. You need to set the default sprite dpi so that a pixel is scaled to the physical size that you want it at. It doesn’t need to be 72 pixels in one inch.
I’m leaving this here in case it helps someone else in the future. Sorry for the confused question!

waxen fiber
#

Assets\TextMesh Pro\Examples & Extras\Scripts\Benchmark01_UGUI.cs(79,32): error CS1061: 'Text' does not contain a definition for 'font' and no accessible extension method 'font' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?) Getting this error with textmeshpro

mortal robin
waxen fiber
#

That worked

#

Thanks!

gloomy zephyr
#

How can I get ride of the Black Outline on all the cornors?

#

Ping me when you respond

maiden sinew
#

I have made a scroll rect with layaout group and content sizer fitter everything works fine when I enough content but when I have only one or two the content is in the middle not at the top as I want.

#

How can I fix it

#

Ping me when you respond

crude valve
#

How do i scale Ui elemenets from one side only like u can do in blender with vertices? the 4 blue dots, i cant seem to active them

mortal robin
#

resize them with the rect tool and/or anchors/pivots etc

rapid ferry
#

That has nothing to do with ui or ux, leave @jaunty lark

rapid ferry
#

If it’s just a one off simple question like that

#

But no, I’m not a mod

abstract dragon
#

Hello, I have one World Canvas in scene into which I want to insert health bar to every enemy in scene. Health bar is created as Prefab (root is panel nad childs are hearts as image). For every enemy I am inserting this prefab health bar to created World Canvas, but panel rect transform lost link to prefab rect transform. Is there any possibility to keep this link? Thank you! 🙂

humble bluff
#

What does ux mean?

rapid ferry
dull loom
#

hey i need some help. the ui seems to be interfering with a box collider, when i try to click the box collider it does not register. does anybody know a fix?

#

nvm

inland cobalt
#

Hello, everyone!
I have a question!

how to make something similar to the picture?

Is it a toggle group? or should I just put buttons with images?

muted shuttle
#

How can I make UI animation faster?