#📲┃ui-ux

1 messages · Page 20 of 1

kindred stag
#

I mean, I can fix it by adding a little manual padding in the GetPropertyHeight override, but I would think there should be a way to compensate for that needed space that I'm overlooking.

mortal robin
#

I don't know of any other way

nimble orbit
#

Is there something wrong with my TextMeshPro markup here

#

It's generated by script

#

Identical text, but in the first case, everything from the - /home/ritchie is white as it should be

#

but in the second case it's red

#
┌─[<b><color=#CE0000>root</b></color>@<b><color=#CECE00>ritchie-pc</b></color> (<i><color=#CECE00>Admin</i></color>) - /home/ritchie] - [%d %t]
└─<b><color=#FF0000> #</b><color=#000000></color>

┌─[<b><color=#CE0000>root</b></color>@<b><color=#CECE00>ritchie-pc</b></color> (<i><color=#CECE00>Admin</i></color>) - /home/ritchie] - [%d %t]
└─<b><color=#FF0000> #</b><color=#000000></color>

This is the markup that's generated

#

They LOOK identical

#

Is it that I'm closing <color> tags before closing <b> tags?

#

Why is it affecting the second prompt but not the first?

#

Hmmmm... deleted more of the markup at the start. Ended up with this.

<color=#FF0000> #</b><color=#000000></color>

┌─[<b><color=#CE0000>root</b></color>@<b><color=#CECE00>ritchie-pc</b></color> (<i><color=#CECE00>Admin</i></color>) - /home/ritchie] - <[%d %t]
└─<b><color=#FF0000> #</b><color=#000000></color>
frosty pewter
#

At the end you are opening a color tag and not closing it

#

<color=#FF0000> #</b><color=#000000></color>

nimble orbit
#

Soon as I delete that very first < there, the incorrectly red text goes white

#

could it be an issue with the code?

frosty pewter
#

As I said, you are just not closing a tag and so it remains open and flows over to the next paragraph

nimble orbit
#

I know. I was trying to grab the actual code and see if I can get a second pair of eyes on it but ideavim's being annoying rn

undone spindle
#

How do I make a button like this ?

mortal robin
undone spindle
unique token
#

Why is it so weird?
I set up the anchors and put 0 in the margins

#

the text for some reason is much further to the left than the left drag bar

#

ok nvm there is an extra margin down in tmp and it was set for some reason

ripe pelican
#

Hey, guys! I have a small issue. I have a GameObject for my Pause Menu Screen and when I click the resume button to deactivate this game object my resume button color stays the same and not turning back to its normal color. I will send you a screenshot

#

It stays like that when I click it and open it again it stays grey

#

its normal color is black

low pike
#

Yes, a screenshot displays a colour change problem well thinksmart

#

it's probably because clicking on a button selects it, and it remains selected

#

click off and it'll go to some other colour

ripe pelican
#

There is no any option to disable it

#

Selected color goes white

#

@low pike

low pike
ripe pelican
#

I mean there is no option to disable selected color

low pike
#

So set it the same as the colour you want it to be..

ripe pelican
#

You said to click off how?

low pike
#

click anywhere that isn't the button 😄

ripe pelican
#

So the problem is with my OnPointerEnter

low pike
#

no?

ripe pelican
#

When my cursor touching those elements it turns grey

#

It is not a question

#

I know

low pike
#

because of the Hovered colour..

ripe pelican
#

I ve made that thats why I am telling you that

#

So, when I touch with cursor mouse those button I have a OnPointerEnter method

#

I did it to turn it grey color

low pike
#

so have you got an OnPointerExit method to change it back?

ripe pelican
#

I will show you a video

#

Oh

#

OnPointerExit

#

Do I have to add that at the same button?

low pike
#

Where else would you add it?

ripe pelican
#

My OnPointerEnter method actually does that check

#

I play a clip whenever my mouse cursor entering the UI elements

low pike
#

...yes, and?

ripe pelican
#

This has nothing to do with that issue

low pike
#

that doesn't touch the colour

ripe pelican
#

I know

#

Give me a minute to try OnPointerExit

#

So, actually I have to make a method like I did here called OnPointerExit

#

So, I have to make a method which will turn the selected color back to default right?

#

It will be OnPointerExit for example

#

What do you think?

low pike
#

No.

#

You're not using OnPointerEnter to change the colour, so there's no point doing it in OnPointerExit either.

#

Just deal with the colour changes in the one place - which is wherever that's changing it now - I assume on the button component

ripe pelican
#

I am using EventTrigger and I have there the OnPointerEnter() and on that method I have the code that I show you.

#

Yes you are ture

#

true

low pike
ripe pelican
#

So, whats happening I am confused XD

#

Something happening with button colors but I am not sure

#

I have tried to make some changes to all of them

#

but didn't fix the problem

#

A guy told me yesterday to do something with the Interactable option in code like Button mybutton; mybutton.Interactable(false);
What do you think?

#

I think that the problem is coming from my different game states

#

I am like 90% sure that the problem comes from it

#

Because when I am interacting with the escape button to disable my pause screen game object after that the color button isn't turning.

#

@low pike Hey! You were correct when I am clicking somewhere else then everything is fine but it seems to me like a bug how to fix it?

low pike
#

It is not a bug

ripe pelican
#

Can I make a thread to join me?

swift basin
#

I want to do the typical effect where a Sprite gets progresively filled with a clockwise pattern; like you know, skill CDs in a lot of games. I am assuming that's just a multiplicative mask on top of the spritez but how do I actually make it follow that clockwise pattern?

mortal robin
oblique pewter
#

What does tab view look like when its tabs cannot fin the screen

stoic nacelle
#

I'm trying to implement a heart system into my game. Full hearts worked fine, but adding quarter hearts has lead to a bug where every time you are hit, your health gets set to 1.25/3 hearts.

public void subtractHealth(int healthSubtracted)
{
    playerHealth -= healthSubtracted;
    int index = 0;  // Variable to keep track of the index
    foreach (GameObject heart in hearts)
    {
        Image image = heart.GetComponent<Image>();
        if (index >= playerHealth / 4)
        {
            image.sprite = heartSprites[0];
            Debug.Log(heart + "set to empty.");
    }
        else if (index <= playerHealth / 4 && index %4!=0)
        {
            image.sprite = heartSprites[index%4];
            Debug.Log(heart + "set to 1/" + index%4 + ".");
    }
    else
        {
            image.sprite = heartSprites[4];
            Debug.Log(heart + "set to full.");
        }
    index++;
    }
}

Let me know if additional information is needed.

thin creek
#

Hey, I have a little problem with my dropdown menu, i got that dropdown with the viewport behind my others options
I tried to use another layer for the dropdown, and put it above the UI layer, but still not working, does anyone know a solution for that pls? :p

(edit : my fault the problem appears only in scene mode (idk why)

winged goblet
#

how do i get rid of that audio symbol?

mortal robin
#

disable it from the gizmos menu

winged goblet
#

👍

supple basalt
#

I don't like this action prompt. I'm trying to nail down why.

#

I guess it should be offset from the actual object.

#

and maybe it should have a little bit of padding? the box is very tight.

mortal robin
#

is the grey box part of it?

supple basalt
#

Yes, that's part of the popup

#

maybe just go borderless?

mortal robin
#

I feel like the box shouldn't be there at all? And definitely offset the whole thing, and perhaps make it a little transparent?

supple basalt
#

okay, let me try that..

#

that definitely works better

#

i should really make an actual texture for the lever so that it doesn't look like a blob of scrap metal

#

I previously had it so that a line was drawn from the popup to the thing you could actually interact with

#

that was in world-space and I ditched it because it was getting horrifically mangled by post-processing

supple basalt
low pike
supple basalt
#

That does look nicer as well.

low pike
#

Give it about 5? pixels more space on the right - so that the space is the same as the left

supple basalt
#

oh yeah, the action icon has excess padding on it

low pike
#

Padding! That's the word I was looking for

supple basalt
#

That's going to be unpredictable because some of these icons are all square

low pike
#

should be able to make it work dynamically with layout groups

supple basalt
#

so the mouse has some blank space on the sides

#

I should probably just adjust the sprites so that they're all tight

low pike
#

that A+circle is too large

supple basalt
#

it doesn't really look like an A button, does it

#

it's just kind of an A

low pike
#

it gets the point across

supple basalt
#

hmm, I'll have to tweak the action icons

low pike
#

but.. have you seen the pack of these Kenney is working on/ released?

supple basalt
#

no, I haven't!

low pike
supple basalt
#

ooh, very pretty

low pike
supple basalt
#

get outta heeeeere

#

that's cool

#

ooh, actual keyboard icons too

#

i've just been writing the button name into a text element and getting

#

acceptable results

low pike
#

I did that too, with a square around 'em

#

and < > v ^ for arrows 😄

#

or did I do v upside down for ^

supple basalt
#

oh right, I can just scale the entire icon object down to 0.8

low pike
#

loverly

supple basalt
#

i'll make the icon fill in when you actually perform the action, and have the box grow a little too

#

anyway, thanks! time for a break :p

low pike
#

Break? It's bedtime!

sly totem
#

Hello! Does anyone know why my LineRenderer would render in front of the UI text?

#

My UI text is TextMesh Pro, and the LineRenderer is used to create a sine wave design element for the background, but it renders above the text. The Canvas is on a sorting layer above the wave sorting layer, still no effect.

#

The LineRenderer is used to create that ugly pink wave that obscures the text.

mortal robin
#

Assuming your Canvas is Screen Space - Camera, the line renderer is simply physically in front of the UI plane

sly totem
#

Ahhh, silly ChatGPT told me it was the Sorting Layers.

#

Yes, the Canvas is set to Screen Space - Camera

#

How do I fix this, move the LineRenderer object back in Z axis?

mortal robin
#

Setting to Overlay or changing the Plane Distance

#

Or moving the LR

sly totem
#

I think it's at 0 in Z.

#

Let me try, if this works you have no idea how much headache you relieved me of!!

#

It's working! Firstly my camera was in Perspective for some reason, it should be Ortho. Secondly the canvas is at 90 in Z axis and I can't move it - it's created by Doozy UI Manager. So I set the LineRenderer to render at Z = 100, and it worked!

#

Thank you so much, you have no idea how much headache this gave me.

tall gulch
#

I have a problem: I want to scale a designed button to any scale, but even watching this video https://www.youtube.com/watch?v=_-9MrJfbysM it still looks like this:

Ever had your UI bend, stretch and distort? Not anymore!! In this video I'm going to show you how to create and set up your UI elements to scale perfectly everytime!

Join me and learn your way through the Unity Game Engine, the C# language and the Visual Studio editor. Remember, if this video was useful then DROP A LIKE! 👍

💬 Join the Discor...

▶ Play video
#

When someone nows why this is the case, just write @tall gulch

tall gulch
#

Is there a way to use the Sprite Renderer as an Ui element?

#

because an Ui image, can't use the image and sprite renderer component

mortal robin
#

In UI you use the UI Image component

#

SpriteRenderer is not for UI

tall gulch
#

well it is working with the sprite renderer but not with the image component

mortal robin
#

what's not working

#

show what you tried

tall gulch
#

Image component

#

Sprite Renderer

mortal robin
tall gulch
mortal robin
#

or maybe your UI has scaled parent objects or something?

tall gulch
#

Well now I used a simple 16x16 png and sliced it, the upper one Image Type: Sliced, the lower one Simple

rapid ferry
#

Quick question. If I have a canvas with one panel and an image inside, how can I move the image behind the panel? There seems to only be a sorting layer option in the canvas itself, but not for the image?

mortal robin
#

lower in hierarchy == drawn on top

#

Also a "panel" is also just an Image

rapid ferry
low pike
#

an image component requires a sprite assigned to it

wheat thunder
#

Hello! I need help with TMPro please

Im using a korean font as well as a Japanese and chinese font, I want the TMPro fallback to work well when the characters aren't available in one font, to go fetch in another
But I can't seem to understand it, also my fonts can appear blurry at times

past monolith
#

Heya, I'm pulling my hair right now.
I'm working on making a scroll view.
I have a panel with a width of 320px and height of 500.

Then inside the panel, I create a scroll view (from the UI menu), removed the horizontal (need only the vertical)
Also unchecked Horizontal from the scroll view component.

Then, inside my Content object, I attached a Grid layout group and put a bunch of buttons in there.

Everything looks good until I start the game. The scrollbar doesn't appear, I can "scroll" but it comes back to the initial position
I also cannot see the scroll bar

#

I followed step by step a video tutorial and literally do the same thing they do and yet here I am

austere nest
#

i think the scrollbar only appears when there are enough items there to scroll

past monolith
#

Yeah there are more than what you see on the screenshot

#

I however realised that the height of the container doesn't increase with the number of items

#

Is there a way to have a flexible height so that it takes whatever space the items take?

austere nest
#

lemme check how i did it on my project

past monolith
#

If I increase the height of the content to left say 800 (instead of 500) then the scrollbar appears but it's manual

austere nest
#

do you have a content size fitter component?

past monolith
#

I don't, no. I'm quite new to unity, still learning the components

#

Let me try it

#

Ahh yes! That's perfect!

#

Thank you!!

austere nest
#

👍

swift basin
#

A quicky here, how do I create different materials for the same text in TextMeshPro?

#

Like I can create a copy of the material from the assets, but I don't know how to change it

#

Shouldn't it be in Material Preset? Cause it doesn't let me change it

noble idol
#

is the button collider scaled wrong?

quick falcon
#

I'm using PowerQuest's engine, the dev said 'Maybe you've got some weird setting with your unity sprite atlas. If you're not using unity 2020 it could be something im not aware of. I'm at a loss though how it'd get that broken'

normal dirge
#

I have a canvas with some buttons and sliders and toggles on. The buttons can be pressed and do work, but for some reason I can't click on or drag the sliders, and I can't use the toggles either.

All of them are interactable with the raycast target ticked. They aren't covered by UI elements. I have an event system with a (InputSystemUIModule) which is on default settings.

I've exhaused all the issues I could think of so I came here for some help with this

gritty cloak
#

i put a custom cursor in my game. it appears in the editor but not in the build. this is the warning but i cand find the things it wants me to do.

gritty cloak
normal dirge
#

Here is the menu

#

The match timer up/down buttons work but nothing else does

gritty cloak
#

also that menu looks cool asf

gritty cloak
ionic beacon
#

...the texture type?

gritty cloak
#

to what?

ionic beacon
#

Have a look at the options and make a guess

gritty cloak
#

my pc is not on right now

#

can you just tell me

ionic beacon
#

Come back when your PC is on if you still can't figure it out

supple warren
#

i just updated my editor from unity 2020.3.30f1 to 2022.3.19.f1 and everything seems to be working alright except for one specific canvas that doesnt render its ui elements properly. I havent changed the code in anyway and what ui element that doesnt show is random everytime i play. Sometimes it looks normal, sometimes the background dissapears, sometimes the button dissapears, its just random. Im not getting any errors related to my ui and this is pretty much the only problem i have after the upgrade. Any help is appreciated.(Left post upgrade, right before upgrade).

tulip gust
#

man idk if i'm the right place but how do i compress texture in GLB file, it cannot be separated

normal dirge
normal dirge
tawdry ferry
#

Hello, is there any way to make an object inside of the Layout Group move freely inside of it? Or maybe any alternative to achieve the same behavior?

mortal robin
tawdry ferry
#

is there any other way for the logic to stay the same and make it move freely just on the y axis?

mortal robin
#

It's either part of the layout or it isn't

winged goblet
#

how do i make these options in the dropdown larger? like the same size as the first bit

mortal robin
winged goblet
#

do i need to download some custom designs or am i able to customize it somewhat in the editor

oblique pewter
#

Should i just use UIMGUI instead of UI-TOOLKIT

#

Due to the lack of documentation and resources

#

(eg everything online is for IMGUI)

#

(and i cant find many issues for ui-toolkit specific components)

#

If so, how can i create a RecyclerView / ListView using IMGUI

oblique pewter
#

Yes but not a lot of tutorials on how to do specific things or why specific things happen

daring orbit
#

Hello, I have a problem with unity 2022.3.19f1 and 2022.3.18f1, when I select any element within the Canvas, it becomes smaller for some reason, also, when I enter play mode any element that I add to the Canvas starts flashing strangely.

winged goblet
#

when im using my dropdown, the scrolling between the options is really slow, how do i increase it?

median iris
#

Did you google it?
Google says you want to increase the scroll sensitivity on the ScrollRect that's on the Template 🤔

oblique pewter
#

IMGUI objects can be instantiated and constructed in a background thread right ?

#

eg to avoid the ui pausing while a large complex ui gets instantiated at runtime

magic walrus
#

i have these items showing in the inventory with a scrollrect, and theres a mask hiding the items at the bottom of the list not in the viewport. i have that bottom area there with the gray box where i want to be able to drag items into it, but when im dragging down there its outside the mask so the item isnt seen. how can i set it up so the mask is working for the inventory, but allows the player to drag an item someplace outside it?

#

i was thinking i could change the parent but not sure if there's another or better way to do it

soft sail
#

could be its own canvas group too so you can just override sorting

#

much like how you would do tooltips

honest saffron
#

compare its recttransform bounds coordinates to the screen bounds

simple drift
#

Hello everyone! Does anybody have any idea why changing my res in the editor makes my menu buttons invisible? Like, they are still in the good position and I can hover over them but i can't see them anymore

simple drift
cinder pier
#

my tmpro gets blurry when my overlay canvas scales downs to fit the camera. Is there any way around. Would changing the canvas scaler be ideal?

meager quartz
#

My games inventory functions very similar to minecrafts cause every other inventory system just feels so wrong to use, probably after 10+ years of that game

I wonder what i can do with the inventory gui to distinguish it thinker

cinder pier
long shell
#

Hey, I was hoping someone could help me out with dynamically adjusting buttons for text size?

  • I have a UI canvas with a child panel
  • The panel contains several child buttons
  • Each button contains text that will be updated as the user presses said buttons

The issue is sometimes the text goes past the border of the buttons
I tried following this tutorial: https://discussions.unity.com/t/fitting-a-parent-ui-element-to-a-child-texts-content/160492
But it just made things worse as now the buttons are going outside the panel

Here's what I mean:

ripe pelican
#

Hey, guys! I have a small issue with my canvas elements here. So, like you see my reset button isn't set up properly. Do you know why this happening?

mortal robin
#

i.e. how do you want it to work?

ripe pelican
#

I was playing with the anchors I am setting up canvas elements right now and something happened and my buttons got expanded I did not scale anything

#

I change also for one time my game view

#

Also, I got trouble with my resolutions settings and canvas when I change to some specific resolution it doesn't set the resolution propely as a result to cut off some ui elements

mortal robin
#

Or rather maybe you've chosen a bad canvas scaling mode

#

they appear to be anchored to the center and are simply too large for this resolution

ripe pelican
#

I solve the issue with the buttons it was very simple btw I had to change the width value of the buttons and thought that I changed something different now about the ui elements I don't know why this is happening when I change resolution and like I said it's happening to some of the resolutions

mortal robin
ripe pelican
#

@mortal robin Hey! I test it and like I see i have some small issues with some of my ui elements when changing to some resolutions like my score which is shown at the top left for some resolutions, when I change to other resolutions for example 640x480 it is for one reason on another position like a little bit below.

supple basalt
#
  • Response List <-- ContentSizeFitter, VerticalLayoutGroup
    • Response <-- VerticalLayoutGroup
      • Text
    • Response <-- VerticalLayoutGroup
      • Text
    • Response <-- VerticalLayoutGroup
      • Text

All of the vertical layout groups should be set to control child size, and to not force-expand the child.

#

Each VerticalLayoutGroup will ask its children how much space they want, then ask for the appropriate amount of space to fit them.

#

They then set the child sizes based on how much was asked for.

#

The top level group doesn't have a parent, but it does have a ContentSizeFitter.

#

vitally, ContentSizeFitter belongs nowhere else

#

It's used because you don't have a parent layout group changing your own size

#

If you don't have layout groups on the "Response" objects, then they won't ask for any space to fit their child Text object

#

so everything will get overlapped

long shell
# supple basalt Content Size Fitter should be used if your object is not parented to another Rec...

Oh that actually worked like a charm, thank you so much
I do have one other question if that's ok:
If the buttons are childs of an image (like the black one shown in my screenshot), and I set the image to use Preferred size vertically and horizontally in the content size fitter then the buttons inside just end up really long and force all the text on a single line which is difficult to read and the image doesn't even make it all the way for the buttons, it only expands a little bit

But if I leave horizontal as unconstrained and just do preferred size for vertical then the buttons look fine/readable but the big image doesn't expand to fit behind them properly

Is there a reason that happens or is it just not able to work like that?

supple basalt
#

Do preferred size for both. Add a LayoutElement to each text object and assign a preferred width.

#

That will override the preferred width from the text component

#

Although, in the second case you mentioned, I’d expect the buttons to get squished horizontally to fit in the parent. Maybe they have a minimum width from their image

long shell
#

Hmm ok thank you, I tried that solution and it seemed to work but I think overall if the text is expanding it looks better without the black image behind so I'll just hide the black image and keep the solution you initially provided
Thank you so much for all your help!

supple basalt
#

np!

oblique pewter
#

Hi

#

how expensive would GameObject be for heavy complex ui's

mild kernel
#

Anything in your scene is a GameObject , even UI.

#

How can anyone answer that question?

oblique pewter
#

guess no one has used unity for any complex ui's

mild kernel
#

If you say so

oblique pewter
#

-_-

#

im not talking about fancy ui's with pretty animations

#

im talking about ui's with hundreds or thousands of game objects composing the ui itself

mild kernel
#

In what scenario would you need hundreds or thousands of GO's visible at the same time for UI?

#

Obviously you would be disabling canvases and object pooling things for scroll rects, if you had any wish to be doing "complex UI's".

meager quartz
#

any other ideas for inventory i should sort out thinker
(besides making actual sprites and focusing on visuals)

so far i can think of-
fix the number display height so picking up an item doesnt look shit
hold right click to drag across inventory slots
give some sort of indicator when you pick up items besides the pickup noise (i'm thinking text that shows up in the bottom right of the screen and says +1 (itemname) when you pick something up...

#

So far i've implemented basic inventory functionality, equipment slots that can only equip certain item types, and a hover GUI sprite thats also usable on floor items

round spade
#

hey guys Im using a text to show my game score but the canvas white borders are showing when playing the game i cant move the canvas so how do i remove its borders from user perspective ?

low pike
#

show a screenshot of your issue

#

@round spade

round spade
#

YES WAIT

#

sry aps

#

sry caps*

#

HERE

mortal robin
#

These will never be visible in a build anyway

round spade
#

oh ok thanks

olive sage
#

Wait

#

Is this channel for, UI help?

low pike
#

Not the editor UI though

round spade
#

yeah

olive sage
#

Guys, does this UI need improvements

honest saffron
olive sage
#

This is the final product basically

#

I'm worried, UI sucks and looks boring.

honest saffron
olive sage
#

Hoi hoi hoi, What would you improve in this picture?

honest saffron
olive sage
#

The arrow(triangle) represents a box

#

Well maybe i need to add icons to those coins and bolts

honest saffron
olive sage
#

I have a hard thought on this one

#

If i will add icons

#

it means i have to move the logo little to the right

honest saffron
#

remove car and move logo down so its centered vertically idk if that woud look good

olive sage
#

That's uh what im avoiding to do.. somehow

#

to feel like you're in the garage

#

Maybe something like this would work

#

Of course this one is a joke, but hopefully will clear out some things for the user

meager quartz
#

dont know if this is just a for fun game / quick project or something thats meant to be professional
but yeah the UI feels very unprofessional which i think immediently puts people off

It looks like you spent months and months on a game and then do the visuals of the UI in 1 hour

tawdry ferry
#

My String Field keeps on resizing every time I move my mouse. It has a Horizontal Layout Group and everything works fine if it doesn't have TMP_InputField on it. The text on both images is the same. Any ideas?

hollow quail
#

why i can't interact with the button?
I found the problem and it is the Cursor.lockState = CursorLockMode.Locked;

But how do i make it works even with this line of code?

icy dome
#

Any advice how i can fix this? It sticks with a wrong react transform.
The parent is an empty Gameobject. Could be the version though...

mortal robin
#

What does "It sticks with a wrong react transform." mean?

balmy abyss
#

Anyone know how to make a toggleable indicator for color. (e.g. if button 1 is pressed change indicator for that button to a different color. if a new button is pressed reset indicator 1 image and change indicator 2 image to different color)

floral pebble
#

any suggestions of how to make the board to look better?

mortal robin
icy dome
mortal robin
#

The Reference Resolution is just that - a reference.

trim forge
#

Does anyone know why adding a material to this image turns it red? I tried physically pulling apart the shader by seperating the RGBA into a vector 3 but it did nothing

#

but the base image is just black and white with transparency

trim forge
icy dome
mortal robin
trim forge
#

that's exactly what I was doing with a sprite unlit shader but it's turning red

mortal robin
#

nvm you did

mortal robin
trim forge
#

yeah this is what it's suipposed to look like

#

I noticed on changing the render mode to screen space camera it does work however it is then being effected by my depth of field settings which is sub optimal

sly totem
#

Nooby question - I want something to happen (for example load next scene) when the user clicks anywhere on the screen as opposed to on a specific button. How can you do that? I'm trying to make something like a "Click to continue" button, but the whole screen is the button.

mortal robin
sly totem
#

Hmmm, didn't think of that. Thanks.

#

I guess I could have just a plain text somewhere on the screen say "Click to continue..." and then an invis button that covers the whole screen do the action.

#

That's sneaky sneaky!!!

ripe pelican
#

Hey, guys! What does this mean?

mortal robin
#

based on your anchor and other settings on the RT

ripe pelican
#

Hey, guys! I have a small issue. My transform axis moved somewhere else on my scene and I don't know how to move them wherever is my game object? Check that

#

So, when I am selecting a game object i have to zoom out in order to move it because those axis moved somewhere far away from the objects and that's happening for all objects when I am clicking them and selecting the move tool

mortal robin
#

You can change it in the dropdown or press Z

ripe pelican
#

It isn't that it is like at the same place and when I am moving something it only movees the object rather than the object and itself

#

It stucks at the same place

#

Can you make a thread?

#

Don't make a thread I closed Unity Editor and open it again so it fixed

balmy abyss
mortal robin
#

it doesn't have to be on the same object

balmy abyss
mortal robin
balmy abyss
cyan pivot
#

Text Mesh Pro, just updated - 3.0.7
Component or Script "text mesh pro input field" missing from unity for anyone else?

cyan pivot
#

(I just went back to 3.0.6 to fix this but still would be cool to know if anyone knows)

golden stump
#

How do you make a panel or background fit the text inside (which has its own content fitter)

low pike
#

you'll need to tick the right things on the layout group, can't remember which off the top of my head

golden stump
#

yeah I thought something like that but they seem to ignore child size and it shows warning about content size fitter under layout group

plucky gulch
#

how can I make a text stretch only as much as it needs vertically ?
i want some other UI element to be always right above it , whatever the height is

golden stump
#

ContentSizeFitter on text with preferred size scales the Rect to fit

tropic umbra
#

I really want to use Coherent Prysm, it looks great
but I have to contact them to get access, and it seems like they're not very indie-friendly

#

i mean i might just use noesis+noesis studio but prysm lets you use animate CC (flash)

tribal turtle
random pond
#

Can someone tell me why the Scene UI element positioning is different from the one in the Game view?

meager quartz
#

Thoughts on the colour scheme?
I feel like i keep coming back to this.

Items are color coded based on rarity, but so are increases to stats...
which can lead to some items have very ugly GUIS (such as archers ring) where the colors clash

meager quartz
versed swallow
#

How do you all do your UI animations? For example, motion graphics inside your game. I'm using tweens and a generalized script to achieve it but for some reason I feel like what I'm doing is a hack and not the proper way to do it. If anyone is willing to share their approach to doing motion graphics for UI in Unity, I would be very delighted. Thanks beforehand.

low pike
#

DOTween

versed swallow
# low pike DOTween

For everything right? I also use the same approach but I prefab everything and try to capsulate everything I can because it gets messy really quickly. I also worry about the performance impact because of all the same UI-Image components copy pastes to create the motion graphics

low pike
#

Yep, I'm not an animator.. find it easier/ better to do it with DOTween than anything else

#

I have an animate component, with the various required fields

versed swallow
#

I'm not trying "interrogate" by the way now that I read it it may come off like that but thats not it, I feel like the more animations I add to the same canvas the more confusing it becomes, so I must be doing something wrong is what I feel like

versed swallow
low pike
#

I feel like the more animations I add to the same canvas the more confusing it becomes

depends on the animations, UI anims should be (mostly) there for information, not thrown in just because

versed swallow
#

think of it like on off animations in my case. lots of size controls to create interesting effects which then fades out

low pike
#

ignoring transitions between screens

versed swallow
#

I think the best comparison would be like notifications on an android phone. It happens then it fades out

low pike
versed swallow
#

gotcha, its similar to what I done but mine is shittier haha

low pike
#

I have this component, which is the only component that listens to the Unity Button events, so I can do fades/ audio/ etc without worrying about the button disappearing before the anim/ sound has finished

versed swallow
#

I think its best if I create a generalized library at this point, now that I know that others also use a similar approach

#

Much thanks for the responses!

low pike
versed swallow
#

oki I got you now, I misunderstood

#

yeah I also had a similar problem, I think I solved it by adding a delay to deactivate after the animation secs, but that was a hack on my part, this seems way better

#

Honestly speaking I was very close to making the animations in After Effects, exporting and then using it on Unity but that also seems like a pretty shitty solution

low pike
#

It's not shitty, it'll allow you to have much nicer animations

#

All I do/ need are basic resize/ move/ rotate type things

versed swallow
#

I need to think more before deciding on an approach, thanks again mate :))

wooden geyser
#

I wanted to make a little introduction screen for a boss, but some UI elements are below some sprites in the scene. Does anyone know how to change that?

swift basin
#

I have noticed that while at full screen in Game mode (but doesn't need to be actually running so is not script related), if I tab, the interface moves slighty, like it is resizing even though the screen size is not changing at all; I can not be sure of what's actually happening cause it only happens at full screen and I cannot check the inspector casue as soon as I exit full screen it resets back; is this normal? Is something wrong in my interface setup or what?

tropic umbra
rapid ferry
#

How do i get the buttons Navigation Functionality without having a button / Selectable component

tawdry ferry
#

I have created an input field that changes its width according to the its input.
InputField has a script that assigns its text to InputField's parent Text which has Horizontal Layout Group component to control InputField's width.
Now the problem is that this InputField doesn't get enough space for caret. So caret GameObject that's then Instantiated in Text Area in TMP_InputField script is shifted to the left when user's caret is at the end of the text, because of the lack in space.
Is there any way to fix it?

thin creek
#

Hey, i have a little question, I saw a few tutorials, that's has a canvas using screen space - camera, as rendering mode. And with that, they can rotate the canvas, to make something like this (found on CodeMonkey video)
In its video, there's a script called "Canvas3D" attached to canvas, however nobody explains it, does anyone know something about that ?

mortal robin
thin creek
#

I didn't find anything on its library, :/ i looked into it

mortal robin
#

It just looks like a world space canvas from the picture

thin creek
#

Yeah that could be a world space, but i have the project, and it's not

#

look

mortal robin
#

Looks like you have the script there

thin creek
#

that's actually weird xD

#

yeah, i downloaded the project, but the script is not on

#

he deleted from it

#

i opened it up, but it's written "missing reference (Monobehaviour script)"

mortal robin
#

What are you actually trying to do or learn here

thin creek
#

Rotating the canvas in 3D space, to have something like on the video x)

#

Because i really want this in my game, for others things

mortal robin
#

Just use a world space canvas 🤔

thin creek
#

We can still raycast it?

#

i mean, with mouse or controller ?

mortal robin
#

Of course

#

As long as you set it up properly

thin creek
#

oh ok, i will try xd

#

yeah sure

mortal robin
#

Event camera etc

thin creek
#

i'm gonna try, thx

#

That works perfectly

supple basalt
#

I have some UI prefabs that can be used in both vertical and horizontal UIs.

So far, I've just removed the horizontal layout groups and replaced them with vertical layout groups when needed.

Is there a nicer way to do this? I guess I could just put both components on and have a toggle that switches which one is enabled..

#

I also have to switch which axis has flexible width, so it does look like I'll need to script it

#

oh, right, you can't have two layout groups on an object at once

solemn hedge
#

when I deactivate and activate a part of my UI the music in my main menu restarts and plays twice, even though it is not a part of either UI... anyone know how to fix it?

mortal robin
#

and/or settings on the audio source(s)

solemn hedge
#

theres no code, just enabling and disabling UI through the button

#

settings for my audio source is here

mortal robin
mortal robin
# solemn hedge

this has "Play on Awake" on so it will probably play every time you activate the object

solemn hedge
#

as i said before, i never activate that audoo source, except for when it starts

#

it is not part of the other UI

mortal robin
#

Show the main menu object that you're activating

#

or rather

#

the "part of the ui" that you're activating

#

what scripts are on it

#

(also gotta show the button on click config)

solemn hedge
#

this is what im activating

#

this is the music

mortal robin
solemn hedge
#

and the butto

mortal robin
#

Presumably GAMESTART and/or some of the dozens of other objects in that hierarchy have scripts on them

solemn hedge
#

yes but they dont interfere with the music

mortal robin
#

that you know of

#

it's clearly happening when you activate those objects

solemn hedge
#

you were right, the environment had the song on it aswell

supple basalt
#

both horizontal and vertical layout groups both derive from HorizontalOrVerticalLayoutGroup

#

It'll get more complicated if I want to be able to adjust which side the spacing goes on

#

but that's a "future me" problem

gritty cloak
#

i have a massive problem. all of my ui from this scene has suddenly dissapeared. other scenes are fine but this one is just gone. ive never had this problem. last night i was copy pasting the project folder to a usb and canceled the proccess a couple of times if that helps

#

here is a vid, its 50mb so discord wont let me upload it here

#

also all of the y values are NaN for some reason

#

not only the Ys, some others as well

tropic umbra
#

anyone have a good video tutorial series on Noesis? I haven't found that much documentation for creating custom themes and such for example... trying to replicate a persona style ui in my game and i think noesis is what i want to use now

#

I want for example to make an inventory list where each item has an image and number next to it

#

they have samples available but it's not very beginner friendly for someone who has never used XAML

tropic umbra
#

I tried contacting Coherent Labs btw, they said Prysm isn't available for individuals and only for companies

#

i thought it would make sense if they offered at least a trial

random pond
#

Hey everyone!
Can someone tell me why in the following main menu UI layout the windows build is screwing things up?

  • Screenshot #1 Unity Editor (1920x1080 FHD) - looking fine
  • Screenshot #2 macOS Build (2560x1600) - I disabled native resolution so it's forcing 1920x1080 here
  • Screenshot #3 Windows Build - The display is in fact (1920x1080) FHD but for some reason the only one that is rendering the UI wrong

I just can't figure out what I am doing wrong. How come that the only true resolution (windows) is not able to render the UI as expected (by the unity editor) ?

placid garden
#

Hi, I currently have a system where I have these game modifiers with +/- buttons on each one that appears when the modifier is selected. The +/- buttons are enabled and disabled via:

    public override void OnSelect(BaseEventData eventData)
    {
        base.OnSelect(eventData);
        increaseButton.gameObject.SetActive(true);
        decreaseButton.gameObject.SetActive(true);
    }

    public override void OnDeselect(BaseEventData eventData)
    {
        base.OnDeselect(eventData);
        increaseButton.gameObject.SetActive(false);
        decreaseButton.gameObject.SetActive(false);
    }

on the script of the modifier prefab.

Visually this works, but for some reasons I cant click the buttons anymore when I could before I implemented this code, does anyone know why?

#

Everything such as raycast target, event systems etc are set up since the buttons work if I comment out the code I have pasted above

#

Even more odd, if I leave the buttons enabled, they work! But then when I deselect their parent and reselect it, the buttons dont work when they appear

#

Ive changed the code to ``` private void Update()
{
if (currentSelectionState is not SelectionState.Normal)
{
increaseButton.gameObject.SetActive(true);
decreaseButton.gameObject.SetActive(true);
}
else
{
increaseButton.gameObject.SetActive(false);
decreaseButton.gameObject.SetActive(false);
}

}``` and it works now, but Im not sure why. Id rather it be nice and event based but whatever
swift basin
#

I have this thing as an Slider, and I want the fill part to have the same inclination as the bar's shape, instead of the usual squareshaped mask that the slider does by default when on filed mode; I am guessing, I should be using some kind of mask component, but not sure how

#

This is the effect I would want, so... I am guessing I should have some kinda of inclined mask? Literally no idea of how to do this

rapid ferry
#

How can i fade a canvasgroups children as if they are 1 flattened png

#

right now i get this blending

#

funny enough godot’s canvasgroup does this and its the exact behaviour im trying to replicate

timber elbow
#

Maybe you could bake the overlapping text into an image to avoid that issue.

rapid ferry
rapid ferry
#

Yes that’s what i think, baking the text into a rawimage element

#

but this involves separate cameras, render textures, higher cpu from regenerating the images

#

and ruining the entire scene hierarchy

#

to make my ui

#

same issue

timber elbow
#

Perhaps no one made a suggestion to unity and just kept on using the "terrible hack".🤷‍♂️

#

That being said, perhaps it works differently with ui toolkit/builder.

rapid ferry
#

I tried and it doesn’t

#

It has to do with Unity being 3d rendering engine even in 2D

rapid ferry
#

i need to fix this

#

for 2 years

#

i tried

#

and its why i cant use this engine

#

because of this

#

in ui

#

the rendertexture approaches makes render thread take 0.4ms on an empty project rather than 0.1ms with the simplest possible setup

#

4x worse performance

#

with a 256x256 render texture to render a camera to

rapid ferry
#

fuck this engine

soft sail
#

I think you're hard-stuck with additive alpha values since you can't really touch the UI shader, so perhaps using render objects and discard similar pixel values could be an idea

soft sail
#

no, render objects

rapid ferry
#

ive never heard of those

soft sail
#

pipeline feature

rapid ferry
#

it would be nice to just have a component i can attach to a ui object that would make it, and all its children fade as 1

#

i would pay someone or be eternally grateful for whoever makes that

#

it could do whatever render object magic behind the scenes

rapid ferry
sonic frost
#

It's endlessly frustrating that layout groups seem to disregard Layout Element's Preferred Height completely

tender berry
#

Hi, does anyone know of a way to make a billboarding shader for a world-space UI element?

sharp ravine
#

Hey guys, what should I do for users; should I have one button to register/login or 2 separate buttons?

low pike
#

2 obviously, they take you to separate screens

hollow quail
#

how do i make my world space text ui affected by light?

icy silo
#

Anyone having issues with an inventory UI looking fine in the Scene window, but when you play it is blown up by 300% and covers your screen? Unsure what it is I am doing wrong.

austere nest
#

check your anchoring

mortal robin
icy silo
#

Sure enough, it was the anchoring, sorry I hadnt messaged earlier, i hadnt seen this. Appreciate it guys 🙂

sonic narwhal
#

Hi, quick question. I am using TMP text MaxVisableCharacters to display a string like an old console, and am using linked overflow to split the string into 2 TMP text objects. Is there a way to get the string length of each individual part of the split string? When I do text.length, they both just display the length of the entire string.

thin creek
#

Hey, i got a little problem in UI. I have a grid layout group, to display some information like this : (sorry it's in french)
However, i want the background to fit with the number of brown rectangles. For example i want it to be like this :
Does anyone have a solution please? 🥺

lyric linden
#

hey, I have the problem that my player disappears behind the background and I can't get it in front of the background. I've tried a lot

lyric linden
#

yes

austere nest
#

thats why

#

UI will always be rendered on top

lyric linden
austere nest
#

make the BG a sprite

lyric linden
#

then I need a sprite renderer?

austere nest
#

ye

lyric linden
#

Do I have to delete the image?

low pike
#

SpriteRenderer for the game elements.
Canvas (UI) for UI elements.

lyric linden
#

Now I see the players in the scene window but no longer see the background in the game window

low pike
#

Don't mix game elements with UI in the hierarchy either.

Tidy this up and then fix the transform values for the background..

midnight coral
low pike
#

show the inspector for HP_FILL

lyric linden
low pike
lyric linden
midnight coral
#

ok i just found out it was the image part where i should actually set the image type to fill.

lyric linden
#

However, the main camera is now completely different; it feels like it only points to one point

low pike
#

A canvas, is HUGE, because it's using screenspace, so you've got your camera focussed on the UI.

The game, which you've got circled down there for your camera.. is the size of your game elements

#

You can't see your background because all you did was change it to a SpriteRenderer and didn't reposition and resize it

lyric linden
#

i tried to resize it

low pike
#

it's not hard

#

I think you need to get onto !learn and do some UI and 2d tutorials

onyx flowerBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

onyx flowerBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

low pike
#

Use content size fitters to resize elements to their children

rapid ferry
#

For some reason when trying to place a textmeshpro component on this one specific prefab it makes the text blurry

#

any ideas?

sharp furnace
#

with UIElements slider, is there any way for me to have the normal slider with "showInputField" turned on, and have that inputfield not be limited by the sliders minmax? I want the slider to have reasonable limits, but allow the user to go higher than the slider can go by manually typing in a value into the inputfield

supple basalt
#

okay, so you'll now want to inspect these elements while the game is running

#

check the actual size of the various children of "Classic Skin 1"

wispy osprey
#

They're set to Stretch 0 0 0 0

#

(except Swatch and BG which are inset a bit)

supple basalt
#

And if you select them while the game is running, do the scene view gizmos show that their size is what you expect?

#

(i.e. mostly filling the box)

wispy osprey
#

Yeah their sizes are showing the same whilst the game is running

supple basalt
#

Show me the inspector for the object that's got the material you're changing the color of.

wispy osprey
supple basalt
#

That object is behind its three siblings

wispy osprey
#

It's the UI Primary material that's being updated but isn't changing on those elements in the layout

#

Yeah it's still not changing, even when I've disabled those other layers

#

Those two plain green boxes in the middle row are set up with the other layers disabled as a demo

supple basalt
#

ah, you're changing the outline, I see

#

I was thinking you were changing the "Swatch" object

wispy osprey
#

Ah nah

#

Just the green

supple basalt
#

Does deactivating and activating the Outline object do anything? What about switching the material in the inspector while the game is running?

wispy osprey
#

Oh interesting idea. All other objects using that material change to whatever changes I make in the picker, but not the elements in the layout

supple basalt
#

Deactivate the mask (just the mask component) on the Viewport. Does anything change?

wispy osprey
#

Shit. Yeah deactivating the mask changed it.

supple basalt
#

Exciting. Your material is playing poorly with the mask, then

#

I'm not sure why that'd be the case...

#

Oooooh

wispy osprey
#

I wonder if disabling then immediately re-enabling the mask would force a refresh?

supple basalt
#

Those materials aren't the same, I bet!

#

Try double clicking on the material while in play mode

#

I think it instantiated your material when you put it under a mask

#

That explains why it broke in play mode

wispy osprey
#

ohhhh

supple basalt
#

A pretty easy fix here would be to use global shader properties

#

assuming this is a custom shader, at least

wispy osprey
#

I'm completely new to this, I'm not even sure what a shader is to be honest

supple basalt
#

ah, then probably not :p

#

the shader is the program the material runs to fill in pixels

#

you can define properties when you write a shader. these can be specific to the material, or they can be global

#

hm, so lemme think about how I'd solve this..

wispy osprey
#

Oh I see. Yeah this material is using UI/Default for its shader

supple basalt
#

One idea would be to make a new Image class

#

call it ThemedImage

#

it'll be pretty simple

#
public class ThemedImage : Image {
  public static Color primaryColor;

  protected override void Update() {
    color = primaryColor;
  }
}
#

then just set ThemedImage.primaryColor to control the color of all of the themed images

#

This sets the tint color of the image.

#

So the material should just be white.

#

The Image graphic multiplies the tint with the color that the shader produces

supple basalt
supple basalt
#

also, whoops, there's no Update method to override

#
public class ThemedImage : UnityEngine.UI.Image {
  public static Color primaryColor;

  void Update() {
    color = primaryColor;
  }
}
wispy osprey
#

And this script gets added to the objects using that material?

supple basalt
#

You'd completely replace the Image component with this

#

This component does everything an Image does. It also grabs primaryColor every frame and sets its tint color with it.

wispy osprey
#

Is that resource intensive?

supple basalt
#

Maybe if you had tons of these images

wispy osprey
#

This has been really helpful! Thanks so much for all your time and patience Fen. Is there anything I can do to say thanks? I'm not sure if tips are something that happens here

supple basalt
#

thanks is all I'm lookign for, ha 😁

#

i got to leran a new weird thing too

wispy osprey
#

Aww cheers man

supple basalt
#
public class ThemedImage : UnityEngine.UI.Image
{
    public static void SetColor(Color color)
    {
        OnSetPrimaryColor?.Invoke(color);
    }

    public static event System.Action<Color> OnSetPrimaryColor;

    protected override void Awake()
    {
        base.Awake();

        if (Application.isPlaying)
            OnSetPrimaryColor += DoSetColor;
    }

    protected override void OnDestroy()
    {
        base.OnDestroy();

        if (Application.isPlaying)
            OnSetPrimaryColor -= DoSetColor;
    }

    void DoSetColor(Color color)
    {
        this.color = color;
    }
}
#

you'd do ThemedImage.SetColor(...) to update everyone

#

I'm a little unsure about that Awake method. Graphic classes are marked with [ExecuteAlways]

#

That's how they can update themselves even outside of play mode

wispy osprey
#

This might be a daft question, but is there not just a function I can execute once when I change the material that'll select these elements and change the colour?

supple basalt
#

unity created a new one that's been modified to handle the mask correctly

#

I don't know if they all get unique materials, or if it's one shared material

wispy osprey
#

Ah I see, gotcha. I'll give this a whirl. Thanks so much again!

surreal aspen
#

Eh can someone help me fix this UI issue, In test its fine like the Placement and stuff But IN game build its not in the right place.First Image is in test second image is in game

devout mist
#

Is there a way to make canvas gameobject's height grow/shrink based on TextMeshProUGui's content?

Tree:

Canvas
 > GameObjectThatIWantToResize
 > > TextMeshProUGui
devout mist
#

Guhhhh, looks like I can't have children with AspectRatioFitter under VerticalLayoutGroup as well.
I can't have VerticalLayoutGroup with contents that has different aspect ratio.

surreal aspen
#

How can I like Keep the positions of the Mag text and Ammo Text as on screen size changes they move about!

surreal aspen
jagged monolith
# surreal aspen thats the Center middle part correct?

Here's a tutorial https://youtu.be/w3sMD-3OJro

Something a lot of new developers struggle with but it's actually really simple! In this video I'll show you the basics of getting to grips with the UI anchors and scaling options inside of Unity!

Join me and learn your way through the Unity Game Engine, the C# language and the Visual Studio editor. Remember, if this video was useful then DROP ...

▶ Play video
surreal aspen
#

ty

mortal robin
quartz whale
low pike
#

change it to overlay

quartz whale
#

thank you

low pike
#

that's what it is on by default

fair iris
#

hello i have a problem. i dont know why but i cant see my array elements in more depth, its intended to just open down and see the variables :(

low pike
#

this channel is for UGUI, not the editor UI

#

But, what type is the array?

fair iris
#

its a custom serializable class

fair iris
low pike
fair iris
#

yes

low pike
#

share that class !code

onyx flowerBOT
fair iris
low pike
#

You don't have any fields in that class, nothing will show in the inspector

#

Those three things at the top are called properties which don't get displayed in the inspector

fair iris
#

im thinking that the { get; set; } causing the problem

low pike
#

it's not a problem, that's a getter/setter... which is called a property. They don't show in the inspector

fair iris
#

solved it thanks!

gritty cloak
#

i tried their methods to fix it but none of them worked

gritty cloak
#

im probably gonna give up on my project if i dont find a solution for this

surreal aspen
#

How can I set them to be anchored in same place for all devices

Completely new to UI and stuff in Unity and in general

mortal robin
#

Same place could mean:

  • same distance from center
  • same distance from top
  • same distance from left
  • same absolute pixel position,
    Etc
surreal aspen
#

like right now its here

#

if resize it auto changes them to be in pos

mortal robin
#

Without showing the RectTransform settings this doesn't really show anything

surreal aspen
#

Ah its fixed I dont know what happen it snaps to the right pos on all types of size of screens

meager quartz
#

inventory layout mockup
any glaring issues?

I also want to have consumable slots somewhere but idk where to put them in the inventory thats not ugly

gritty cloak
meager quartz
#

Im thinking of replacing the top right and bottom right inventory slots with the sort inventory button and the trash slot... but i worry it will be easy to forget its a trash slot and delete something accidentally if its in inside the inventory

mental edge
#

Need some help, my content wont expand when files are added

low pike
#

Use layout groups (Vertical/ horizontal) and content size fitters

livid furnace
#

Been following the Game Maker Toolkit Beginner Tutorial and at 29:00 I was struggling to get the text to look how he had it. The text is extremely large and blury despite this being a 1080p screen. Camera Size is 20. Video tutorial in question is:

https://youtu.be/XtQMytORBmM?si=5b80VX2TcEYexyLW&t=1740

🔴 Get bonus content by supporting Game Maker’s Toolkit - https://gamemakerstoolkit.com/support/ 🔴

Unity is an amazingly powerful game engine - but it can be hard to learn. Especially if you find tutorials hard to follow and prefer to learn by doing. If that sounds like you then this tutorial will get you acquainted with the basics - and then gi...

▶ Play video
ionic beacon
#

That's normal for the scene view. How does it look like in the game view?

livid furnace
#

Oh is it. Let me check one sec

#

Doesn't seem to show up

ionic beacon
#

Show a screenshot

#

also it looks exactly same in the video

#

just keep following it

livid furnace
#

Guess I'll keep going with it. Just the text resolution looked concerning

livid furnace
#

Yeah definitely seems broken. According to his guide, it should show up. I may just work off of the new text object if this one keeps bugging

solemn pivot
#

question about TMP and UI and text - all of these text assets are size 10 in unity but seem way bigger than what I expect from size 10, how/what/where/why is this the case and how do I fix it 'the right way'?
I ask the right way because I could 'fix' it by scaling assets willynilly but I assume there is a more correct way to fix it?

#

ah my reference resolution was 300x400 is what the main cause appears to have been

#

after changing it to a larger res it behaves more as expected

wispy osprey
supple basalt
#

Or do you have to do that every time you update the colors?

wispy osprey
#

scrollMask.enabled = false; //Call colour change function scrollMask.enabled = true;

#

Every time yeah

supple basalt
#

the former would be very mysterious

#

oops, wrong reply

supple basalt
#

I was pulling up the TMP docs to figure out which of the many, many units TMP is using for font size

#

there are a lot of them

#

points, picas, em, en, ...

wispy osprey
#

I don't suppose anyone knows how to change the colour of a shared font material? Really struggling with this one.
textMeshPro.faceColor = newColour changes the specific text object's colour successfully, but doesn't change the shared material's colour (I'm assuming the text uses an instance)

wispy osprey
#

Figured it out. My shader had a "_Face Colour" property so I used that

copper patio
#

given the following simple UI scene. my gamepad controller is able to go between the two buttons using explicit navigation. but when i click the blue area using a mouse, my focus is now lost on the 2 buttons and I cannot regain control of the buttons using a controller. (like say its on PC and someone accidently using the mouse clicks off, even if it sounds unlikely). How do you handle these situations. I thought about making a giant button in the blue area that explicity navigates 'back' to the buttons, but didnt know if there was a better way or something that doesn't feel so 'hacky'

#

I wrote this script to tell me what I am focusing on, and without a button on the blue background it tells me 'no element is focused' when i click the blue area

solemn pivot
#

question about 'confirming' an input field. Currently when you hit enter, it calls the End Edit method, but it also calls this same method when you click off from the text field
I am using bog standard stock input actions, why does hitting enter 'confirm'? Like I know that enter should confirm because thats just how computers work, but I am trying to make a text field that only confirms when I want it to confirm

mortal robin
#

that is set to the enter key by default (and possibly other things too)

#

The input module is attaached to the Event System GameObject

solemn pivot
mortal robin
#

you don't need to dig around in the source code

solemn pivot
mortal robin
solemn pivot
#

the reason being I was having problems with input issues related to virtual cursors and their behaviour in regards to the ui 🤔

#

ill try using an input thing again here because I dont remember why exactly I wasnt using it and try to use it's submit action

#

until whatever bug was stopping me before reappears (or doesnt)

#

Thanks for the help

#

hm im immediately realizing I don't know how to hook into 'when submit is pressed and this specific text field is selected'

#

but I think that is an input system question not a ui ux?

#

What dictates what field is selected in the Unity UI? Can I poll that info somewhere?

#

obiously selecting something by clicking on it selects it but this is all being handled by UI backend stuff by unity, I didnt manually code any of that

mortal robin
solemn pivot
#

Okay I will do googling and research into the event system, ive never used it before, to me its just a thing that exists in scenes

solemn pivot
#

Okay, this has all I think I need. Thanks this is a big help.
I was already using IPointerEnterHandler, IPointerExitHandler to show tooltips, I didnt realize this was also the event system ( did it from a tutorial)

#

Ill set up a test script that impliments ISubmitHandler

solemn pivot
#

Hmm I noticed a quirk of it. When you hit enter to send, it completes the field you are typing, but doesn't send.
When you then hit enter a second time, it sends

#

While this is technically correct, its not the preferable behaviour UnityChanThink

#

someone will have faced this before me, Ill google the handler

#

hm im seeing more people with getting it sent twice than needing to press enter twice, but it looks like the people getting it twice are because theyre using the on end edit which is getting called when you deselect

#

same problem im facing from the other direction

#

oh no these people are just messing up context.started and context.canceled type stuff

#

I cant think of any way that isnt some ugly broken hack to do this UnityChanThink involving like bools and sending it twice and trying to filter out the duplicate

#

i dont think I could even hack it to work because I have no way to tell if I hit submit or if I deselected the field

#

ill keep googling, not sure how to fix this

mortal robin
#

I'm sure there's a way but I don't know it 😆

solemn pivot
#

Ill call it here and try again tomorrow

#

because im starting to get distressed

thick sorrel
#

I have issues with a ui button not working, couldn't find solutions online that fixed it. Anyone willing to help?

low pike
#

it helps to give details about your setup and show us, so we don't have to just guess or take you through it ... you're much more likely to get help that way

thick sorrel
#

I have this inside Canvas

low pike
#

show the entire hierarchy, you've cut off stuff that is useful information

thick sorrel
#

The arrows aren't working, but the buttons in the middle are

low pike
#

show the inspectors for those buttons, and the scene view

thick sorrel
#

The canvas in the scene, and the entire hierarchy or just the canvas?

#

Oh and the script is on the scroll frame with the buttons referenced

#

I only added EventSystem after a tutorial did, but not sure what it's there for or how to use it

low pike
#

The EventSystem is required to make the UI interactable, which is why I asked for the hierarchy screenshot - so I could see if you had one

#

You don't have to do anything extra with it

thick sorrel
#

oh ok, that's good then

low pike
#

Press T to change to the UI gizmos.
Press the 2d button in the scene view.
And send another screenshot of the scene view.

thick sorrel
low pike
thick sorrel
#

Like this?

low pike
#

No

thick sorrel
#

oh

low pike
#

because they're still below , not above, and now no longer siblings

thick sorrel
low pike
#

Kind of.. that will do what I wanted, but it's not what I meant

#

BuildMenu

  • UpArrow
  • DownArrow
  • ScrollFrame
thick sorrel
#

Is this good?

low pike
#

yes

#

try now

thick sorrel
#

nope

#

still don't do anything

low pike
#

Change it back to how you had it

thick sorrel
#

outside of buildmenu?

low pike
thick sorrel
#

Ok done

low pike
#

see if the buttons work then.. that should confirm if anything is on top blocking the arrows

thick sorrel
#

oh I did that in play

low pike
#

thats fine

thick sorrel
#

Still nothing

low pike
thick sorrel
#

The selected scrollframe

#

oh I moved the arrows back too in play

low pike
#

let's see the code

thick sorrel
low pike
#

That's all wrong

#

and doesn't look like you've got your VS setup correctly

#

!vs

onyx flowerBOT
#
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

thick sorrel
#

I just changed it now, is this correct?

low pike
#

you'll know because the colours in VS will be different, it'll say c-sharp assembly, and you'll have red lines under your errors

thick sorrel
#

It's not opening at all

low pike
#

prob missed something in the guide

thick sorrel
#

I can't find a option called Editor Attaching

low pike
#

IIRC, that's the option that was removed - I can't see it in the guides though, can you show me

thick sorrel
low pike
#

Read the start of that line

thick sorrel
#

oh

#

But the other thing only have 1 step and I did it and showed it to you?

low pike
#

there's more than one step

#

well.. maybe, how did you install VS

thick sorrel
low pike
#

which link are you on

#

!vs

onyx flowerBOT
#
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

thick sorrel
#

Installed via unity hub

#

I had to admin confirm the installer for visual studio when I installed unity

#

So I feel like it's through unity hub

low pike
#

So you SHOULD have the stuff that's mentioned above it

#

Have you restarted both Unity and VS?

thick sorrel
#

I haven't I'll do that

#

Still doesn't work

low pike
#

Dunno then, I haven't had to set it up in years.. ask for help in #💻┃code-beginner to see if someone there knows what you've missed

thick sorrel
#

Just got off class and packed my setup I'll do it when I get home and set up again

low pike
#

Did your code come from a tutorial ?

thick sorrel
#

Unity documentation

low pike
#

After you've got VS setup correctly, it'd be a good idea to re-read that doc page 😉

thick sorrel
#

I searched for UI click something and first result was something with OnClick from unity

#

I copied everything from there

#

And changed it with Up and down arrow of course

low pike
#

I'm pretty sure you didn't copy some of it correctly

#

don't suppose you have that page to hand ?

low pike
#

yeah, you copied the declaring of variable incorrectly from that page

thick sorrel
#

Oh

low pike
#

GameObject doesn't have any of the Button events (shock horror!), so if your VS was setup correctly, that line in your Start() method would be shouting at you with a red underline

thick sorrel
#

I'm used to Roblox, Game objects by default inherent events and "components" onto them

#

I'll be home in 30 mins ca.

thick sorrel
#

It's taking the buttons now from the gameobjects

#

It's still not working though

toxic pasture
#

guys why i cant generate font?

jaunty turret
jaunty turret
# thick sorrel

you're still missing something probably, do you have a canvas raycaster thingy on your canvas?

#

or graphics raycaster

#

dont know what it's called

thick sorrel
#

Where from do I add that?

jaunty turret
#

on the canvas the buttons are on

thick sorrel
jaunty turret
#

should work by default

#

still no events?

thick sorrel
#

Still nothing

jaunty turret
#

could try to tick off "ignore reversed graphics"

#

but if that works that would mean your ui is flipped

#

or has negative scale... which is the same I guess

thick sorrel
#

Still nothing...

jaunty turret
#

is it active?

#

and is the script active?

thick sorrel
#

On the ScrollFrame as highlighted here

#

It is active

#

Start & Update runs and can do Debug.Log(); just fine

jaunty turret
#

weirrrrd

#

out of curiosity, what happens if you add the method using the editor? if you select a button it allows you to bind it to a method @thick sorrel

#

don't have to script the listening part

thick sorrel
#

So like this thing?

jaunty turret
#

yeah

#

that onclick

#

you can add your method there too

#

press the + and find your script

#

if that does not work then I'm clueless

thick sorrel
#

I think I found it, but it can't see the function

jaunty turret
#

find your method, you may have to make it public

#

it should have the same name as in the script

thick sorrel
jaunty turret
#

yeah the taskonvlick

thick sorrel
jaunty turret
#

that should do it

#

does it work?

thick sorrel
#

nope

jaunty turret
thick sorrel
#

Yes XD

jaunty turret
#

welp

#

idk xD

thick sorrel
#

In fact I keep forgetting to go out of play, but I try to make sure all my changes are done in edit when I realize

jaunty turret
#

yeah that can be annoying starting out

#

well if you still have no solution by tomorrow you could send me the project, I'm not at home today

thick sorrel
#

alrighty

jaunty turret
#

could take a look why it does not do what it obviously should

thick sorrel
#

I saw a debug tutorial video thing

#

And it has this eventsystem debug menu

#

But I can't find where to open it

glass kernel
#

in unity i see this, but when i try to put on my phone i dont see the black background all in the square

#

this is on phone

sudden pawn
glass kernel
#

give me a second to open the prohect

sudden pawn
#

and how does the rect transform component of the black background look like?

toxic pasture
sudden pawn
#

ye

#

click on this, and select the bottom-right option

#

as that will allow your image to stretch

glass kernel
#

like this?

sudden pawn
#

nah, further bottom right

glass kernel
#

oh not the bottom right option, the option at bottom right

#

sorry my fault

#

ok, what this changed?

sudden pawn
#

now change these values to "0", as those say how many pixels away from each side of the screen your image will stretch to

glass kernel
#

oh perfect, so its perfectly in now?

toxic pasture
#

uhhh why

sudden pawn
glass kernel
toxic pasture
#

did you ping wrong people?

glass kernel
toxic pasture
sudden pawn
#

Got a weird issue with GUI:
I'm trying to make a debug console with a bit of autocompleting text, but whenever anything gets added to the prediction list, it autoselects all text, which then makes whatever next letter I use replace the previous letter instead of being a new one
What could be the cause of it or what would be a good way to force unity to not select the text when it happens?
https://pastebin.com/qri9jG6a

glass kernel
toxic pasture
#

oh alright

#

weird
it worked perfectly

sudden pawn
glass kernel
low pike
# thick sorrel

This will only do anything for the UP arrow, and as the scrollview starts at the top, it has nowhere to go when you click the uparrow, so you don't see anything happening.

low pike
thick sorrel
hasty mango
#

question, I'm going to start diving into menu navigation with a gamepad. Few questions:

To help prevent reinventing the wheel, is it common to use the "Input System UI Input Module" component?
If I were to use that does that mean I need to use it with buttons only? reason I ask is tutorials that I'm watching/learning involving inventory systems typically create the slots using empty gameobjects.

...start with that for now

inland obsidian
#

You're slots are buttons? You click them to add or remove an item for example?

hasty mango
#

someone in another channel mentioned the attached pic which as you all know is part of that genre of nav system which is native to use buttons, sliders, etc. However 99% of the tutorial videos out there that involve inventory systems create a grid of "slots" which are more or less square gameobjects

#

I'm afraid they are not buttons

inland obsidian
#

Then please explain your slots ^^ What are they and what do they do

hasty mango
#

here's a visual AA

inland obsidian
#

And you want to highlight one slot after another using a gamepad?

#

Like horizontally and vertically?

hasty mango
#

xactly

inland obsidian
#

Then replace them by UI buttons, make their parent a Grid Layout, determine your desired spacing, and you have the system out of the box without the need of any code

hasty mango
#

I do have the parent grid layout in place. So I need to ask, why do most of the videos do this style of using gameobjects instead of i suppose adding the button component to them?

inland obsidian
#

All buttons are game objects

hasty mango
#

also most also tend to use a mouse pointer to determine the click

#

so more or less I can simply add the button component to my existing gameObjects which are the slots now, right?

#

hate to say it so painfully obvious 🙂

#

I'll give it a shot, thanks AA

hasty mango
#

Here's an odd one. I'm accustomed to gameobjects in the hierarchy being drawn overtop of ones which are lower in the hierarchy tree.

Why does this rule not apply for gameobjects which have the TextMeshPro component [on a canvas]?

#

Is there something special about objects on a canvas having different rules on hierarchy order? Thanks!

solemn pivot
hasty mango
#

yeah

solemn pivot
#

it totally ignores stuff like z value depth and blindly draws top to bottom in my experience, if you want a sprite cursor for example to overlap all, it has to be the bottommost thing in hierarchy

hasty mango
#

it's basically opposite of non-canvas isn't it