#📲┃ui-ux
1 messages · Page 35 of 1
@brisk monolith I think you should use this interfaces: IBeginDragHandler IEndDragHandler ; there is one of examples: https://docs.unity3d.com/Packages/com.unity.ugui@2.0/api/UnityEngine.EventSystems.IDragHandler.html
I figured that out, I was mainly wondering about the being part of a layout group thing and such, but by now I got it already. Thanks for the reply tho, appreciate it ^^
Cannot interact with pause menu even tho I have attacked bahaviours on click
I can't even see/move my cursor
I could go over to the button, but it has no effect when I click the button
- Any errors in console?
- What kind of canvas is this?
- Does the canvas have a graphic Raycaster?
- Is there an event system in the scene with an appropriate input module?
If you can't see your cursor you have likely locked or hidden it in your code
The answer is to unlock it when you're in the menu
- No errors
- Overlay
- idk
- I just made an event system, now checking
- You should check
Yes there is
But yeah you said your mouse is not visible
So
..
yea, this
but still uninteractable
Wdym
I could move my cursor but when I click on the buttons still no response
You might simply have other UI stuff blocking it
it's the only UI I have currently
Your heirarchy looks weird
Like the canvas is a child of the player or something?
That's quite odd, I would fix that
Fixed, the problem still remains
do I need to call to enable the event manager
(the input map i mean)
Are the buttons even visually reacting to your mouse?
nope
no hover reactions
Make a new scene. Put an event system in it, then copy your pause menu into it
See if it works there
If so, the issue is with something in the real scene blocking it
nope
not working still
no hovers and stuff
ignore the error, it's only for disabling player input of the game
seems like there's something wrong with the setup
is it because it's a prefab?
moving here on the recommendations of others. I'm trying to create a widget that is a row and is a 1/3 2/3 split. I currently have everything almost perfect except for the entire row trying to be 100 tall instead of fitting to the content in NameContainer and ValueContainer. Is there a default place the 100 is being set that I need to explicitly override? https://pastebin.com/TRnC1xrK
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
there's nothing else in the scene, seems like that's it
building the game results in the UI not working in the built game, but works fine in the editor 
if there is, it'll be really hard to tell. Go into play mode and check what the event system thinks the pointer is over. Do you have nested canvases?
you should show the whole UI structure
not sure how to do that
Entire structure
are there nested canvases? What's on Pause and PauseMenu?
1 nested canvas (Button Container nested within PauseMenu)
Pause has the control script whilst PauseMenu is a Canvas
https://paste.mod.gg/ztvhcluxetcb/0 the script is in here
A tool for sharing your source code with the world!
does your nested canvas also have a GraphicRaycaster?
yep
key note that there's no hover behaviour
create a new scene containing only your UI (I suggest convert it into a prefab temporarily) and test it there to eliminate other possibilities. Are you using the new or old input system?
signs are pointing to something wrong with your raycaster, things being on the wrong layer, targets not being raycastable, or interference from something else
I tried it, and the buttons will still not work, I'm using the new input system
should I make a new mapping?
did you modify the default one? maybe it's time to break out the input debugger if they don't work in a clean scene
nope, but I did use a different mapping
maybe that's the issue
I just tried
did not work
tried remaking the buttons
did not work
seems like a script issue, the cursor could not interact with the ui at all
unless you're talking about some kind of bug in the ui system, that sounds exactly backwards
if you messed with or are not using the default input asset, you need to work backwards to figure out what you broke exactly
Ight
Question: timescale 0 doesn't affect UI right?
if they have animators it does
well, I don't
I'm just gonna make the UI from scratch in another scene and port it over
ok I just did this and it still didn't work despite it working in another scene
Alright I think I found the problem
when I disable the player altogether it works
it doesn't have a render scene however
do we have single toggle group that can enable multiple selection? or similar built in features?
If mutliple Toggle selection, then don't use ToggleGroup
guys big money question, is it possible to have:
- a vertical layout group
└──an element with a flexible height (that element is a scrollrect)
└──the scroll rect content (that is also a vertical layout group)
^^right now I'm getting stuck on this point, no matter what I try to do this element is basically either the size of the parent element if i stretch it to fill the parent, or it is centered within the parent with basically 0 height
the only solution that works perfectly is adding a content size fitter to the content but that gives off the warning: "parent has a type of layout group component..."
so I'm not sure what to do
maybe more generally speaking can I have a child overflow its parent when that parent is a layout element inside of a vertical layout group?
Ignore the warning
alright i will, thanks
I could use a little help with layout group stuff. I have all of these in a Vertical layout group. All of the items stretch horizontally in the group. But I'd like the green button at the top to be a fixed width. I tried adding a Layout Element to it with a preferred width, but that didn't work at all
you could replace the green button with an empty object with a horizontal layout group in it and spacer objects on the left and right
Does anyone know to script a text mesh pro to fade in or fade out or any UI
change the alpha of its color over time
or use a canvas group and change the alpha on that over time
I don’t know how to script that
Hello just reaching out again about https://discordapp.com/channels/489222168727519232/502171135350407168/1389057095764017153. I'm not sure what's causing the default 100 height
I have an issue with scroll rects. There are many messages here in this chat, but the scrolling just doesn't work. When I use unrestricted I can scroll freely. When I use clamped it doesn't let me scroll at all, becasue I think unity thinks what's visible is all the content there is. And when I use elastic it always snaps back to the center. What am I doing wrong?
I believe the ScrollRect uses the size of the Content RectTransform to determine how much scrolling there is to be had
looking at your screenshot it's a bit confusing because I don't see a viewport
Normally when you create a ScrollRect you get like:
ScrollRect
Viewport
Content
I don't see a way to create a scrollrect in unity so I tried to make one manually
How do I exactly do that?
GameObject -> UI -> ScrollRect
I'm not seeing it
Scroll View
So, these are my save files.
Problem I am facing:
The left picture is how it should display my save file.
I made some changes and tweaks so that the UI is scrollable in case when more files are created they arent going outside the ui.
After I did that, for some reason, they got smushed into each other like the picture on the right.
"ScrollArea" is the Mask for the scroll area where the save slots should stay in
Edit: I managed to spread them out with spacing in the inspector, but my button area (the white behind the text) is still incredibly small and when I add another save file, they get smushed again
Stupid question but is there anyway to have a child rect transform with Ipointenter to triggers its point enter rather then the parents? Semms like a simple ovveride but cant get it to work. Moving the child is not really a good option
The child should be blocking casts going through it and not reaching any elements behind it.
You could also disable any 'raycast target' fields on the parent
Right now it triggers both that and its parents, and thats useally what I want but in this case I would like the parent to have a raycast but the child to block it so that it doesnt trigger its parent
That doesnt seem to be default behavior
show your issue/ setup/ code
Ok so I have a parent object with a rect transform and an Ipointenter and an image.
I also have a child that is not overlapping
The parent triggers a mouse over text at the mouse position and that is all good. The problem is that when
i hoover the child object than that also triggers the parents mouse over effect that blocks its own and thats not good.
So I would like for the child to ignore the parents.
So both parent and child have a raycast target that is working as intended. All is setup during runtime and is procedureally generated and I need to keep it that way
show it.. with screenshots/ video
Sure, i can do a quick video,
Never mind the really ugly TEMP ai art
its very much just placeholders
So basicly the text should be childern av the other raycast target
the text is a very simple asset:
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
public class SimpleTextAsset : MonoBehaviour,IPointerEnterHandler, IPointerExitHandler
{
public TextMeshProUGUI text;
public string textContent;
public string onMouseOverText;
public static SimpleTextAsset Create(string _text, Transform _parent, string _onMouseOverText = "" )
{
GameObject go = Instantiate(Resources.Load("SimpleTextAsset"),_parent) as GameObject;
SimpleTextAsset simpleTextAsset = go.GetComponent<SimpleTextAsset>();
if (simpleTextAsset == null)
{
Debug.LogError("SimpleTextAsset component not found on the instantiated object.");
return null;
}
simpleTextAsset.text.text = _text;
simpleTextAsset.textContent = _text;
simpleTextAsset.onMouseOverText = string.IsNullOrEmpty(_onMouseOverText) ? _text : _onMouseOverText;
Debug.Log($"[SimpleTextAsset.Create] textContent set to: {simpleTextAsset.textContent}");
return simpleTextAsset;
}
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("onpoint enter");
GlobalActions._DoShowToolTip?.Invoke(new TextOnScreenArgs { text = onMouseOverText, time = 999f });
}
public void OnPointerExit(PointerEventData eventData)
{
GlobalActions._DoHideTooltip?.Invoke();
}
}
I know there are some not that complex work arounds with simple grid layout or just my own layout och raycasting system but would be nice if there is a simpler way around it
or ofcourse unparnting but keeping world pos but then i will ned to handle a lot of weird cases when we resuply shop or items are removed and would love to not have to do that
So just to be super clear im not asking for way around the problem but rather if anyone know a way for a child with a raycast target has the ability to ignore the raycast target of its parent with the Ipoint interfaces
Hi guys, when I instantiate a world space canvas at runtime the buttons stop working, but if the canvas is there from before I run the game the buttons work, any help?
i have all of these thats the thing
When using a vertical layout in a canvas, is it not supposed to work with empty gameobjects that have children? Like, in the content section. How do I make the empty gameobjects with ui elements as children work in a vertical layout?
When I put the children gameobjects as direct children of content they work, but not when it's within an empty object that acts as a container for these three objects
I think I managed to do something just by creating a rawimage and then placing the other ui elements as children. But this gives me a weird effect where everything spawns in a different, weird location. How can I ensure my vertical layout only uses the image's position and keeps the other elements, children of the image, in the same relative position to the image?
Nevermind, it was an issue with one specific object's anchors, it's all solved
Okay, another question I have. When using a scroll rect, I scroll down and it works perfectly. As well as scrolling up, but when I get to the end of the list, I don't know why, but it lets me scroll down a little bit further, leaving an empty space in the scrollrect
Consider adding LayoutElement and/or content size fitter to the "empty"
Yup, it worked. Added the size fitter
can built in scroll rect do this?
its horizontal scroll, there are no scrollbar, the whole view is a scroll
probably, yeah
not the page thing though
Is anyone free to help out with can issue I'm getting? I'm getting a NullReferenceException: Object reference not set to an instance of an object in my LoadData method.
using TMPro;
using UnityEngine;
public class PlayerPref_Manager : MonoBehaviour
{
[Header("Int Counter")]
public int intValue = 0;
[SerializeField] GameObject intText;
[Header("Float Counter")]
public float floatValue = 0f;
[SerializeField] GameObject floatText;
[Header("String Input")]
[SerializeField] GameObject stringInput;
[SerializeField] GameObject stringDisplay;
void Start()
{
LoadData();
UpdateUI();
}
public void IncrementInt()
{
intValue += 1;
UpdateUI();
}
public void IncrementFloat()
{
floatValue += 1f;
UpdateUI();
}
public void OnStringChanged()
{
if (stringInput != null && stringDisplay != null)
{
string inputText = stringInput.GetComponent<TMP_InputField>().text;
stringDisplay.GetComponent<TMP_Text>().text = inputText;
}
}
public void SaveData()
{
string inputText = "";
if (stringInput != null)
{
inputText = stringInput.GetComponent<TMP_InputField>().text;
}
PlayerPrefs.SetFloat("FloatValue", floatValue);
PlayerPrefs.SetInt("IntValue", intValue);
PlayerPrefs.SetString("StringValue", inputText);
PlayerPrefs.Save();
}
public void LoadData()
{
floatValue = PlayerPrefs.GetFloat("FloatValue", 0f);
intValue = PlayerPrefs.GetInt("IntValue", 0);
string savedString = PlayerPrefs.GetString("StringValue", "");
if (stringInput != null)
{
stringInput.GetComponent<TMP_InputField>().text = savedString;
}
if (stringDisplay != null)
{
stringDisplay.GetComponent<TMP_Text>().text = savedString;
}
}
}
which line?
Ooo. I didn't have String input assigned correctly in the inspector. It should have StringInput assigned and not StringInputText
also you should have intText/floatText/etc asTMP_InputField/TMP_Text directly instead of GameObject
it was this line:
stringInput.GetComponent<TMP_InputField>().text = savedString;
doing this could have prevented that issue lol
I changed the declaration to GameObject because it wasn't letting me assing things in the selector lol
do those objects have the relevant components statically?
or are they created at runtime for some reason
I believe they are static (by static I'm meaning I've created them in the UI manually)
you should be able to assign them to the correctly-typed slots then
This is what I'm building. It's a basic UI to learn how to use the PlayerPref save/load system. Even though I'll likely just use the encrypted Json Utility method in the future. Just wanted to be familiar with this before moving forward
I'll switch the declaration to TMP_Text/TMP_Input_field now and test
Aye it works! I think I was missing last time I tried was
using TMPro;
I'm pretty sure I was just doing:
using UnityEngine;
using UnityEngine.UI
Thank you Chris, I'm smooth sailing now. (Hopefully I didn't just jinx it)
Context
In HTML/CSS, I can just do The <span background="style: background: url(glitter.gif)">Glitter Monster</span> has appeared! which is really easy.
Problem
I can't do this easily in Unity. I tried The <sprite anim=0,5,10>Glitter Monster has appeared!, fiddling around with <mspace> but I can't seem to get it to work. I want the sprite to cover the width of the monster's name, and the monster's name can be arbitrarily long. Is there a way to add a background behind specific text in Unity?
is there a way to make my UI follow this slant with a layout group or should i just do it manually?
Do it manually: layout groups work with a rect, so if you use a rect and tilt it to align it, then the children (the buttons and their texts) will also be tilted.
Or you can create your own layout group by duplicating or inheriting the vertical layout group and adjusting the offset of each item, but this will take more time...
Or another solution: use a vertical layout group that you tilt, and create script for buttons so that they tilt in the opposite direction to compensate. 🤷♂️
This looks more like a UI Toolkit question, you’ll probably get better help in #🧰┃ui-toolkit 😊
rotating a layout group object worked 
my UI text is doing this weird ghosting thing. im changing it in update with debugText.text = moveInputSmoothed.ToString();
im not instantiating new instances of it, and i checked camera settings and it seems to be fine. chatGPT and google were not able to help me either 🥲
It's not a good idea to update TMP_Text.text every frame in Update(). Even if the value looks the same, setting .text forces Unity to redraw the text, which can cause flickering or ghosting.
Try only updating the text when the value actually changes:
string newText = moveInputSmoothed.ToString();
if (debugText.text != newText)
debugText.text = newText;```
That should help!
ty for the response! unfortunately im g etting the same thing happening
No problem! Just to be sure, could it be that you have multiple TMP_Text objects overlapping each other? Maybe duplicates in your hierarchy?
Might be worth checking the scene hierarchy to see if there are any extra copies accidentally left active. That could definitely cause a ghosting effect.
chatgpt did suggest that, unfortunately that's not it either. also the text appears to be fine in the scene view so i suspect maybe it's a camera thing?
Can you send a screenshot of your hierarchy and confirm that your TMP_Text is inside a Canvas?
and the inspector view of the Canvas?
And the Inspector view of the TMP_Text component itself?
Actually, it could be a TMP-specific issue related to URP. Sometimes when switching to URP, the default TMP shaders or materials don’t work perfectly.
You might want to try:
- Reimporting or updating the TMP package via the Package Manager.
- Switching TMP materials/shaders to the URP-compatible ones (like TMP/Distance Field shaders adapted for URP).
- Or simply re-adding the TMP component to your text object to reset its setup.
That often fixes weird rendering glitches after switching pipelines.
ah ok so i just fixed it right now by switching to "Screen Space - Camera", any idea why "Screen Space - Overlay" might've caused issues? does that have to do with those points you just mentioned?
thanks for your time btw!
Nice! Glad that worked!
Yeah, in URP, Screen Space - Overlay sometimes has rendering issues because it's handled differently from the Built-in pipeline. URP doesn’t officially support it the same way, and some features like post-processing, custom shaders, or even TMP materials might not play nicely with Overlay mode.
By switching to Screen Space - Camera, you're letting URP render the UI through the camera, which gives it better control over lighting, post-processing, and depth sorting. That’s why it usually behaves better in URP setups.
And you're very welcome, happy to help!
I'm using a TMP_InputField and I have it correctly displaying with starting text. When I select the text area I get a log message from OnSelect but the carat never displays and i can't type. What should I be looking at to get it working?
are there any cool free UI assets ?
game game looks hella sad with just default buttons and panels xd
@wind flicker I do not know if it is cool enough but you can purchase per 2$ this pack and it is contain the Cartoon GUI Pack https://assetstore.unity.com/mega-bundles/quick-start
oh yeah i just bought it 2 days ago and didnt checked into it. thanks i forgot i had it lol
hmm i mean it would work but idk
im a bit confused about 2d gui and 3d gui
its listed in 3d gui. isnt this just models?
This one is polygon icons pack . In one of my game I use 3d models like Rawimages with rotation animation it looks nice. So you can use them same way
This one is included in QuickStart it looks fully 2d: https://assetstore.unity.com/packages/2d/gui/cartoon-gui-pack-48850
yeah but im not sure if it fits my game. its hard to find fitting ui for my low poly game :D
You can use RenderTexture display it in Raw Image to make polygon packs looks like a 2d UI with 3d effect I did in one of my game it looks like this the star and shop icon is 3d but displayed in 2d RawImage
ohh i see
How to make parent layout group be the size of all child elements?
And really any parent to be the size of the children
Content Size Fitter seems to do it.
trying to set alpha is transparency on this image, but when I check it, the apply button remains grayed out. I've had no issues doing this previously and can't find anything online. anyone got any idea what might be causing this?
has also begun happening to every other image in the project, I haven't added any new packages since.
I actually can't apply any of those top-most settings
nvm got it, apparently you can't change import settings while in debug mode
finnally that i have manage to get through with the (princess peach rescue toad type of thing) problem, but however there is still one small problem, which is that when i appear in a stage and set to rescue that certain gameObject by interacting with it, but however when i do that, the UI Image doesn't change to already rescuedimage. while i am trying to figure out
A tool for sharing your source code with the world!
when trying to rescue a muon, this happens instead of just the certain id
Hey there! I'm building a 2D pixel game where most of the gameplay happens through mouse clicks on one central game board. I plan to have a lot of small moving animations/particle effects alongside buttons on the game board and was wondering if there's any significant difference in using 2D sprite renderers vs small, individual canvases in world space on each object w/ a UI Image that needs it? I would build everything into a single canvas, but I wanted to avoid so many draw calls on a main canvas since all the little parts will change frequently, plus the separation of the game board from screen space overlay ui is handy
I was thinking to place non-interactables as 2D sprite renderers and animate them off scripts when needed, and then just have all the buttons and text and such on small canvases that update only when needed
https://streamable.com/2gl5q4 how's this weapon selection menu looking? i'm going for a half-life style system where it's split up into categories that you can cycle through
you have to click the same button you shoot with to accept the selection
Hello, I have a question.
How would I handle having world space text mesh pro text with a pixel perfect camera that has upscaling turned on.
Right now my in-game text gets blurred into unrecognizable pixels.
The only possible solution I've found would be to use a stacked camera with the pixel perfect one rendering everything but text and the second one rendering the text only, but I'm not sure if that's the best solution since I get a warning that pixel perfect cameras should not be stacked and the stacked camera would need to sync its properties to the pixel perfect one for the text to not appear shifted.
How could I improve my Win Screen? I don't like it so far
i wish i'd know how to make this pretty lol
Bookmark: https://www.gameuidatabase.com/
is there a tutorial somewhere or a guide or something how to create own gui elements? or is it just do smth in gimp/photoshop and save as png? xd
thanks
nothing fancy, as you already said, this is done in your photoeditor. be creative, check the internet for examples
problem is like idk how big i should make buttons. as i saw its mostly just pngs?
upscaling and stuff does make the quality weird. doesnt it
there are many workarounds to prevent that and keep the visual quality
so ill just use how i got the information
canvas
scale with screen size
1920x1080
and then do some stuff in there with photoshop what looks good on that resolution and implement these graphics in my game?
yep, sounds good to me
aight thanks !
i try to figure something out then :3
the visual aspect is the smallest issue, keeping the ui at the right position cross plattform and device is important, but that is really simple, you just use anchored positions
but i dont rly understand the use of like vertical layout group. why would i use this when i can just freely move buttons? idk it just seem to useless limit element moving
many many advantages of the grouping elements.
but if you are not sure, you dont have to use them.
aight !
i hope my game comes to live soon. i have someone who helps me out with menu elements. lets see how well this works
you can skip the beautifying for now, just concentrate on making the game work
during this phase you might find a few people wanting to help you out
Thats what i did. Core mechanics are done. Theres still some things here and there i am working on but Overall my mechanics are finished
what kind of game is it
Genre is Simulator i think. U deliver packages, cars. Online or alone. Car delivery is not here yet i need to mess with cars tomorrow
and you went for multiplayer right as i can see from the screenshot
Yep. Networking is 100% for the current features
wow, what system are you using
But i didnt think about something
nice
Yep. But i didnt think about the fact i want like office upgrades but everyone gets money and idk if i want to remove the money from both on upgrade bought or just the host or whatever. Idk gotta think about it 😂 because the Fact that when u play singleplayer u have nothing when all Ur money was Drained in multiplayer or idk. I gotta see what i do. Wrong channel to Discuss about i think
@wind flicker in vertical/horizontal layout groups you can dinamically add elemets and it will display any amount of elements correct that is usage case. If you for example load uncknown numbers of users from server and display their rank
you just instantiate pefabs inside content and horizontal/vertical layout will do the job
ohh thanks for expkanation
Hey guys
I'm interested in the combination of 3D and UI.
jsut do this but then also put 3D objects in the scene
get rid of the big opaque UI panels so you can see 3D objects
I feel like I have a 3d object overlapping the Ui.
I got it right here, don't I?
this is your canvas
I'm not sure what you're trying to show with this
If I remove the camera, only the UI is shown.
What are you showing me with these screenshots?
Is there a question here?
I can't understand why the 3d object overlaps the UI.
why are you removing the camera?
because you're using a screen space camera canvas
if you use Screen Space Overlay the UI will always show on top
thx
Hello there, I've a 3D Scene with a UI in 3D Space... problem is that I can't find a URP Shader for UI that support LIT.
Any advice to avoid the auto-illumination style of Unity UI?
Do you have auto generate lighting off?
i'm having trouble getting my TMP input field to work. I have it fulled declared and displaying properly. I have defined the default text and the placeholder text as well. When I click on it I see that the OnSelect runs correctly (via a log statement on the listener) and the background is visually dimmed while clicking. However, I don't see the blinking carat and I can't type. Is this something any of you have ever experienced before?
we don't really support modding here, sorry #📖┃code-of-conduct
guess i should have just asked the question without that part
the issue with asking stuff about modding is two-fold - there's the legal issues of course, but there's also the part about it being an atypical context
not having the normal tools as you would in your own project or having other constraints makes it kinda impractical to really support in the general help space
I get that. I'm not going to argue, just pointing out that if I had said "I'm challenging myself to only do it in C#" It wouldn't have been an issue
We've seen that many times, it won't work
i don't think many people would want to burden themselves with trying to help someone with an arbitrarily placed constraint like that either
anything about it i need to explain more?
I'm not sure if still the right channel... anyway I've made a meterial with the ShaderGraph to have UI canvast that can react to Light and receive shadow...
Then I've used "Seed code" (I guess) button, to have the compiled shader, copy/pasted the entire shader in a new file and then I've added the Stencil stuff which was missing to work correctly with the UI Mask!
It's working 🥳
BUT ... there are some transparent element which still visible... a bit.
Maybe it's because the surface still reflect the light, but event with _Smoothness = 0 still have the same issue.
Hello, is it possible to stack pixel perfect cameras with the URP?
is it possible to somehow align 2 groups of words in the same line, like I want NAME - DATA, where NAME would be on the left and DATA on the right of the textbox
I'm using TMPro, I tried using <align> but that only shifts an entire line
@unborn citrus you need to create two text labels first set to left second set to right
if you need such logic
yeah I know I can do that I just wanted to see if I could do it in 1
in one you can only create your custom aligner (text formatter) that will manually do the job.
has anyone seen this before?
My game view is grey and I thought it was due to a canvas but I've disabled it and still seeing the grey?
oh, it's due to the .fbx asset i just added. Not sure why it's making my game view grey when it's no where near the camera
Hi guys! new to unity but would love some feedback on this cutscene/main menu im making! thank you v much!
Not bad, except that fade into the main menu you can add a fade to make it better (you can ask me for a script for the fade if you want)
oooh thats a great idea! thanks!
my main feedback is that your call to action - "PLAY." - is teeny tiny and right at the bottom! Here are a couple of examples - it doesn't have to be massive, but it shouldn't take me so long to find 😉
I would actually expect "play" to be where "out" is on the sign? The text on there feels big and clickable
Ic, thank you! That makes a ton of sense!
i rly hate the Scrollview in unity. i have code to generate content for the scrollview but its not generating anything or i am dumb and cant see it. i think its an UI issue
As you haven't provided any info - just venting? My first wild guess would be that you don't set the parent when you instantiate, and set it as a child after. Which means the scale will be all wrong, and the position will be too.. probably.
hello, i need some help! i managed to make this responsive ui via script. But i would like to know if it is posible to achieve the same result using unity componets in the ui
i can show later but its not generating content from code. the prefab is not getting generated. i get a detailed information later
you don´t have to code anyting to make ui responsive, just use anchored positions and use methods like scretch etc
the thing is that those ui elements are inside a grid layout group, so i have to set the cell size and it does not stretch, i handle stretching with code
can´t you make the layout group strech instead.
yep, stretch is set in my content rect transform (the same object containig the layout group), but the layoutgr requires setting a cell size o the x and y
i made something like you have there a few months ago, and i remember i did not have any issues whatsoever.
afaik Unity does not have anything that will auto move elements around like in the video shown
is it just the strecthing of the child elements you are asking?
and regrouping as soon as you make the container smaller
yep the childs are the ones that should stretch, depending on the width of the rect transform
compare with this
could you sent it as mp4
yes sorry
so we can play it here embeded
thats the difference
in the right video it changes the cell sixe x value to adapt to the screen width
please explain i am confused. are you looking for a minimum x size?
i can see that you are resizing the cells in the right video but it is unclear why
It's web flexbox stuff
for a more dynamic fit, for different devices. in some devices the the 1000x cell size goes off the screen and in others it leaves a lot of space with nothing on the sides
i see now. did you try the scale with screen size on your canvas scaler
That's not relevant to this, that's for the entire canvas.. not individual elements
i do have scale with screen size in my canvas, ref res is 1080x1920 and match height so in all devices that canvas is half the size of the screen, mobile or desktop
then i am really out of ideas mate
maybe it is the only soloution as you have it with some code
Yes, you have to buy an asset or code this yourself
Or use UITK - that might do it
as that's inspired by web UI
yep, i tried every ui component but looks like my only option is through code
i mean it works but maybe is more optimus using ui components
I'm certain #🧰┃ui-toolkit can do it.. if you're not far into development it's worth evaluating
thanks i will look into ui toolkit
what do i need to check here? left side is in editor, right is ingame. usually it should create Prefab inside the Scrollview but for some reason it dont and idk if thats an UI or an Code issue
check the hierarchy to see if the object is there at all
if it isn't, then it's a code issue
or right it should spawn inside the Content of the Scrollview right
it is spawning
even looks correct when i activate the SkillDetailsPanel
might be an issue with my prefab itself 
when i click anything from there from the prefab canvas it shows to be there
Then it's just mispositioned or misconfigured.
When spawning something as a child of a layout group I highly recommend using the form of Instantiate that takes two parameters and two parameters only: the prefab, and the parent container Transform
got it. was an problem with my prefab itself
theres still the issue that the right side isnt showing up. but atleast the prefabs are here now
I think I am going crazy, what am I doing wrong here? How can these images (they are on Canvas) be on top of the UI BUT below the floor WHILE the UI is on top of the floor?
HOW?
Hello guys
Guys, I need some help
I'm making this game UI right here, with the middle box being the Raw Image. The main camera is set to use Texture as the output mode, which is using the texture the Raw Image will use.
For now, it moves smooth and I can work with the "screen" like this, but when I test the game, it gives this kind of error when the game moves.
How can I fix it? Adding a second camera removes the warning and the after image effect but it tanks the performance too much to be acceptable.
I'm puting this here since I can't find any channel dedicated for the camera (since I'm not using cinemachine for now)
Hi! I am making a Kahoot-style join system, and I am wondering if there are some tricks to achieve this aesthetic where there are lines that each letter snap to. The issue is that not all letters are equally wide, so they are not centered on each line. I am using TMP
I am thinking that I can maybe make an invisible input field that the player types in. Then using a script I can set each letter individually (one TMP_Text per letter)
I have a panel with Grid Layout Group, and when I put stuff inside it, the object gets in a slightly wrong position like this. When I click on the panel, it seems the selection area is slightly bigger than what it looks like, as in the second image. It's likely that this selection area affects the grid layout, my question is how to fix it
i have a panel, inside the panel i spawn a prefab with a canvas by code, the prefab is seen in the hierachy so its getting spawned, but i cant see it inside the scene/game view, what could be the issue?
wrong layer, bad position, invalid dimensions, tiny or zero scale. Just mess with it when it's spawned in play mode to figure it out
when i drag out the text element from the prefab inside the main ui its not visible aswell, wich makes it weird. font size is big enough and its on the main ui where everything is visible.
scale is zero
u right ...
but that happens when i drag out the content from the prefab in the main scene, inside the prefab its still not visible
wait im dumb. thanks !
for some reason the scale from the canvas get set to 0,0,0
Use MP4 to embed videos in discord
Hello everyone, I am having a challenge with my UI, my hud is inverted and not working, if I turn off post processing it behaves normal. I am making use of my own 2d URP.
Has anyone experienced this if yes: how can I fix it.
Thanks
what does "hud is inverted" mean?
And what does "not working" mean?
what are you expecting it to do that it is not doing?
why when i instantiate a gameobject with an image component the image is always invisible ? its on top of the hierarchy and the inspector shows that it has an image assigned. please help i've been losing my mind to this bug for days
the wuidth and height of your object are 0
you also have an error in your console (maybe related or maybe not)
omfg
i think imma take a break from unity
Strong recommendation about using and instantiating UI prefabs at runtime:
- In the prefab make sure the anchor preset is set to Full Stretch (bottom right of the anchor presets menu)
- When you instantiate the obejct, use the form that looks like
Instantiate(thePrefab, theParent)
My in game UI was inverted, I discovered the issue was my anti-aliasing setup, it now works as intended
Need help figuring out how to properly do a thing
Running into an issue with my prefab atm where I want to have it so when more text is added it expands the text object's size rightward instead of horizontally in both directions and I'm unsure how to properly do that
The text object is in a parent object with a horizontal layout group and content size fitter comp, with the text object also having a content size fitter comp also
Set text alignment to left side
No I had it set to that already
Okay figured out the issue
My pivot for the parent object was set to the wrong thing
Why does this happen? In the editor, everything is looking fine... (I know it looks ugly dw abt it)
No one knows your game... no one, other than you, knows what "this" is. So.. explain the issue properly if you want some help!
I'm sorry. So my problem is that the buttons are not in the corners as I set them up in the editor.
you've probably anchored them to the center, and not the corners.. so changing the screen size keeps them that distance away from the center.
!learn -> 👇 do UI tutorials
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Alright, thank you.
What do you think about UI/UX in a situation when player received more experience than it's needed to level up?
Is it okay to show 9/5 exp points in progress bar?
If promotions is failed I show a progress bar with current experience and substract amount that was needed for promotion.
well 9/5 looks really weird. it is like saying you gained 90 of 50 points in your exam.
I think it's fine
makes perfect sense
Hi guys, could you give me some feedback on this ui mockup?
Nit - it's "defuse" not "diffuse"
why can't my scrollbar reach the bottom here? I am going crazy trying to either fix it myself or find any help to fix it.
What Unity version are you using?
omg tysm!
the lowercase d on the diffuse/defuse on the bottom right kinda looks out of place, and the difficulty stars are on baseline rather than centered
Does anyone know why these sprite assets are different sizes when I use different fonts?
mmm I see, thanks!
arganoid you can use AutoSize option if you use textmeshpro. Currently your second font is bigger than first font so last line taking 2 rows instead of one row.
When you say the second font is bigger, they are using the same size setting (36) for this text, or do you mean the font is just inherently bigger and 36 for this font is bigger than 36 for the other font?
looks like it is bigger even icons bigger are you sure you use the same size?
the right picture the icon in the center is much bigger then same icon on left picture
same with tire
They are both size 36 and it's the same sprite assets
try to use AutoSize it can fix your problem set min size and max size
fonts looks the same but sprites sizes is different
how does one make ui that doesnt change with screensize? I'm trying to make stuff look the same everywhere with a mix of sprites and UI if possible
anchoring won't line up with spriterenderers though
depends on the anchoring and how your sprites move
if your sprites are supposed to be perfectly in line and in sync with UI, then.. isn't that just more UI
Is there a way to set the maximum line length in TMPro? I would like to insert a "\n" after every X characters.
I tried doing it through code, but it doesn't work well with tags.
Help guys
Just set the margins
The text length is variable every time, margins don't work for every scenario.
Fixed it by setting the rectTransform size based on the text length and manually inserting a "/n" in the string
help guys
!ask
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #🌱┃start-here
check UP
bump your question, i'm not psychic to know lol
Something is misconfigured. Create a default button and compare. Also use EventSystem debug info, bottom of its inspector to see if something obscures and what actually is ubder the pointer.
I tried it on other buttons if they are in length everything is normal, but on these buttons it's like this.
Only work if you press the center of the button
Create new canvas fully extended and put just that button and test it
Buttons do not care how they are resized, the click area is the image area, unless something else reduces/obstructs it
Examine the image asset in edit mode, if it has weird border/collision overrides
nvm custom outline or physics shape do not affect UI button shape
Did you check the EventSystem?
this?
Also just create a default button and assign the sprite there to remove any weird settings overrides
Yeah, I've done it all, and with these buttons it's like this.
What do you have in the Raycast Padding on the image?
Other than that have no idea what is being misconfigured. Default button, with custom sprite, can be resized in any way and works perfectly well.
Hi im currently working on my first proper project and have got to the point where I need to work on the UI but the problems I am having is that I cannot get things to look decent enough across many devices it will be for Mobile/tablets I have it locked to portrait mode, I have the main menu looking pretty good across multiple devices(excluding some tablets) but im struggling with the game scene Mainly the Reelholder at the bottom, im using a mix of a custom scripts that force panels to be 100% width and height of all panels will add up to 100 for coverage and verticle layout/content size fitters can provide screenshots if anyone is able to provide a bit more insight, The main devices im testing on is Iphone 13 pro, z flip, 640x1136 to represent smaller phones and then 1668x2420 to represent tablets any insight is appreciated
I also have subtitles but when trying to change the mark background to fully darker its changeing the text itself so if i go full opaque background on mark the whole thing is just black this is the line im using thats with it being 80 transparency but its effecting the words aswell
subtitleText.text += $" <mark=#00000080>{word}</mark>";
}
yeah, mark is like a highlighter over both text and the background
you could just have it a child of an image with that color
-# omg it's the carwash that answered this same thing in a forum thread 😆
I don't remember doing that ;p
I've slept a lot since then !
I guess the dev never got around to revising the geometry creation process
Can someone remind me how to setup a scrollview properly so that A: it scrolls when it overflows and B: the spacing is regular when it's not 100% filled.
Content size fitter does the trick. Makes one wonder why it's setup improperly by default though 🙃
I think what im gonna do is just duplicate my SubtitlePanel and just Apply the Mark one of them while leaving the one infront not applying mark should give the effect i want
didnt even need to duplicate the whole panel just have it apply to a second Tmpro element which had mark applied behind the regular subtitles thanks 👍
Is therer a way to add an outline to my vfx if so pls lmk
Say I have a fixed height and a fixed font size. How would I go about dynamically sizing the width of a text component so that it always has just enough space to display all the text in a single line?
Check out GetPreferredValues on TMP_Text
I was told to use a ContentSizeFitter component and that seems to be doing the job well
Do someone know that why I unable to apply my image sprite model in UI image object?:
sprite mode is set to multiple, and you haven't defined any for that texture. You probably want single
Yes, it worked. Thx
whats wrong here? when i put any gameobjects in there they arent displayed. when i drag them out they are displayed 
Im so newb if it comes to UI/UX, so I found some free asset UI for my mobile game.. https://www.kenney.nl/assets/ui-pack
It has png files, but when I use it. It doesnt look like its supposed to, its blurry. I get it that the blurr comes from scaling the image since its not vector.
Any tips on how to go about the UI?
The second Image is how the asset should look
what are you trying to achieve with the canvas group component?
You need to 9-slice the sprite. https://docs.unity3d.com/Manual/sprite/9-slice/9-slicing.html and https://learn.unity.com/tutorial/using-9-slicing-for-scalable-sprites
disable enable the canvas group. but i guess i can just remove the canvas group and enable and disable the entire gameobject
ok then i am pretty sure you are not aware what the componenet is actually used for
but even in my sceneview
i dont see the ui elements
on alpha 1 i shouild see it no
canvas group is to have parts of the ui enabled with an fade effect, no?
so you got child objects on this gameObject ?
yeah the canvas group is taking care of them when they are grouped below
glad you fixed it
i rly hate ui in unity idk why
why tho
they provide so many helpful toosl and soloutions
and if you are not happy you can still use the #🧰┃ui-toolkit
pretty everything you need
never heard about it. might try
its so hard to make a good looking uixD
I'm trying to apply post-processing to text. I've already set up the global post processing, and in the scene view, everything looks right, but when I play the game, the glow completely dissapears.
I think you need to change the canvas to screen space - camera - post processing doesn't affect overlay
It works, thank you so much!
well
How can I create textures for human head model?
why is it so weird when my missionlistcontent got the size? isk it looks weird
is it a code issue here?
no idea how to make this look even - i despise the UI system does anyone have any advice? 😢
figured the mainissue out.
but its still weird
any idea whats wrong with my ui?
ok nvm its an prefab issue it seems
i have no idea why the icon and the reward text is messed up
the rewardstext has bottom left anchor the icon top left anchor
yep it's definitely wrong
Is it a good practice to split my canvas into tons of subcanvases? For example if I know that 90% of my canvas is changing rarely, but there are some elements that move often, should I put the often-moving elements on a separate child canvas for preformance? Is there a real upside to this, or perhaps any downsides I should be aware of?
I'm talking about this from the perspective of a really canvas-heavy game
I assume that doing a separate subcanvas for every single element has some really unnecessary overhead so I won't do it, but is grouping elements together worthwhile, or should I not bother and find other optimisations
The generic advice is to put stuff that changes together on the same sub-canvas. You need to find a balance between canvas counts, overhead and redraw/relayout reduction empirically.
I suppose that makes sense, thanks
I’ve heard there’s pretty rough performance implications from using OnGUI / Unity’s older GUI stuff, Is this avoidable or is it for the most part unviable to really use this as a primary way of handling game ui
I know we’re meant to either use the standard ui stuff or newer ui toolkit but I kind of fuck with the older GUI stuff because it’s a lot more code based like ui toolkit but strictly c# and/or exposing serialised values
Have you actually tried it? For most cases it's almost certainly not an issue
Yeah dabbling with it now, Just wanted to through out a vibe check incase peeps have already come to conclusions
i use 1 canvas where i handle everything with an gameobject and just enable/disable the gameobjects on whatever i need
This warning is getting popped up whenever I go in Playmode to test:
Is there any solution for this bug?
Hi not sure where to post this but is there anyone working on "in game survey". I'm working on a project but i want to gather data from the user and don't really want to redirect to google forms or something. Is there something equivalent (Like sometimes i see other games doing it -- Are they using webview)
some will use webview , others will create it themselves in app.
Just ignore the warning and wait for a fix
Ok
@winged hare to continue your question here - as vertx mentioned, there is no built-in way of handling themes with the Canvas system, short of using UIToolkit as an alternative, you certainly could build your own wrapper for components you want themes for, then you can create your own global themes or even local (per-Canvas) themes this way
I do something similar with my project using ScriptableObjects to hold the theme data, and a class I use on the Canvas to reference the scriptable objects, applying the theme would be accessing for example, a buttons Image component and setting the color, or specific art, or accessing Text components and setting the specific font and size, etc - its certainly a good bit of programming work involved, but doable if you prefer not to use UIToolkit and cannot find an asset online that fits your needs
This would be a custom theme that my artist is making. I may take the time to learn UI Toolkit in that case, but the ScriptableObject route could be solid as well.
If all you need to do is replace images with what your arist makes and set colors and fonts, you could do that with Canvas and ScriptableObject - but if you need more than that, UIToolkit would certainly allow for a lot more flexibility as the USS works very similar to CSS/web development, which means you can do stuff like gradients, rounded corners, animated button states, etc though it does certainly have a learning curve to it - aside from Unity Learn, I dont have any specific suggestions for where you could learn how to use UIToolkit, but I can suggest to try and maybe start with just a container and button to practice using all the features you plan to from your artists work, and theres a good chance you could use both UIToolkit and ScriptableObjects
Awesome thanks for the help again!
Doing some raw GUI stuff and running into a issue and I'm not sure about the best way to solve it
I have this texture (red) that i want to fill up a given space based on a lerp im doing
I wasn't able to get DrawTextureWithTextureCoords to display anything so right now im just lerping the usual rect.width based on my lerp value.
It looks fine at that 75 value but as you can see when it gets too thin at 10 I think it's doing some mipmapping kinda thing where it's degrading into just a rectangle which starts clipping.
I'm wondering if theres either A. a way to prevent it from rectanglizing at a small scale or B. a way to properly mask this texture and/or potentially manually clear/erase a specific GUI drawn space?
Is there any assets to create it or people usually create those themselves
I was hoping DrawTexture with a transparent texture and alpha blend set to false would work as an eraser but no dice
using DrawTexture with ScaleMode.ScaleAndCrop gets me so close but DrawTexture seems to ignore transparency on the texture? so my corners aren't cornering
Thanks this is worthless
Anyone know why GUI related calls seemingly force some sort of mipmapping when i don't have mipmapping enabled on my texture?
texture max size: 128
texture max size: 1024
What I have to do so that canvas can automatically adjust itself according any mobile' screen?:
when placing your ui elements use anchored positions
how do I change the color of the text of a TMPro Button?
not via script, just via the inspector
There’s some colors somewhere
I thought it would be like other text, but changing the vertex color or Face does nothing
neither of these change it, they just change the color of every other text, but not the one I am trying to change
nvm found it, turns out that the face color is being added to the vertex color. So I put face color to white and just set whatever I want via the vertex color
my ui works fine but when i change the resolution of my game, i am left with these blue bars on the top that i can only assume are my scene. how do i fix this?
Properly anchor your UI
don't crosspost, post in 1 relevant channel
Which channel is the most relevant
there are probably both ui and code solutions, which one do you want
code probably for more customizability
then let's go there
oki
how do keep gameobjects(childs) that in gameobject(perent) stay the way they look even if i stretch the perent?
make sure to set anchors appropriately
some of them need to not stretch so they get segmented properly
perhaps look into layout groups
with layout groups
well, you gotta configure them correctly.
how to configure them?
it's a whole thing, check the UI package guides
I was referred to you guys.
I have a problem. What I want to do is to have a preview window that fits the screen vertically no matter the screen size.
The parent (the container) ensures that from the top and bottom that the menu and some padding is always there...
preview looks exactly like I want it to be. But at runtime the preview window is shifted to the bottom of the screen.
Could someone here help me out?
how high is the seedpanel?
60
Each button and the field are 50
so for some padding I set the container to Top:70
are they... additive?
They are...
Why? the container stretches the whole cnavas... why would the seed panel height and the container top value be additive if both elements stretch to the top border of the screen?
what do you mean "they are additive"?
if both elements stretch to the top border of the screen?
they don't though
also what if you check scene view while in play mode
i relaized they dont even though it Looks like that because in both elements have there white borders completely fill the canvas
So I assumed that the Top value AND the SeedPanel Height get calculated from the top Canvas border
how is your SeedPanel's recttransform set up
ok so SeedPanel is anchored to the top and positioned to the top with a height of 60
PreviewWindowContainer is anchored to stretch with a top offset of 70
also try checking this
I removed the 70... now the top looks right. but in scene view (thanks) it goes over the bottom
I assumed the "fit in Parent" from the Aspect ratio fitter would prevent that?
can you change to the rect transform tool and make sure the PreviewWindowContainer is actually where it's supposed to be
Currently it is stretched over the whole cavas.
So... in my head. the lower border is the same as the canvas border.
Now the preview window should with the "fit in parent" setup not go over that lower border... but it is doing that
I think i misunderstood something very basic here ^^'
the lower border should be 10 above the bottom of the canvas though, as you've set
well now you have top and bottom set to 0
you should use the rect transform tool so you can actually see where stuff is
yeah I added that back after the screenshot.
This setup... produces this result
use the rect transform tool, press T
yeah that shifts the container... but the Window itself still sticks out at the bottom
Oh sry. Yes I did that
so now set the top offset and check the child
Offset looks correctly placed under the menu band
And the child has got a automatic -80... somehow?
hm, that doesn't seem right
thats the child setup
did I do something wrong here?
And Canvas Setup... maybe there is something wrong there
what about doing height controls width (and perhaps setting the anchors to stretch on Y)
yeah, setting changes will usually keep the existing layout and just change what values are presented
you gotta set Y pos to 0 and stuff now
and reduce the height, flexible height should take care of that
even if I set Y to 0... at runtime it gets automatically set to -80
And the height seems to be overriding flexible height 🤔
cant even change the -80 to 0 at runtime... just reverts
what about without the layout element? (or disable it for now)
Hii, just a suggestion. Use a Vertical layout on the top parent of SEED panel and Bottom panel and adjust its settings. You may get the answer.
no dice still automatic -80
I will try
okay no sry... what should I do where?
you mean that?
nope, remove all these. Use vertical layout Group
but... I want my buttons to be Horizontally alighned?
i changed it but all it did was to sort my buttons vertically
The Preview window child stillgets the automatic -80 adjustment
Can you pls mention in the image, which are the components that are needs to be horizontally alligned?
The Input field and all the buttons
"Seed:" is just a textMesh
I have to bench the problem for now. I will return later and will try solutions if you have another idea.
Thanks you both for the time so far. I hope I diddnt come along as dense ^^'
i think, i haven't understod what your problem actually is.
Tick both boxes on Control child size and Child force expand first and then add your child's.
and on child add Layout Element and Tick prefred hight or width whichever needed and the value.
that did not help.
@steep warren but it is fixed right now. Although I dont know why.
Just to figure out where this -80 forced Pos Y comes from I started to delete elements until it diddnt happen anymore... after I deleted the whole Button Panel it was gone.
then I Strg+Z it back.... and the issue was gone. I dont know anymore...
Can someone help me with creating staggered UI reveal for my mobile game? There's absolutely zero tutorials on such thing on YT so please, experts guide me thoroughly
Here's a video example of what I mean by UI staggered reveal in case u aren't sure, it's when everything quickly pops into place bit by bit rather than appearing all at once when u switch the tab
Without staggered UI reveal it looks boring and plain. If someone can help me achieve this or tell me how, that would be awesome.
My approach would be to use raw image elements for every "item" and fade them in using the Alpha (transparency) layer
This fade would be scripted.
similar to a splash screen that most games load on game start.
script would basically be
Start at alpha 0f
increase alpha to 1F over X amoutn of time (quite fast in your example)
that'd be the way id do it as well..
you can populate ur list having them all disabled..
then on each element have its own script that brings the opacity from 0 to full on awake()
then u just go thru the list and activate each element 1 at a time
oh and for your use-case... do them one after the other so they are staggered naturally
this subtle "zoom in" while it fades in (to simulate it popping up) i would have to think about a minute...
yup, put ur tweens, anims or w/e on each object that enabled when Awake() or Activated..
then ur main script has references to each (list or array of object) that loops thru them enabling 1 at a time
I think you could target rect transform via script with localscale or something like that to let it "pop up" for a few frames with 1,05 or 1,1 scale
But never used it so i dont have details for that
yea that'd work too.. just a bit more juice/polish
tweening libraries come in clutch for this type of thing
Thanks guys
Hi!
Can anyone recommend me a Github repo or Asset Store asset of a comprehensive UI system that has UI Modals & Popups system that support text, images, scroll text, icon-text,...
If it's easy to modify and extend then would also be a huge bonus
thanks!
are we allowed to ask photoshop questions here related to ui?
questions with using photoshop specifically? a space focused on that would be more suited to answer
yeah but i think i got my stuff already
but now i got an ui understanding question i think. let me figure out how to text it lol
so i've built that phone. the smartphone is an .png. if i want header i need to make new pngs with the background right? as the entire phone is 1 png for now.
not quite sure how i should handle it
you would have the actual phone as one sprite and then anything you want to display in it as separate sprites (or just normal canvas elements)
hmmm maybe i got an idea here
idk if the idea is the best but i made an header.png
i can just place an text oject on it
i guess this works for now 
just need to make the screen size perfect
The phone should just be a border, that blue background should be separate, so that you can put whatever "inside" the border area and not have to worry about duplicating the notch/ etc with each sprite that goes inside
If you wanted that missions bit to scroll, you can't do that with the notch present
i have it layers like this
delete the blue, just have the border as background and have the blue seperate?
it looks like this ingame rn
blue seperate, you'll still want a "back" of the phone in Unity -> though I'd have it white so I can set the colour to whatever I want in Unity
im completly lost rn. like this?
it is like this rn. the SmartPhoneUI is an empty gameobject. the PhoneFrame is the background with the entire phone image. the header is an empty gameobject with an image of the blue thing aswell with an text object and button. the missionlistpanel is an scrollview
the actual screen thing
I'm working on a dialouge system and right now I have the charaacters displaying character by character but now I want to make something so when you go to the next dialouge the text first flies away letter by letter. Is this possible
why wouldn't it be
hows the best way to make the buttons (the icons) make perfect spaces? i need horizontal + vertical as there are more rows. i cant just use vertical and horizontal grid layout. can i? the nexts are extra
i cant just use vertical and horizontal grid layout
why not?
right, that'd mean they exist as separate cells, but you want them to occupy the same cell, so make them part of the same object (have them both nested in a common parent)
so your hierarchy would be something like this
- AppButtons
- Mission
- MissionButton
- MissionText
- Mission
- MissionButton
- MissionText
etc
- Mission
🤨 idk about that... check your rect transforms to make sure they're bounded correctly
otherwise you'll be getting overlapping elements
the problem is i use empty gameobjects and they are always 0,0,0 so i have to manually make this stuff in the correct position. idk
im very bad with ui stuff
yeah but this position now is hella weird
please just use the rect transform tool
it'll let you actually see what you're working with
i gotta check that
make sure to set your anchors and pivots appropriately
how do i make it so i have 3 in 1 row and then can have 4 rows down of buttons with the layout group btw?
press T or the icon that looks like a rectangle in the toolbar
use the grid layout component instead of doing horizontal+vertical
that doesn't actually answer your question but it'll make your life much easier
set its size appropriately and it'll all fall into place
you think what is what?
its all in correct position
idk if left and right is the exact position but thats some math stuff i gotta do
you already have an object set up to align with the screen
you do not have to do any math
im so confused rn. i wish my english would be better, would make stuff much easier lol
you still have not selected the rect transform tool
i did before
ah ok at least you know how to
that.. does not seem correct
thats the empty gameobject
its this
yeah that's definitely wrong

make that span the area you want your missions to show up in
it's the one with the layout, right?
yea
it's the thing you define as "all the missions"
so make it take up the space that "all the missions" would be in
ScreenApps is the entire gameObject wich shows the timeText, AppButtons is the actual apps
actually u been right
im dumb
now my empty gameobject is on 0,0,0 aswell and it all does the magic itself ig
so u think i should not use the horizontal and vertical group
you want a grid, so why not use the grid
instead i use grid layo
it'll handle overflow into the second row for you
but now the icons got to 100x100 instead of 70x70 wich is the source
right now you have AppButtons on the entire screen, which would imply you want the missions to cover the entire screen
instead of just the area within the screen boundaries and not blocking the time
instead of setting insane padding, set the y position and reduce the size to make the AppButtons rect span the area you want your missions to show up in
(although you probably want to use stretch anchors to have easier offsets)
I just made a default Scroll View and attached two images to content, one off screen, and added content size filter, but content's size is still zero
What am I missing?
aight thanks Chris for ur help. im happy now.
what did you add content size fitter to, and have you checked the layout properties tab at the bottom of the inspector
i added it to content, and what do you mean by layout properties
these
can you show your hierarchy and the content fitter setup
and what do the layout properties say on Content?
the option to see them doesn't exist
this is just the default unity preset, do idk what's happening
man i am so out of my league with this lmao
Hello this is my set up for the UI for my game and im running into an issue where the size of my Image in my UI canvas is not matching up with the size of the sprite renderer in the world space. My PPU for all of my sprites are 16. Is there a more elegant solution than trying to perfectly scale the transform of the UI image object to the same size as the sprite object?
I wouldn't expect them to be the same generally. What's the use case?
The number of pixels for a sprite renderer will depend on the PPU as well as the camera orthographic size and the aspect ratio of the game window.
Likewise the number of actual pixels used for a UI element will depend on the Image component size as well as the canvas scaler settings, the render mode of the canvas, and the game window resolution
im just trying to make sure my UI images and sprite pixel sizes are equal and that there wont be any appearances of mixels.
this should be how it look
What's a "mixel"?
when image(s) have pixels that are not of the same size
i want to make something like this in my game canvas, if i add it using a different camera, i wont be able to click on it and move to that axis, Can anyone suggest a solution for this? thanks
Does any of u know how I can create a carousel horizontal UI view which I can scroll infinitely on, only show 2 buttons at a time and have smooth snapping? I literally tried, especially the carousel part, I don't think it even is possible in Unity, but if any of you know a way....
@knotty gate yes you can , you mean scroll last will loop from start? But you need to code the logic there is no default logic. It is 100% possible.
and it can take a day depends on your skill to code polished version of such logic
Or you can ask ChatGPT probably it is not very hard task for a ChatGPT.
unity is a general-purpose game engine, it has these capabilities
Do not dislike message that can save a day of development 🙂 we are in 2025 it is just a tool (any AI) to speed up development and you should use it in such cases.
it's consensus to not recommend it in most if not all technical spaces, including this one
@knotty gate here you can find the snapping system and probably more (was disble unshown objects, check scroll snap and Reorderable List probably that what you need): https://github.com/Unity-UI-Extensions/com.unity.uiextensions
Hello need help understanding how to assign a material preset to a font asset in textmeshpro
I've created a material preset of the base material my font asset uses but how do I assign it so it can appear in the material preset field?
Figured it out
Didn't realized it had to have the same prefix name for it to work
Trying to make regex for ipv4 input validaton. For some reason I can type this in the input field, but when I go on regex101 it doesn't accept. Any idea what the discrepancies are about?
It's definitely partially working as I can't type letters or anything
(solved, apparently)
Well not exactly as I'm still unsure on how to achieve full input validation instead of just character validation
im using horizontal layout in canvas
theres 3 elements the first and third appear correctly but the middle keep spawning in 0,0,0
when i change the sceen like by 1 pixel or changing the rect by any means then it appear correct again
is this me or unity
in the prefab window it appear correctly also but not when spawn in play mode
update its me, i have the content fitter component on the others
well you can't just type in a full valid ip at every step. i imagine you would have to do validation after-the-fact?
no but the regex I made matches to partial and full ips
ig I can use the event for a character being entered and then check the whole string then
how can I make the UI sharper and cleaner after importing into Unity? (Image on right is what I am aiming for)
like the whites aren't as bright and it doesn't seem as clean looking... idk how to describe it 😛
can somebody help me with my problem? I described it here https://discord.com/channels/489222168727519232/1400635589987930244, don't want to clog this channel with it again.
Turn off compression on the imported images
And change filter mode to Point perhaps
Where's compression setting at
i am using 'horizontal layout group' and 'content fitter' to give my text a background. however, the downside of this is that it changes my text position rather than my background. how can i fix this?
Right in your screenshot in the image import settings
It's not clear from your video which object we're looking at or how the hierarchy for these objects is set up
apologies. here is a full screenshot. the popup in the top right is what I am referring too.
am I blind or do I just not see it in my own screenshot?
I see the filter mode but not the compression
oh nvm LMAO
So it's unclear what the layout group is laying out here as there seems to only be a single parent object and a single child?
The layout group on the parent lays out child objects
So yes it's going to affect this text object since it's the only child object present
Does anyone know how I can get a font to render and look good? I've attached my desired effect and the effect I'm getting within Unity with Text Mesh Pro
the right one looks like your game view is probably zoomed in
any idea why i might get this row of pixels at the top where the canvas content doesn't render? the graphic for the timer background extends well above where it cuts off here, and other images on the canvas also can't render over it.
oh yeah it only happens in 16:10
or free aspect
https://discussions.unity.com/t/screen-space-overlay-canvas-not-extending-to-edge-of-screen/370020
found someone with the same issue but no solution
I can't select my TMP input field, any ideas why? I have it set up to a TMP_Text, I don't have anything obscuring it, it should work?
all my other UI elements work
I click and it doesn't select, I type and nothing appears
- something's blocking it -> test this by having ONLY the input field enabled, and as a direct child of the canvas.
- no active event system
- it's got raycasting disabled
Show where it is in the hierarchy
fixed it by now, thanks ^^
I use Unity on Linux Mint. In the editor everything is fine, but when I use the exported Linux build, my TextMeshProUGUIs do not accept any kind of umlauts or special characters like \ ß ] [ etc. They just don't appear. Anyone knows what could be the problem?
How does a HUD scaling game menu setting work in Unity? Does it scale the scale property of a Canvas. All elements of a canvas? Some hidden Unity property?
hmmm.. maybe the the slider for match width/ height on the 'canvas scalar'
or the reference resolution
or the reference pixels amount
All child elements of a canvas should be a uniformed scale of 1,1,1 - otherwise you're asking for issues.
The slider makes sense..
Although it actually wouldn't scale but just change the preferred direction
it would change it on mobile, I can't remember how it acts on a monitor
Hi, how i can make textmeshpro have a backgrounf that expands depending on the message?
@low pike you can see my canves and how some text are off the spot and in the other one the close button is off so is the world chat and private is to the left
Had a script to fix my full screen panels for shops and other's but but would like to hear if my canves is wrong and can be fixed so i don't have fix each of them on it's own
you've probably not anchored the misaligned things to the top
you've not shared all relevant setup screenshots
use screenshots and not photos.
hello there
is there a common way to make a dynamic UI grid layout?
I just want to have one container that can be expaned into their parent with a couple tiles inside that auto expand given a fixed row & column count
If the cells don't need to resize, then the grid layout will do you.
If the cells do need to resize.. then.. you either have to write code to update the cell size on the grid layout, or find another solution.
Normally I use nested vertical/ horizontal layoutgroups.. but that's always been for set widths/ scrolling
https://youtu.be/lT888AlHnzI?si=1XEgddiBMvncbXvg
I need to make this better and I’m such a scrub when it comes to UI. Any suggestions?
I'm so bad with UI, and this is poorly organized. Help?
how do i make the child to fit it's parent? , i tried using content size fitter and layout group
Just a regular stretch anchor preset
To the child or the parent?
select the object you want to make fit.
set the anchors points of that object to be correct for the parent.
it changes during runtime
what's on content ?
The child. Anchors control a child object's relationship to its parent's layout
when i set stretch its changing to left/top during runtime
Because you have a layout group on the parent, no?
i disabled both content size fitter and layout group, and set everything in the scrollview object stretch
the prefab too
Hello, i used a youtube guide to make scrollbar but i've met some problems. Is it possible to set up starter position to component with content size fitter? Every time i launch game it's moving it to the middle. And 2nd problem basically same inability to set up starting position bc if there would be not enough panels then they would group in center instead of being on top of the list
set the pivot to the top, so it expands from that point
iirc i've tried to do so and it still moved position to center every time
are you using the scroll rect layout group
My scructure is
gameObject (scroll rect, rect mask 2d) (1 pic)
- gameObject (vertical layout group, content size fitter) (2 pic)
-- panels
- scrollbar
getting this strange issue in text mesh pro (in build)
while it supposed to be like this
show your setup (TMP inspector - inc recttransform) and the code to set this
the origin is off center how do i make it center?
This isn't the 'origin'. It's currently the 'center' of what is selected.. which is the middle of this object and any children.
Some things to change, to work with UI properly.
1- Set the scale back to 1,1,1 - UI scale should always be kept at 1,1,1. If you want to change the size of things, change the width/ height values.
2- Press T to use the UI gizmo tools -> blue circle is the pivot.
Outline don't appear in my text mesh pro, please help
you need to provide some more details
like show the TMP Text settings, show the complete stuff so we can help you
@modern owl Here is the textmeshpro component settings
I downloaded this text from Google Font and use Tmpro Font Asset Creator to create font
Here is the shader settings for same font
@modern owl I put this settings when create font and its work fine now!
nice work
Im trying to get a rects world space position for a spawning a visual effect. It does however always end up further down in y. I do have a flexalon layout and a paranet that dynamicly moves up and down and it seems like it doenst take that into account
Does ScreenToWorld actual get the actual world poistion? The rect transform is really small so its not its bounds that are the problem.
Is there any simple work around?
Vector3 testpos = visualLayers.visualEffectSpawningPlace.position;
testpos.z =- Camera.main.transform.position.z;
Vector3 pos = Camera.main.ScreenToWorldPoint(testpos);
VisualEffectManager.PlayVisualEffect(visualEffectsEnum.cardKill, pos);
How do I make height match up? I wish there was a way to size proportional to parent (e.g. 50%), would make everything so much easier....
what you're doing with z here is suspicious and weird. Is the camera always facing a specific direction? This won't give the right results if it has any rotation
there is, set the children RectTransform anchors so they expand horizontally and are anchored proportionally to the parent. Assuming there is a RectTransform container that "Item Image" and Item Stats" exists inside, you can set Item Image anchors to Min (0, .5) Max (1, 1) and "Item Stats" anchors to Min (0, 0) Max (1, 0.5)
ohhh thank you
Yes it is always in the same direction
identity rotation?
yes
But it might be the problem, I have tried diffrent things, this was to get the intersection a z=0
but might be wrong there
it si ortographic 2d
it is
aren't you trying to spawn the effect in front of the camera? usually you'd pass at least nearClipPlane + some tiny delta to avoid frustum culling
I assume you tried spawning a simple primitive at the result location to eliminate any issues with the visual effect right?
I actually havent but will do that straight away, just assumed it had to do with the ui
Im trying to spawn it on top of an ui element (will have to do a separate camera or something to actually get it to render on top)
that's okay, the right render order can be dealt with later. Just make sure it's spawning in the right position first. If you're trying to spawn something on world z = 0 and the camera is oriented facing +z, testpos.z should be the camera z pos since that's the distance from the camera to the origin
Im still a bit confused on how that method works and the documentation doesnt really explain it well enough for me. When just using the camera z (-10) it ended up on -20 with the negative version they end up on 0
(x, y) are in screen space. z defines how far in front of the camera the plane that you will be projecting the ray onto will be. If you provide a negative value, this will be behind the camera. By your description, you had the camera at (0, 0, -10) facing +Z, so -10 for the testPos.z would result in the point being projected onto a plane 10 units behind the camera
yes therefore the negation, with pos.z i end up at -20 and with it negated i end up at 0
but like i said, i feel kind of supid and confused rearding this so not sure how to handle it
and appriciate your help
Im trying to make a pixel 2d UI with a 570x320 image. Its native size is 570x320, its set to that in the image, the camera has pixel perfect camera with 32ppu, the canvas resolution is 570x320 with 32ppu and scale with screen size, yet the logo is too big in game.
I always have a hard time with UI stuff
I'm trying to create my own TMP font with a custom font atlas. I'm so close to finishing, I just need to swap the font atlas texture of this base font with my own. How exactly do I do that? I've heard to replace it using a debug menu but the option doesn't appear when I open the "3 dots" menu in the inspector of the TMP font. How do I do this?
(I don't know if this question is suitable for this category, I hope it is?)
Is there a way to keep the pivot at the center of the text when I scale frame of TMP?
no, the TMP frame is added on top of whatever your recttransform settings are, you should use RectTransform for the majority of your layout and alignment, and the TMP adjustments only for font-relative tweaks.
What is the purpose of the Canvas/Button property "Raycast Target" seeing a lot of mixed discussions on the forms.
It's there on all Graphic components. It determines whether the GraphicRaycaster can see it or not
it will not be interactable if that's not checked
I don't think there's any ambiguity around it 🤔
Is there a way to hide these TextMeshPro and EventSystem icons? These icons are visible even when the game is running.
turn off gizmos
or turn off those specific gizmos
Got it, thanks!
Hey everyone! I’m developing a game like Minecraft for VR devices and am currently stuck at a brick wall: the hotbar and inventory. As a fan of implementing UI elements into the physical game world to increase immersion, I want to create a system that would work for the slots and have an expandable menu or a separate menu that opens into a full inventory. The game has an industrial-revolution type feel to it, so there’s gears and shafts and belts (basically just create mod) to fit with that aesthetic. Anyways, I would love help from anybody or come up with ideas for the inventory. I don’t want something attached to the player’s body for accessibility reasons, especially not a ui panel on their arm. I would prefer something that would be attached to the arm, and expand into a full hotbar, then you could expand that into a full inventory. Thanks!
my ui button image sprites are making holes through sprites and acting weird does anyone know a fix for this i cant find anything about this issue online
What are you using to render that modal etc?
Also noting you're using a special material here
What's this shader?
Are you sure you should be sharing that?
Looks like a paid asset on the asset store
idk but i tried different shaders and it has the same issue
Certainly I think it's an issue with this shader. The product advertising a UI masking feature
Try removing the custom material
I also assume the background UI is using that shader too
do you have any Mask components in the hierarhcy
no
its an issue because you can see the edges of the image and stuff
even though theres nothing
Any of y’all know how I should go about getting it so that some of my UI appears in front of players, and some of it appears behind?. I’ve been trying to use Camera stacks with culling masks for each one, but no matter what I seem to do, I can get either the front or back UI to render properly, but never both.
use Screen Space - Camera canvases and set the Plane Distance of one closer than the player and one further.
you can also use an overlay canvas for the one that appears on top
and a SS-C canvas for the one that appears below/behind
Do you mean the clipping planes on the camera?
No I would have said clipping planes on the camera if I meant clipping planes on the camera
What's weird is that I don't see the values for setting the canvas type and their plane distance
that's because this isn't a root canvas. Those options are on the root canvas
OH! Thank you both 🙏
I got it working :)
why does the worldspace canvas attached to that pistol move depending on the camera position?
it's meant to be directly above the gun
here is a recording of the issue
is your camera in perspective or orthogonal
orthographic
Definitely looks like a perspective camera issue
WAIT
i forgot i had an overlay camera for ui
yae
ah, so that's why the other stuff doesn't have perspective lol
thanks guys it looks beautiful now 🙂
Does anyone know why my pannels dont show Fullscreen after I build my game, even though I have it on Scale with screen size, Its a bit zoomed in
are they properly anchored?
wdym by Anchored?
Thnx
Yes they are
I didnt even change their values
can you show how they are set up?
If you didn't change them, it's likely not anchored properly to be "fullscreen" as you mentioned
Why does this key look weird?
Other icons look normal but this one doesnt
its nothing about the background size. I guess i need to change it from sprite editor and I tried to do it but i couldnt so i need help
weird how?
colors? shape? Something else?
how is it supposed to look?
the shape looks weird
its like fat
horizontal
In your UI image component enable "preserve aspect"
now i cant but i will try it tmrrw tysm
How do i "reset" the UI text? Its staying on all the time XD
deactivate the GameObject
I still want the UI to work though. Deactiving it just removes it
deactivating does not remove it. It deactivates it.
You need to be more clear about what you're trying to do.
You can reactivate it later as needed.
I understand, thanks. I only want the text to appear when i complete the level or when i die.
activate it at that point, and then deactivate it when you want it to disappear
there is no preserve aspect
because you haven't assigned a sprite
you can either:
- temporarily assign a sprite and enable it
- set the inspector to debug mode and enable it
- enable it in script
IT WORKED TYSM
So is there a reason a UI button might lose its event source like this if the object it's attached to is disabled and then reenabled?
Missing means the object was destroyed
Are you sure it's being disabled/enabled and not actually destroyed?
Hello, I have a problem that is hard to explain.
The problem is with Cursor Locked in Starter Asset Third Person. If I click somewhere outside the game window, the UI starts working as it should. Another problem appears—the cursor constantly hangs on the screen, and if we hide the UI and do the same thing, it works too.
Without these cursor manipulations, Cursor Locked does not work, although it is displayed in the inspector.
In short, take a look at the video.
Guys, can I get some help with this? I have a TextMeshProUGUI where I change the text dynamically, but when the text has a <sprite> tag and I switch to new text, the sprite stays on screen, overlapping the updated text. I’ve already tried calling ForceMeshUpdate() after updating the text, but nothing changes, the problem persists. There is a screenshot of what is happening
I'm using Unity 2022.3.21f1 and TextMeshPro v.3.0.9
It was. I misimplemented a singleton pattern
I have a question on how to make it so when you scale the game window instead of it just showing more of the scene it just up scales the entire window by y axis, heres an illustration of what i mean because im not good with words lol
Letterboxing.
Done by a combination of zooming the camera (according to your needs) and adding letterboxes (the black bars)
Hi. I would like to know what's the proper way to organize large-scale UI. Pause menu, Game Over menu, Main menu, Inventory, etc.
Is it adviseable to have multiple canvases, for example? Tips like these would help figure out my problem.
The unity editor has input boxes where you can click & drag your mouse over the label and it changes the value. It's a nice compact design instead of sliders and I prototyped the same in UGUI. But anyone seen this elsewhere? I don't know if it is a common thing
pretty sure photoshop does it (therefore prob all adobe?), davinci resolve
Hey can anyone guide me on creating Glassmorphism UI shader using HLSL?
Hello i made an UI button but the TMP (child of my button) has a too big transform so i can press my button even if its far from my mouse. does something like raycast target but for TMP exist ??
yes, TMP component > extra settings > disable raycast target
ty 🙂
I believe this is the right spot for this...
Why is my image taking the color of the panel?
is it perhaps slightly transparent?
check the color on the image, make sure alpha is set all the way to 100, then i guess you'd have to check the image itself
Hello, my game is entirely based on UI and I would like to find out how to add this effect in my game that "pixelates" each UI element just a smidge. Can I use shaders to do this? If so, does anyone have any examples of using shaders to do this? Let me know if this isn't the right place to post this.
I've successfully added my content code wise to the game under the parent of available cards panel but it's appearing outside of the panel itself, is there a way to make it so the children of the parent are in the visible area of the parent?(green box is my content, the gray box is the area I want it to spawn in)
what components are on your card prefab?
some text boxes and an image
those are not components - those are GameObjects
Can you show the code you're using to instantiate the card?
what's the website to send code?
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Ok so for one, this line can go away:
btn.transform.SetParent(availableCardsPanel);
The parent is already being set in your Instantiate call.
For two - you need to edit the prefab and anchor it properly
See how the pos x and pos y are -427 and -148
first off set those to zero.
Are you using a layout component in AvailableCardsPanel? e.g. GridLayoutGroup?
so if it's a child, it will do an offset that is relative to the parent's location?
yes
ok, and should I add GridLayoutGroup as a component of AvailableCardsPanel?
ok
after that yeah you probably want to add a LayoutGroup of some kind to the panel so the cards get laid out automatically
it makes it appear now, so that's good
but layout group would help for displaying a set of items
Yep - you can look up HorizontalLayoutGroup, VerticalLayoutGroup, and GridLayoutGroup
can anyone help me figure out what ui tools i should use im not sure if i should use toolkit or if theres an easy solution for this i want to have panels you can scroll through and open up information about like this
How do I make the scrollbar update when the rect has more items to scrollthrough?
you need to resize the viewport
content size fitter on it perhaps?
having UI button problems with hitboxes not matching stuff at all #1407037665869693099 message
Hi 🙂 I'm using Unity 6000.1.9f1 and UI Toolkit with a simple button associated to a style which assigns a font to it. While it works well, the font is unassigned from the style when I relaunch the editor.
Has someone ever seen/heard about that behaviour? Thanks
should ui be a seperate prefab or a child of the player...?
Depends on what kinda UI imo
