#📲┃ui-ux
1 messages · Page 32 of 1
Surprised it let you do it at all... 🤔
Yeah same lol
The lighting effect appears on the sceneview but not gameview, why? (Textmeshprougui)
Use world space for canvas
what's the best way to make a Vertical Layout Group also take into account the size of child objects? (the component is on the 'Tab' game object)
Use LayoutElement on the children
Alternatively, if the children have variably-sized children of their own, attach another layout group
Yo, I have a texture with digits 0-9 that I'd like to turn into a font to use as a score. Is there any way to do this?
More specifically, I'd like to turn this texture into a font asset that I can use with TMP
There's no easy way to turn it into a font asset, no
You can use the sprite rich text tags to embed sprites into text, but it won't be a real font
Has anyone ever had any luck creating a game's GUI entirely through SpriteRenderers, without using UGUI or UI Toolkit? Right now I use UGUI, and most of my UI is constantly being animated with tweens which significantly impacts performance even when the UI uses multiple canvases. I am just about ready to abandon UGUI fully and try my hand at converting my game to utilize a SpriteRenderer-based interface system, but I am having a hard time finding anyone online who has already done this sort of thing. Its not that I want to find some existing solution where all of the work is done for me, but rather I am hoping for some sort of indicator that implementing a SpriteRenderer UI system is not a fools errand, and that it is a possibility that such a system would yield better performance than UGUI.
my understanding has been that e.g. DOTWeen is significantly more performant than animators for UGUI, is that not true?
That is my understanding as well, which is why I do not use Unity's animator component; I use a custom tweening system that is similar to DOTween to animate my UI.
Have you tried DOTween itself to see if their performance is better?
According to the profiler, the UGUI canvas update call is the primary source of performance drain while the UI is being animated, not the tweens themselves.
yes but the way you tween may affect the UGUI canvas update
Also consider that the final form of a sprite renderer based UI is UGUI. Bad performance usually comes from deep/complex nesting and layout groups. If you animate color, rotation and scale and keep positions that invoke layout groups mostly unchanged you may get better performance.
how do I edit the gradient? whenever I click on the bar it just moves the node around
when you click on it (the gradient box) you get the usual panel for editing it
Why is the text overlapping like this?
It's a TextMeshPro UI with a ContentSizeFitter where the Vertical Fit is set to Preferred Size.
The example text I used is "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc ligula, tincidunt vitae sem at, venenatis iaculis elit. Nam eget diam vitae enim lobortis ornare sed sed massa. Nam in.".
is the text set at run time (dynamic)? or is it like this at edit time too
Both:(
record a video, encapsulating the entire editor - and show your setup.. select the TMP game obejct and its parents, one at a time, leaving it selected for a couple seconds so we can see the inspector (scroll down if required)
Thank you
Two things to try
- simply toggle the object off/ on
- change 'overflow' to 'wrapped' .. IIRC that's an option there?
Turning it off and on didn't work,
and it looks like there’s no "Wrapped" option in Overflow. 😦
text wrapping mode
leave that at normal.. I was getting the two fields mixed up
I wonder if the text has some invisible thingies in it - cut the lorem ipsom -> paste in notepad -> select all -> copy and paste back in Unity
Done, but without effect.
I thought it could be the character "\r", but the FixText script that's attached removes it in the update, just to test, but even with that, it still looks the same. 😔
what's \r suppose to be doing?
It is called the "Carriage Return Character."
It is a control character that moves the cursor to the beginning of a line.
you want \n
Not really, I would like the line breaks to be done automatically 😦
Ok, I just discovered what it is, the font.
I changed it to another one and now it looks good.
That's weird, I won't use Baloo again.
Thanks, @low pike !
Wonder what was wrong with the font!
possibly an "issue" with the font asset creator settings when you made the sdf?
Hmm, could be haha.
For now, I’ll use another font that works.
If I discover something, I'll share it here. 🫡
does anybody know why i dont have that bell curve in my unity version (iam using the newest version ) and is there a way for me to get that bell curve iam also missing the reverse one
ok thanks i dont rly know how to get the exact funktion i thought the bell curve was somehow built in i just want to use it for bullit curve animation but maybe its not neccessary to have the exact one
is there a way to use an images alpha as a mask?
i haven't really used masks much. im trying to make some text fade out along with an image that fades out using this shader.
the shader is just some noise that fades to either black or white depending on the fill float
currently it looks like this.
I'm pretty sure there isn't an in-built way to do it.. but I think this would https://assetstore.unity.com/packages/tools/gui/ams-ui-soft-mask-282501
yeah that seems perfect. cant afford it right now though 
its a pretty minimal thing anyway. maybe i'll add it later when i can afford the asset
took a little set-up but that worked perfectly, thanks 
just noticed an issue. changing the fill on the material no longer updates it. unless i reimport the material or enter playmode
You may need to edit a copy of the material created by the soft mask system
See if the materialForRendering property of your Graphic works
that's where Unity puts the copy it makes when doing its built-in masking
Hi, I have a UI canvas which I scripted to disappear when the scene loads and it works fine, but when I load the scene from another by using LoadScene it doesn't disappear anymore, any ideas why?
: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 #854851968446365696
what other information could I possibly provide
there are no scripts attached to the canvas either
Screenshots of the setup.
The code of how the canvas is disabled? destroyed?
A screencapture of the issue.
What you've provided is basically the same as me saying, I've got this piece of paper, what colour is it?
I posted in code beginner but they didn't know
first I get the canvas in awake and assign it to a variable, then in start I disable it
this is all of the code associated with the canvas disappearing on scene load
these two videos show what should happen & what is actually happening
This is also useless.. how do you expect me to see what the code path is doing with two tiny lines cut out like this
!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/, https://scriptbin.xyz/
📃 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.
It isn't though, is it
there is no other line of code associated with it that's the thing
What method is UI.enabled = false; in?
How is that method called?
Where is the UI.enabled = true;?
UI.enabled = true is irrelevant for this
as I said in the comment UI.enabled is in start method and I find it in awake
how is the enabled true not relevant?
The black alphad image popping up is the issue, yes?
the issue is that when I load the scene in from another scene (using LoadScene) the UI shows up, when usually it's supposed to be hidden when the scene starts
the black alphad image is me pressing the menu button which should also show the menu when it's up, and hide the menu when it's down (which it doesn't)
Gotcha
Double check the canvas is still asigned
and you shouldn't be using GameObject.Find(string)
It's slow, and prone to errors that are easily missed - the IDE won't know about them
it's being assigned correctly, I also tried using the Canvas object instead of the actual canvas but the results are the same
should I just assign it in inspector then?
Yes
unless you need the canvas for other reasons, you'd also probably be better off just toggling the gameobject of the Canvas instead of the canvas component
dragging it over in inspector (both object and canvas component) don't seem to change anything
is this persisting between scenes? because awake/start only run once
from the vid it doesn't look like it is
it happens whenever I load the scene through LoadScene (but not when I load the scene by itself in the editor), awake/start only runs when the object is instantiated right?
no, when the gameobject is first active
so then it should only run when the scene is loaded since I don't have it anywhere else and it's not DontDestroyOnLoad
yep - when you assigned it in the inspector, did you remove / comment out, the Find code?
not at first, I tried it now but it just gives me exceptions
nvm I was being dumb
I forgot I had to reassign it in inspector after commenting it out
it works now, so I guess it was an issue with the GameObject.Find instead of any UI shenanigans, thanks
just FYI - if you assign something in the inspector, and keep code doing a search.. whatever the code finds (or doesn't) will overwrite the inspector, so could end up null
huh, didn't know that existed but that fixed it, thanks for the help 
@here hey i have this main menu and i was trying to get the light to be part of the screen but since i used quad its doesnt seem to be part of the screen can anyone help me with that ?
Hi im struggling to set the button ui bitbox to the same size on the image anyhelp
It needs to be in view of the camera if you want it visible.
But why not use UI elements?
i have no idea what it is
is there anyway to make transitions between canvases? i hate the sudden cuts that it as and i want to make a transitions
DOTWeen is a useful tool for interpolations
never tried before will look into it
tyty
Quad is rendered in 3d and out of screen space so its obviously not gonna be part of screen.
Since you are using green screen image and have setted up a mask shader for quad instead you can create a canvas shader and use the same logic and then add that material into your ui element.
Here is a short tutorial https://youtu.be/iCrCNnYkwCA?si=fwfsOeVll8G8hPsu
In today's video, we look at how to make your interface look better using Unity's Shadergraph Canvas Template.
Chapters,
0:00 Intro
1:00 Rounded Corners
1:50 Gradient
2:30 Panning
3:35 Outro
Subscribe for more,
https://www.youtube.com/c/vrwithandrew?sub_confirmation=1
Support my work,
https://www.patreon.com/VRwithAndrew
Discord for stuff,
h...
Hey all! Having some scroller issues with some content that I think my setup should scroll with though not having any joy - hoping it's something obvious I've missed!
In unity 6, 2D, I have a 4 cameras pointing at different scenes. They render to 4 textures in a box, and a final camera is rotating to look at the render textures of the box. It renders to a final texture in the UI. This generally works well, but occasionally it feels like the render textures are not redrawn each frame so you get one frame of an old scene. Does that make sense and how can I force them to render each frame in the correct order?
hey I'm new to unity still learning how this all works but I am confused as why when i scroll it goes back to the top even though there is more content below? I have attached an example and my Hierarchy
Canvas_Player has the Scroll Rect with the content set to BottomHalf_TopHalf
this happens when you don't resize the 'content' game object to fit the children within the rect transform. Put a content size fitter on the 'content' game object and set it to resize
Im trying to follow Code Monkeys tutorial videos for creating a some dialogue. I have this little tutorial guy and my goal is to press E multiple times for him to say a few sentences within a dynamic chat bubble and for the letters to appear one at a time. I've spent a few hours trying to get this to work so bear with me trying to communicate everything properly.
Since I don't need every function he created for this purpose, I did skip a few things in the videos but I don't believe that should be causing the issues Im having.
Basically, in one video he creates a TextWriter class that does the showing one letter at a time via controlling the alpha property of UI Text. But in another video, he calls that same class while using TMPro, and I think this is the issue Im running into. If I follow the code like this I get error "cannot convert from TMPro.TMP_Text to UnityEngine.UI.Text on the line where I am calling the TextWriter class from another script. If I go into the TypeWriter script and try to change each instance of the variable "Text" to "TMP_Text", then this line does not working correctly and results in the video above: text += "<color = #00000000>" + textToWrite.Substring(characterIndex) + "</color>";
Im at a loss, sorry for the long wall...
You can't have spaces on either side of the = in rich text tags
I spent so many hours on this and this was the problem lmao... thank you OML
@sharp oracle yeah but it looks good when i run it insite the editor
why does it get messed up after the build?
Different screen sizes probably
its set to scale
It is this many pixels from the center. If your screen is a different size, that's going to be a different position
that still doesnt explain it hmmm
cos my screen has higher res
so if anything it would be closer to center rather than cut outside?
how do i make the UI independent from the screen size? (fit any aspect ratio on a pc)
Depends on your scaling mode and aspect ratios
Design it with sensible anchors and avoid using hard-coded size values as much as possible
sorry im brand new, i looked at anchors in the documentation but what is a sensible anchor?
and how do I not hard code that pixel value?
if i try zero displacement with top left anchor it would not be right
Anchor it to the corner, not the center.
Change the pivot point of it to the top left of the rect.
Make sure the Game tab isn't set to "Free Aspect"
how do i not hard code the displacement?
I mean, that's centered on the corner all right. Change the pivot to the side you want to base the position off of
what if i actually wanted to have something that does not have a 0 displacement?
how do i prevent it getting messed up?
by doing the things you've been told
☝️
I... have sorta of an issue with the sorting of sprite layers. My guys toggle a sprite on top of them when they die to indicate that they are dead. That works fine, but since they are sorted on a layer on top of the sprite of the character icons is meant to be in, they get on top of ANY other character that passes over (image 3) I don't want that to happen, I would want death character to have the lowest priority to show over all other characters. I could do that by code with a messy way of placing ALL the sprites lower in the sorting layer while they are dead and back up again when they are not, but... I was wondering if can do some other simpler trick to solve that
You anchor things to the correct position.
You set the pivot correctly for that anchor.
You make use of things like layout groups where applicable.
You test on different aspect ratios.
ok cool thanks
Sprite? This is a UI channel.. do you actually mean SpriteRenderers? Or Image components?
I do consider sorting layers part of ui???? Sorta??
No
This channel is for the UI system, UGUI, and how to use it. SpriteRenderers don't come under that
You should delete from here and post in #🖼️┃2d-tools (check this is suitable first.. ) or #💻┃unity-talk
Well, sure, but they pretty much work the same on that 🤷
alrighty - you are wrong, that does not come under here.
I'm trying to make a video render behind some objects in my projects, it's in the UI and I'm wondering how can I change the order at which it renders so that it appears behind, basically it's for the background
if someone is willing to help me ping me
please
:3
make a Screen Space - Camera Canvas and set its Plane Distance to something large like 1000
put the video player on there
how do you make a screen space
It's the Render Mode/ Render Type setting in the inspector
do you want to join vc so you could explain it to me so we can see together
no]
ok
It's just a single setting in the inspector
On the canvas component
oh ok
I was looking in the camera inspector thing
ok I found it
thanks guys
@low pike @mortal robin
ok it works now
thanks
Hi, guys, trying to set a scale for ui for different resolutions. I use canvas scale with mode Match scree size. It works, but in 1910x1080 it looks too small. If I adjust it, it looks very big in 4k. How can scale it properly? What value should I set as reference resolution in canvas scaled component? Looks like I need some nonlinear adjustment
You’ve answered your own question. The assumption the scale mode makes is that resolution changes but not apparent size of the screen
yes, should i make a custom canvas scaler?
Depends on your project. It’s not something that’s commonly done.
It also makes your UI design and maintenance more complicated
consider that people do not sit closer to a screen because they have more resolution, they sit closer because of screen size.
i have 42` tv and yes, the ui apperas to be big, but, in other games, it looks better
so what can i do?
on my asus rog with small screen it looks ok, but on tv ui is very small
the theory says you make a UI for the typical apparent screen size (not resolution), i.e. ratio of view-distance and screen-diagonal. And use the said scaler to make it appear the same indenpendent of resolution.
you would potentially make a platform switch, i.e. TV vs PC monitor
for that you could simply swap the scaler settings once (i.e. tv mode, pc mode, not continuously).
while you are at it, you could consider making another switch for widescreen monitors. but that often requires a different layout too (since you could theoretically show more columns/panels).
so do you mean i make ui, changing for the screen size and make additional scaler that player can adjust?
and i cant make presets as i cant know the screen size.
i would do this: make a standard 1920x1080 ui that works and looks good, allow the player to scale it down to half size, make all your UI layouts compatible with that scaling. To do that, you don't need a custom scaler component.
" allow the player to scale it down to half size", you mean in the settings
yes
and you can obviously initialize that value based on platform (TV vs PC)
your goal should be to not add extra work to your UI design/maintenance workflow, its a time-sink as it is.
yeah, i think not many people a sitting in front of 42`, so maybe my case is special and ui is scaled well already..
thank you
all images are 100x100
Untick Child Force Expand I believe.. then go and resize the rect transforms back to the correct width
Anyone know why whenever i add UI to my game it just doesn't let me move
or well in more broader terms
It just completely freezes the game once i load in for example, no background music nothing is moving
things like that
ok, 1sec
so can anyone help
works, thanks 🙂
show a video
ok ill try make one i havent really done much with vids but ill give it a go
its not hard to do a screen recording
winkey + shift + r
I use shareX for quick things like this, but there are other ways ☝️
the game bar needs to be enabled for that one tho
i cant press start game when usin windows shift r
oh i can do ctrl p
gimme a se
stupid file limit
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.
I'll just explain it:
So when I have the canvas turned off of on the heirachy i can move around smoothly and efficiently, but when i have it turned on, its like my game never started even though i pressed start
a canvas has no affect on movement
you're doing something with it to stop input or something else
I know that. but it just wouldnt let me move or do anything to interact along with the moving objects just frozen in time
so figure out what is on the canvas that stops it
disable all the child gameobjects of the canvas, if you still have the issue.. its something you have on the parent object.
If the issue doesnt happen, its on a child, enable them one by one until you get the issue
I'm making a health bar btw
Ok so i figured out whats happening kinda
so how big of a file
can i make a video for
like 10 seconds?
discord free allows 50mb upload?
it tells you when you try to upload something too big..
18 seconds of waiting for you to press play and load 🤦♂️
no but
u see how when i turn the health bar thing on
the game just paused
and just stopped loading
yes, you must have something in your health component that does causes an error.. and you have pause on error enabled
or maybe VS is connected and debugging with a stop thingy
my point was, don't press record and then press play.. you waste so much time (mine and yours) as well as file size, just waiting for the editor to enter play mode - over half the video was just this.
my bad sorry
yeah cuz im following a tutorial for it and from what im aware ive done everything the exact same ill go over it again and ill go from their
This is the last time im asking about the ui i think i just need help pairing together some sliders
more specifically
the value slider from the value component to a script
this is all I think is left till I can do well
Say on god
I have a font here where the letters ö ä ü don't appear in unity, however in a font viewer, these letters do exist. Any way i can fix this?
(yes the font is applied to the TMP Component)
are they part of the font asset?
How do i check that?
How do you use TMP Text with SCroll rect. I made TMP Text display all text at once using content size fitter. then put it into the content gO of the scroll rect. Apply the content size fitter on the content gO as well but it collapse to 0 size.
click on the UpdateAtlasTexture or scroll down to the glyphs list
I changed Character set from ASCII to Extended ASCII, Regenerated the Atlas and saved, and the Characters now work properly. Thank you very much :D
What’s a good way to get an icon for an item and an outline?
Like I’ve got some weapon models and I want some icons of them to put in the game.
But taking a screenshot and tracing it in Paint or something sounds inefficient. There’s gotta be some website I can just upload it too right?
I imagine that’s something someone do in Photoshop but I don’t have that nor do I know how to use it.
For in-game icons I often have something like a "photobooth" scene I set up, where I just feed a list of prefabs into a script, it spawns each one, takes a screenshot of it, saves it as a png.
As for an outline you can use an outline shader.
Thanks for pointing me in the right direction.
Thanks for pointing me in the right direction.
there is also this (and the general principle of it), you can use it together with a "photobooth" scene: https://openupm.com/packages/com.yasirkula.runtimepreviewgenerator/
can i change the image of a button or run some code when i hover over it?
Yep
how?
https://docs.unity3d.com/530/Documentation/ScriptReference/UI.Selectable.OnSelect.html
i tried this but it did not work
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
OnSelect isn’t the hover state.
that's for when the button is selected
- for the image switch just switch the button's transition to Sprite Swap mode and set the hover button
- for running code in general when mousing over either put a script with IPointerEnterHandler or attach an EventTrigger component to it
How do i fix overlapping
is this actually a canvas?
graphics on a canvas get rendered in hierarchy order
Why do I see the difference in clarity in my UI between the one designed in Figma and unity
Ik figma works with vectors and unity works with raster graphics
is there a way i get the smooth and crisp UI as seen in Figma into Unity?
Also.. I need to give outlines to some text in unity. Ik 2 ways
one is using the traditional text and then use outline component to it
other is using tmpro and create font assets with the changes in outlines or any other
Whenever I use TMPro(coz its handy and easy), I have the below problems
I'm unable to give outline outside the text, it always goes inside
there is a patch that's being applied to the text
any idea on how I can get my required result?
Make sure the SDF has enough padding when you create the font asset.
Make sure the font size is > 1.
Make sure the rect transform scale is 1,1,1.
I have a menu that has Play, settings and exit buttons. However, I want to add a fade screen so for that I added a black image. I put it on top inside my hierarchy so it would block everything. But It does not block the visibility of my buttons. What is happening?
It looks like this even though my black image is on top of the buttons
Show the setup
Menu is an asset. What part do you want to see? It has post processing and such.
the setup of the canvas(es), and hierarchy of it all
menu is an asset
Asset can mean a lot of different things,
so..
Main has - play/settings/ etc?
FadeScreen is above
Do either of these have a canvas component?
Only the Canvases have the component.
I mean Canvas_Main and Canv_Options
Like this if this is the correct way to search for components
nah, I did mean this - I intentionally used the same name / style that is in your hierarchy
Just as a test, to rule it out.. disable the Animator component. I've never used these with UI, there's a possibility it is doing something that messes with the draw order
I did now. Buttons are still visible
what's on VerticalLayout and the buttons ?
it's world space canvas too... what Z pos is the FadeScreen at?
and everything else is at 0
I'd put the fade screen on its own screenspace canvas tbh
Let me try it
It makes sense to do so, it's a fade to hide the entire screen - doesn't make sense to have it on a worldspace canvas
Should I shove my canvas into the Canv_main?
up to you
I made it like this but the background completely disappeared now
well, actually .. no you can't. it'll be a child of a world space canvas then
Yeah I did not make a child
right.. now fix the image ..
When I stretch it to the whole screen it does not affect anything. I tried to position it in front of the buttons. I can still not see it
Made it white so I could see it
your values are entire wrong.. have you not worked with UI before ?
set the scale to 1,1,1
set the stretch values to 0,0,0,0
and rotation back to 0,0,0
No sorry it is relatively my first time
it's np
Screen space canvas (overlay) renders to the screen space.. so if you look at it in the scene it's fucking huge. You do not position it in front of the camera, if you do this it isn't seen (it's off the camera)
Ahh so it was so tiny?
Ah okay. Thanks a lot for your time and patience!
should press T too, to work with the UI tools
👍
For Screenspace UI, keep the scale of everything at 1,1,1.
For worlspace UI, the only scale that you should change below 1,1,1 is the canvas - scale it to the right size for where it's going, all other elements should be at 1,1,1.
Always use the width/ height fields to change the size of things.
You can end up with weird and unpredicitable changes in scale, rotations, if you mess with the scale and don't keep it uniformed.
(It's ok to change the scale if doing animations, eg: 0 -> 1 for a pop in or something)
All right got it! A simple question while I'm at it. Do I have to do anything to make my fade screen block Interaction with my buttons while its active?
So I dont press my buttons while fade screen is still fading?
I ticked the raycast target.
You need to make sure 'raycast target' is ticked on the image (like you've done)
And make sure the canvas has these componets on, if you removed the graphics raycaster, this canvas wouldn't receive the raycasts and your buttons would be clickable behind.
All right. Thanks a lot again!
Hi, I don't want the background elements to be affected when I click or interact with my UI elements. How can I do that?
When I click on the UI to open the inventory, my character starts walking because it's clicking on the collider.
Use the event system for all of your mouse interactions and you will get this behavior for free
I have these Toggle elements in a ToggleGroup. Each of the ToggleButtons are deciding which object to place (which i defined as prefabs before). Problem im having is i have to click between ui buttons to decide which prefab to place. This works with keyboard+mouse but i want it to work without clicks for gamepad so i could just use DPAD to switch. I can navigate between buttons with dpad but dont know how to enable/click instantly when i switch between them
I'm making selectedcolor to different one so you can understand better:
Yes, it seems to work with mouse clicks. But how can it be done for touch input?
nothing would be different about touch input
use OnSelected to activate the object to place logic
How do i seperate gamepad from my mouse and keyboard setting? I can swap between input types mid-game, if i do as you say I'll be also changing the logic on mouse right?
Why would you need to separate them?
I dont exactly have to seperate them but hovering over which button to chose as building would feel weird
I'm moving cursor with a virtual cursor on my analog and swapping the object to build from dpad. That'll feel right is what i assume
I didn't say anything about hovering
Selection doesn't happen on hovering
only when you click
Makes sense then. mb
hello
I tried to set the buttons to scroll down, but for a reason the scroll is kinda locked and doesn't go dow. any ideea on how to fix it?
what happens if you make the Content rect taller?
it looks like increasing the size of the scrollable space but it affects the position as well
and I can't set the content size to fit all by default
generally I think Content needs a ContentSizeFitter
to resize it to the size of its content
looks like you changed the anchor preset
where do i find that
thanks
now it is all working, do you think I could make the scroll be linked to other things, like when scrollin, the background image to also move, or a logo move left right
anything is possible
Could anyone explain in more detail regarding this warning on Canvas? Should I pretty much always enable it?
If it displays a warning when not enabled, why is this not enabled by default?
yes
Hey there, does anyone know how to debug where there seems that the font has weird padding issues, and choosing Top/Middle/Bottom settings for alignment doesn't do anything positive? As you can see in the screenshot, the highlighted bits are extra spacing.
This is currently set to Top alignment - it does not budge if I specify Top/Middle/Bottom, but if I select Midline/Baseline/Capline it will do weird stuff like pop out of the yellow boundries. This issue has been plaguing me for some time and honestly is triggering some of my OCD (yeah... lol...). I am using TextMeshPro but I don't know if this behaviour is due to settings in the Atlas asset data that I need to recook or something else. Help would be greatly appreciated because it seems to affect any TMPro font I pick.
Here's a short video to explain it better in case you prefer problems explained visually (which is completely fine
)
what is the parent of the text and its transform properties? what are the transform properties of the text at the top?
is the text attached to anything inside the hierarchy?
Sure, I can get you it
Yeah
It's inside a panel
gimme a moment
It was somethig similar to this, the original is now history because i tried a different way
Another contact said that the font wasn't centered in the actual TTF file so it contributed to the weirdness
@minor juniper did that help explain anyhting?
I have a basic horiznotal layout, and I want to make it look like this:
so that the image has a set size and text takes the rest of the space
how can I do this?
this will help you understand properly how to achieve what you need https://www.youtube.com/watch?v=ouXCjFcfNfA
Layout Groups can be pretty tricky to understand. In this video I'll show you the basics on how to organize your user interfaces using the various tools provided by Unity. You'll learn about 'Horizontal Layout Group', 'Vertical Layout Group', 'Grid Layout Group' and 'Layout Element'
I'll also show you how to setup a typical interface split (ma...
Sorry I passed out. Im not exactly sure which transform property you showed since you said it was something similar to your screenshot, anyway most of the time you're going to want your actual text to have position 0 while a parent object is just using the position inside the canvas. This is usually the problem with misalignment. Here Im showing an example of how I got my text aligned within a button within the canvas. If it a cause of the text font itself, try using another text pro font in Unity and see if it results in the same problem
It looks like because you’re using the wrong tools, and you’re moving the yellow rect to set the size etc.
Press T to use the UI tools. Don’t move the yellow square, this is the padding on the TMP component (hidden under etra(?) settings) go set them back to 0
ah ok, i'll keep that in mind, thanks
how do I sync a scroll in unity with a background to move or zoom in and out or some item to change it's alpha?
subscribe to the event https://docs.unity3d.com/Packages/com.unity.ugui@3.0/api/UnityEngine.UI.ScrollRect.html#UnityEngine_UI_ScrollRect_onValueChanged and do what you need in your event listener
noted but before that I have another problem T_T
how do I change this
on the right
the shader
I can't modify anything from the color and other things
neither the shader itself
if you want to modify that material - make a copy of it
so the material preset?
or?
someone?
I didn't manage to find anything on the web
Guys, I have a project with several UIs that are normally made by the scene.
I'm thinking about redoing them using UI Builder. Do you think it brings significant benefits to justify rework?
If they're working fine as is no it's not worth it just to do it
Hi friends,
I am working on creating a 2D click-point game using Rive (for mobile and tablet). Since Rive works within a canvas, I want to create all my elements under the canvas and build the game this way. Is this possible?
If it is possible, which canvas render mode should I use? The positions of objects in the environment should not remain when switching the background image.
What's Rive? Probably best to ask the developers of that
Perhaps not, looks like an art package
UI generally isn't good to be used for gameplay, it has performance issues the more of it you have and the more you move it around.
I am experiencing issues with touch functions. Although there is a UI in the foreground, the collider in the background is being triggered.
UI doesn't use raycasts, it uses graphics casting.
Never used Rive, and you're unlikely to find anyone in here who has. You're best off seeking support with them.
However, the first thing for you to do is expand the 'Rive Interactable' component and look at that
How to build a game like this, with UI, clickable and lootable items, and a character that can walk wherever you want, like Monkey Island 3?
Maybe you'd like to take a look.
nope
can someone fix this
Hello everyone. I need some help. Everything looks fine until I open the settings panel on my phone. The panel is positioned correctly, but elements like the "X" button and text are either invisible or misaligned.
This just comes down to properly anchoring your UI elements
I am beginner, I do it 4fun. Thank you in advance for your help; p
Start by reading this: https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
it will go over the basics of how to set up anchors etc
Is this in a vertical layout group btw?
it will also be affected by the settings of the layout group if so
Bro, today I downloaded Unity. To be honest, I know what I'm doing 😂 I am from Poland, so "English" limits me a bit
Probably best to find a Polish language tutorial on Youtube for UI basics then
I don't speak Polish so I don't know of a good one
But are there no benefits gained with UI Builder?
Isn't the UI already built?
Yes, but i would love to improve feeling and visuals.
Is that the benefit of ui build, right?
how do i fix the bg image overlapping
That depends what components are being used to render these things
Anyone?
What do you mean
What are we looking at?
UI Images?
SpriteRenderers?
UI images
What's the hierarchy setup? How is everything arranged?
UI image sorting is based on hierarchy order
things lower in the hierarchy are drawn later and therefore on top
Hi, anyone have an idea why my UI elements are moving when I click the dropdown? I thought it could be due to my Canvas Grid Layout padding but I couldn't understand why it'd move like that?
is the Grid Layout Group attached to the "Lobby Screen" object?
I noticed that a new object called "Blocker" appeared in the second screenshot
if it doesn't have a Layout Element that excludes it from automatic layout, it'll be controlled by the grid layout group
Oh yeah, thanks for pointing that out! When I add a Layout Element during run-time it fixes itself but do you know how I can make it appear with the Layout Element?
oh, is that getting created by the dropdown?
ah, it appears directly on the Canvas
I usually don't have layout groups on the same object as the Canvas, so I've never noticed that
I see, it seems to be standard practice not to have the layout group on the canvas? I was just following a tutorial 😅 Thanks for the info. I'm not really sure why that fixes the issue but I'll give it a go!
It's fixed 🥳
I have a button which is supposed to scale with the content (TMP text object), but the button is at a fixed width, unless the text get's larger then that with. But the width doesn't go smaller then the width shown, even if the text is smaller then this.
How do i fix this?
Also, the raycast mesh scales when i enable/disable the image... what is going on here?
What's the best tool to use for my project— UI Toolkit or Unity UI?
The "main" scene of my project will look a lot like these D&D character sheets— the project is a character sheet manager. Unlike all other character sheet programs that exist, I want this program to instead build a dynamic character sheet with a gizmo/widget system (if you ever used widgets to customize the lock screen of your phone, that is what I'm trying to do. Attached below are some examples of some pre-made character sheets for different classes, wherein each "block" in this sheet would be a widget— they're not widgets as these are plain PDFs designed on illustrator, this is just a proof of concept. My program would essentially generate sheets like these dynamically based on a player's needs for their build. Players would be free to drag and drop and reorganize widgets as they see fit. Notice how for each sheet, the available widgets are customized to fit the character's build.
I've heard great things about UI toolkit, but it's also very very complicated as someone with no knowledge of web development and UI/UX. Unity UI seems very flexible, but also very finnicky and tricky. Which one do you think is a best fit for what I'm attempting to achieve?
The grid layout was trying to position the "Blocker" object
So it screwed up your layout
it's as if you added one more dropdown (or anything else, really)
Hi, how do I get my images to be sprites compatible with dropdowns? I made the images Sprite 2D & UI textures but it won't let me drag them over and they don't appear as options when opening the select sprite menu by clicking on that dot where I want to drag them
click on one and let's see the inspector for it
Also what is the component you're tyring to drag it into?
I'm trying to make the images go into the None (Sprite) boxes so they appear next to each dropdown option
set sprite model to single
Thanks! That was a strange issue, lol
Hi, I want to render some icons above players in a third person game, that always render on top of the game world, but are also sorted correctly based on the distance of the player/icon from the camera. I tried using Screen Space-Overlay, and converting the world space points to UI space, which works fine, but there is no sorting order for that canvas type - unless I need to manually sort? Not sure if this is the correct solution? I want them rendering as if they are 2D UI elements (pixel perfect, always facing camera etc.). Thanks!
If you use multiple canvases, there is a sort order on the canvas component.
The draw order for UI components is hierarchy order, from top (first) to bottom (last). So if you have just 1 canvas, you'll need to re-order the gameobjects
Okay. I'd rather not have multiple canvas' for this, so I guess I'll need to sort then. Overlay is still the best option for this right?
It's a good solution, and one that is fine to use.
I won't say best because I don't know all the various options or what would fit best for your game.
Depending on how much UI you're going to have on screen, you could run into performance issues because of it. This video is well worth a watch for things to look out for / solutions
Okay. There should only be a few icons on this particular canvas at any given time (just markers etc. for the other human players in game). So should be fine with the sorting and performance. Thanks for the replies.
np
Guys, how do I implement a cmd-style dialogue text effect similar to Radiant Silvergun's boss intro cards (particularly on about the first 20 seconds)?
https://www.youtube.com/watch?v=mfa8tFrjimA
Well, the XBLA release of this game is supposedly imminent, so I figured I should probably get some practice on this game. Hopefully I can 1cc soon.
Here's the final boss (Xiga) and TLB, done with no deaths, at a weapon level I'd reasonably have in a real run.
Arcade mode, Normal. Played using SSF.
I'm intrigued to recreate a boss intro like this
textmeshpro and coroutine
With TMP, you can increment this property to achieve this effect: https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/api/TMPro.TMP_Text.html#TMPro_TMP_Text_m_maxVisibleCharacters
What do you think about the UI? Would like to have some feedback
It is shown right after the loading screen of a level to show the player what comes up next, he can also choose a character to support him.
I was actually wondering how I can specifically add a blinking square after the last letter like how you type in command prompt
you can query the exact position of each glyph quad and put a box drawer (an image for example) right behind that
alternatively (less efficient) you can add a block glyph to the end of the text, or potentially just remap the current last character to that block cursor.
#💻┃code-beginner message @compact bough maybe a shader
No need for a shader for that.
Just create it in photoshop / art package.
Or get an asset off the store which lets you create procedural UI shapes. I like this one https://assetstore.unity.com/packages/tools/gui/procedural-ui-193375 ... but there's also this one for free https://assetstore.unity.com/packages/tools/sprite-management/shapes2d-procedural-sprites-and-ui-62586
OOOOooorrr... use the button sprite that comes with Unity and use it as a mask, hiding the sprite
Hello! Does anyone know how to get UI splines to work in world space canvas?
I can't figure this out — I have an empty GameObject with a Grid Layout Group as a child of it...how can I force the initial GameObject to expand and match the height of its child? I've been messing with Layout Groups and Layout Elements, but they never seem to work correctly.
grid layout cells don't auto resize, you're best off never using them.
Use nested vert/ horizontal layout groups
to auto resize they need non-empty children, and the option to expand with children (however it's worded) ticked
sidnenote. i've found their constaint can offer some great guidance for simplifying layout design ideas and overall making a ui much less glitchy, but you have to commit to the rigidity it affords.
its exactly the same, just smaller
and as has been pointed out to you repeatedly, your scaling is way off
why are you using a world space canvas?
if I bet 1 1 1 1
and how do I make a screen by the monitor?
... what
I did a similar thing.
how else can I do that UI to the monitor?
right, so the scale of your Canvas and canvas object only needs to be correct.
The scale of all children needs to be 1,1,1
all child objects 1.1.1
your game view is probably just not displaying at x1 and it's zoomed a bit to fit
what are you saying I don't understand?
send a screenshot, showing the issue, in play mode .. and include the editor, do not crop anything out
I put in 1.1.1 and now it takes up the whole screen.
how do I do something like this?
so put it back to what it was.........
This is why it doesn't look right, when you compare to the scene view. because the game camera has been scaled to fit in the game tab area. There is no issue here.
How about a mesh?
No idea what you're asking. What about a mesh?
yes
rofl - that is not a yes or no question. Anyway, you can stop pinging me now.
Hey, so i'm confused what's going on here:
I'm currently trying to work on my game's UI but as you can see the actual canvas/screen is different from the viewpoint, meaning if I were to adjust it to fit properly on the canvas it wouldn't appear in the game view as it is all the way in the top left for example
Looks like it's just the game view zoom actually
wdym
Are those UI images or SpriteRenderers?
Make sure they're UI Images
they're UI images
Which means you're not seeing the whole game window
You just need to zoom out or set it to a lower resolution so you can see the whole thing
(check that scale slider on top of game view)
ah I see, that makes sense - But just in case as an alternative how do I set it to a lower resolution?
First one is the displayed resolution. Normally you want to set the as in the resolution reference in the canvas scaler component
This way you can see the "base canvas"
In your case I would just change the zoom
got it, ty
You can set the drop-down to a specific aspect ratio
Without a fixed resolution
Or just scale yeah
Im trying to figure out the best approach to add a billboard sprite to an object during runtime to be contextxt propt ([E] pickup 'weapon') . Would that be via a canvas with a sprite? Ive read that sprites don't work well with the canvas but it seems plain images can be applied in the inspector.
Could be a world space canvas, or a SpriteRenderer, or just a quad mesh
your base color for these images is a very dark semitransparent black
All of the colors listed in the Button component are tints. They get multiplied by the main sprite color
Black * green for example is still going to be black
To fix this change the Color on the Image component to full white with full alpha
Then change the colors on the Button to be the colors you want in the various states
haha such a simple fix
they still dont work but at least they highlight so at last i can move on
If the hihghlighting and selecting works, the clicking will too
so if it's not working now it'll just be an issue with your code
so the issues somewhere else. thank you!
use pixelated sprites and bitmap fonts
you can add a post processing pixelation effect on top of a camera-canvas, but you probably don't want that cause it would very likely look very bad and be cumbersome to work with
well, the proper way is to use pixel sprites
Hi guys! Having some issues with a screenspace - camera UI.
Everything works fine at 1080p, but when I change the resolution, the cursor seems to drift off target. I've fiddled about a lot with screen scalers etc, and just wondered if anyone else has come across this and has a solution.
I think the issue is to do with a screen/worldpoint discrepancy, but not sure why resolution change would exacerbate that.
Worst case scenario is I do a bunch of manual translations of screen/worldpoint conversions and simulate the mouse for all these UI elements, but my preferred solution would be to ensure the scaling that happens at 1080p also happens at other resolutions. Any advice would be welcome!
Here's a video showing how the cursor drifts. The marked X is the ScreenToWorldPoint of the cursor, with the z axis set to the nearclippane of the camera.
The drift gets worse as it gets further from (0,0), and while the worldpoint seems to be accurate on the x axis, the y is still off.
I tried doing this
no matter how much padding i give the result is the same
yes.. font size is > 1
yes.. the rect transform scale is 1,1,1.
You'd have to show the code and the inspectors for the buttons
And the camera and canvas
I'm not exactly sure how your code works but since you're using a custom cursor and i assume you are using a youtube tutorial one common issue they might have is anchor points
Check the tutorial if it's also anchored to some position, if not I'll need your code to see what's wrong
you might have to scale that with canvas too.
RectTransform yourCanvas
Update()
{
transform.localScale = Vector3.one * (1f / yourCanvas.localScale.x);
transform.SetAsLastSibling()
}
this'll scale your virtual cursor based on your canvas
@mortal robin
@rich crescent
Thanks guys!
No custom cursor, no code either really. The crosshair was just to demonstrate the x value the canvas seems to think the cursor is at.
I'm not using a tutorial - fully into edge case territory here.
The process is:
A screenspace - camera canvas on which the interactable UI sits (all TMPro buttons).
A camera which outputs this canvas to a render texture.
A screenspace - overlay canvas which displays that render texture, full-screen.
The reason for doing it this way is to be able to apply a shader material to the entire canvas. I could use a fullscreen shader for this, but I also have screens that are embedded in 3d world space which need the same shader, and I don't think I can apply a fullscreen shader for those, so I think I'm stuck using this convoluted camera --> render texture method.
The mouse drift on resolution change (from 1080p) seems like a side effect of bringing the interactable canvas into camera - screenspace.
Here is the original (interactable) canvas:
Here is the camera it is being sent to:
Here is the canvas being used to show the final render texture:
This is the underlying UI working perfectly when in screen space - overlay mode. No camera, no render texture. Works fine at any resolution.
I mentioned above, I think it's a screenspace/worldspace issue. The buttons (centered in the screen) seem to always trigger when the cursor's world position is at 0 on the x axis, as shown by the crosshair above. It's just that the scale between screenspace/worldspace seems to differ when I change the resolution.
does unity support SVG images on the UI? i tried adding a SVG but i cant get it to work
more importantly if it supports as an app icon,i really dont want to turn my icon into a .ico or a plain image,SVG looks way better
i see in the asset store that there is an SVG toolkit so im gona guess it does support so how do i add it?
There is some Unity package for this, but it seems to be neglected (still in the preview phase, after 7 years):
https://docs.unity3d.com/Packages/com.unity.vectorgraphics@2.0/manual/index.html
I haven't used it though, so I don't know if it's good enough.
damn atp ill just use images,hopefuly they dont look extra pixellated
pls someone send me a coin texture (cube type of texture is preferred) for school project
Fixed my issue! I had to change the render mode to world space and do some fiddling about!
how can I make left and right not resize? I want right to resize
Change your pivot
Cut it out in an image editor
to what?
Valid pivots are between 0 and 1. But you're better off just looking at the anchor presets to start
The x pivot should be 0 if you want it to expand left
Sorry not pivot
Anchors
Look at the anchor presets
well I do that
You need to also set the text alignment to the left
I set anchors and pivot back to 0.5 still doesn't work
what is causing that glass pipe on the bottom to get a kind of reddish tint at runtime?
theres just a black background behind it (as seen on the right gap also)
thats curious... removed "alpha is transparency" and its visible there
the reason it wasn't working was this and text style being title. I wonder if I can get it to work with text style title tho
You can remove the style from it.
that's removing text style title
Can someone explain why text/ui in general looks so much worse in game view than in scene view
Usually because the game view scale is set to a value that's not x1
i have already changed my render settings to be scale to 2x and messed with anti aliasing but nothing gets it even remotly close to what i see in scene view
nothing to do with your render settings
event zooming out to the same scale (i cant go bellow 1.3) its noticeably way worse
screenshot your game view, do not cut off anything.
You need to click the resolution selector, and untick low resolution aspect ratio - though I do not know how to ungrey it
That looks like only the text is transparent a bit now?
yeah i was just about to say its not crisp, its doing some blending
Is it TMP? Is it UI or Mesh TMP?
also show the recttransform for it
there ya go
that should be default to the parent object (the bottom) that TMP makes when you select button (tmp)
There is parent if it matters
its better, but its still doing that blending along hte edges that makes it look bad
Try resetting these back to default?
that looks correct now?
more readable full screen but still kinda fuzzy
maybe im just too hopeful for small text
that might jsut be a me thing
worth doing a build and seeing what it looks like
aight will do. I think it might just be im too picky for the editor Thanks for the input
as long as the editor looks like those last two screenshots, I think its fine
cool. I was going to change it to icons later anyways. This is just getting POC done and i noticed the text looked terrible
if you noticed im using just an image of an FTL ship as a placeholder lol
Is someone able to help me with a world space canvas masking issue I have? Basically, I had it all working fine but then I need to control some elements sorting order so to do that I added a canvas to the child objects which allows me to manage the sorting order correctly but this makes the RectMask2D stop working - I have done extensive googling and apparently this is just a known issue. I either need a way of controlling the sorting order without adding a canvas to the child objects or I need to be able to make child canvas abide by the RectMask2D on the parent. Any ideas would be really appreciated as I have wasted a lot of time on this.
UI is drawn in hierarchy order. From top (first) to bottom (last). Just reorder the children as needed
Thanks but I am using layout groups which order items based on their hierarchy so I can't reorder the items.
You can, I've done it before.. a long time ago though
and exactly what you want isn't clear to be able to suggest a way.
Hopefully the attached is clear - I just need a robust system where I can force the cards to be on top of all other UI while still being masked by the Rect2DMask on the world space canvas as this is supposed to be a screen and the cards are UI elements (even though they don't look like that at the moment!). If you can offer any help it would be really appreciated. Where I have given the index for each vertical layout group that is within the horizontal layout group that contains those 3 vertical layout groups...hopefully that is clear.
So the cards can be clicked on, to be dragged around (only visible within the screen), and then when you let go of the drag, the card will sit back with the other cards.. in a new order depending on where you let go of it?
If that's correct, while the card is being dragged around you'd set it to the last child of the canvas .. and then when you let go, you'd need to work out at what child# it will be to set it back as that in the correct layout group.
That is so obvious now you've said it! Thank you, really appreciate your help - sometimes you bash your head against something and then someones just like, err why don't you just do this and it sorts it all out!
Hello, currently working on the main menu ui of my game.
Can you guys give me any ideas/suggestions? Specially regarding the main menu buttons (on the left)
How to disable Text Mesh Pro gizmos?
Text Mesh Pro gizmos are disabled
Yet they're still visible
Also when I turn all gizmos off, they do get disabled
I disabled every checkbox separately and they didn't disappear
Need to press on the T icon instead of the checkbox
Trying to make a main menu for my college project, was wondering if it was possible to make the text look glitchy like this, and how I would do so
Srry its the wrong way around
of course it's possible 😄
The quickest way to do it is to just have 3 lots of TMP's, slightly offset and different colours
Omg, I never thought of that, thank you
What's the other way, if you don't mind me asking?
Pretty nee to ui stuff (and unity in general tbh), how does a shader work, or where can I learn bout it?
google -> unity shaders
Thnx, appreciate the help :)
or if you want to get serious -> https://jettelly.com/store/the-unity-shaders-bible
How to crop a sprite and show only a part of it?
I have a healthbar as a sprite and I'd like to show only a part of it depending on health
Filled image does it
Strangely, I couldn't google it. It would only give results for sprite slicing and simple monotone sprites or UI health bars with effects.
probably didn't get any results if you searched using 'sprite' because with UI you're manipulating the recttransform or the image component, the sprite is just the file you assign to the 'sprite' field of the image component
whereas slicing is manipulating the info of a sprite (the file) before you assign it to anything
How can i solve this problem where the chat prefab is overlapping the other when it has several lines of text? The prefabs are on a grid layout
Don't use a gridlayout, the cells do not resize with the content of the children.
Create a replacement gridlayout using nested vertical and horizontal layouts
so verticalLayout should be on the prefab?
I can't say for sure.. it depends
On? Because its making it worse.
It's "worse" because you've not set it up correctly.
I do not know what the "on?" at the start of that message is supposed to be.
I have no idea why you're using a gridlayout in the first palce, what you have shown does not require a grid.. all that would be needed for what's shown is a vertical layout group on the parent. Each chat thing would then be a child and expand/ move as required
I'm using gridLayout so it puts the chat prefabs in a nice column and to spawn them downward. I've messed around with what you told me, but it still overlaps. The verticalLayout is on the parent.
grid layout is only needed if you want a grid... but it's shit because the cells do not resize, so is never needed. Completely get rid of it
Vertical layout is the only thing needed when you want objects in a column
You'll need to tick the...er.. expand with child size? (I think it is) for height.
You'll possibly need a content size fitter on the children.
You're also going to run into issues because you've change the scale. UI scale should remain at 1,1,1 - use the width/ height fields to change the size.
(height can't be changed here because you have other things controlling it automagically)
my message does have a content filter for adjusting image scale with text. Ill play around with it more and see how it goes.
again, the scale needs to be kept at 1,1,1 - ALL UI elements should be (only the canvas can be different, but that does it itself)
Hello, would anyone happen to know how I can render a UI rectangle between these two sliders so it looks like they are connected?
I have a feeling it has something to do with masking but I'm not sure how to research it
By default, the first object in the hierarchy is rendered first (behind further objects), so if you put dots lower in the hierarchy, dots will be on top of it. You can dynamically change .anchoredPosition and .deltaSize to match the gap between dots. The position would be an average position of dots, .deltaSize.x would be the delta between these dot's positions. Optionally, for higher quality, you can also consider adding sliced texture to the UI Rectangle:
https://docs.unity3d.com/Manual/sprite/9-slice/9-slicing.html
Say goodbye to stretched UI image borders in Unity! In this brief tutorial, I've revealed a simple trick to guarantee your UI images maintain a crisp and clean appearance. Whether you're a beginner or an experienced game developer, this tip will save you time and frustration. Don't let stretched borders ruin your game's visuals - watch now and l...
Unity tutorials in rick voice
how can I make the panel scale and scale properly?
To anchor it, click on the anchoring preview in the top left corner of the RectTransform component, then select the template you want to use. Alternatively, you can write down anchor min/max values by hand.
Master Unity UI! Start here ➡️ https://cococode.net/courses/master-unity-ui?utm_source=youtube&utm_medium=video&utm_campaign=5
This tutorial/guide will show you how to resize your Unity UI canvas, GameObjects, text, button and images. You will learn:
- How to fix Unity UI for every resolution
- How to adapt UI for mobile devices
- How to change...
You also probably want to scale the UI to different monitor resolutions.
Let's say someone plays it on a 15" 640x480 monitor. The button will be big.
Then someone else plays the game on a 3840x2160 27" monitor, the button will be extremely small.
But with a Canvas Scaler on the canvas object, you can scale it to the height of the display.
i Need help, i don't understand why my image and text look bad(Like Pixelate) The image are 1024 × 1792 pixel. I don't understand how it's possible that if I shrink the images they become grainy, it also happens with textProMesh. It's a 3D MobileCore project. The cards are prefab (gameobject with the model.fbx inside and a canvas that contains all the images and all the texts). How i can fix this?
You're not supposed to scale them
Resize them using the RectTransform
Your scale is tiny
Which will mess with everything
It's a world space canvas, you need to lower the scale to a tiny value.
There is (probably) no issue with what you've done, just the simulator is scaled down to 31% of it's full size to fit in the area provided. Drag this to 100 and you'll see it's all fine
hey so i have a third person shooter game with a crosshair that spreads based on the gun shooting. The problem is that when i have the game window minimized, the crosshair spread is different than when i switch to maximized game window. You can see in the video that when it is minimized, the crosshair on the M4 has perfect accuracy but when i switch to maximized, it has spread on the crosshair by default. How can i fix this?
You'd have to show the code
i basically move the crosshair lines by their transform based on the spread of the guns
You're moving the same number of pixels
Which will obviously look different at different resolutions
You'll need to either change that according to the canvas scaler scale or use RectTransform's anchoredPosition
In any case Transform.Translate is highly unusual for UI elements
i tried the anchored position and it didnt quite work, because i need it to move by local position and not global, but how do i change the canvas scaler scale or whatever so it works?
so what should i use?
anchored position is local
or rather it's in relation to its parent, and based on where the anchor is
I didn't say to change the canvas scaler scale
I'm saying to use that to scale how much you translate by, if you insist on using Translate
well i did it like this and it didnt work, the whole crosshair moved on the x axis
so with this approach i should scale the position by the scalefactor?
Surely that is because you're moving them all on the +x axis
you'll want +x, -x, +y and -y
yes and thats what i want to do but i want to move them on the local x axis which is different for every of the lines because they are rotated
yeah this would also work but its more complicated and i would have to keep track on which of the crosshair lines is which
you already know that because you assigned them in the list
Yes but i also have to know which of them i have to mive to the x -x y -y axis. It would be much easier to just locally mive the position which i cant get to work with the anchored position on rect transform.
okay, so the anchored position is local, but its not including orientation, just like in Translate(Space.Self) which does
Anyone online rn?
Is there a way to develop an ui in js/html and integrate it into unity?
Im sick on unitys gameobject ui system and the ui toolkit is not really production ready yet. So i hoped that theres a way to develop a ui with stuff like reactjs or vue or even svelte, overlay it in unity and make it communicate with each other.
I found vuplex 3D webview, anyone having experience if that works for it?
Or any other "hacks"?
I also found this one:
https://github.com/gree/unity-webview
But thats poorly documented and not sure if it really "supports" the idea of UI. Looks more like a well... webview
It's possible. We use vuplex WebView to run our web based UI and it has improved our workflow a lot, though it needs some scaffolding depending on your use case https://assetstore.unity.com/packages/tools/gui/3d-webview-for-windows-and-macos-web-browser-154144
Our designer wrote a blog post about this with some brief text, with a video https://www.fyndreality.com/blog/our-xr-design-journey-challenges-and-discoveries
Thanks! Do you use the 3D webview? Is it also possible to display 2D webui with it? 🙂 Like an Ui that just sticks to the screen
And e.g. when the Ui is layed over unity, can we still make transparent areas where we can raycast through the ui to interact with unity? Like a healthbar at the bottom that does not block the whole screen from interactions.
We use it both for a full screen overlay, for docked menus that only take up a portion of the screen, and also for our VR UI on a tablet
So all of this is web UI but you still interact with the 3D as per usual
That sounds great! Finally some good news xD
I assume that you have e.g. a local frontend project/build and that package will load and display those files? 🙂 Or does it work different? If its fully web, a router might also work for screen navigations?
Looks damn sexy! The world and the ui :))
It's a static webpage that we build, and just toss the whole thing into StreamingAssets and load it from there
Thanks a lot! 🙂 Its getting better and better, so even routers should work for basic screen switching e.g.
I'm the dev here with the least know-how about the web parts so I might be able to give the best answers 😅 But vuplex has worked super nice for us and the docs and support have been great
Hey, how can I do a dropdown but like... not the dropdown menu of picking a choice but like this where you click on the arrow and it expands the whole text?
Put all of it in a vertical layout group and have the button enable and disable that panel
What if I later want to polish it where it doesn't show all at once but with a transition? Would that setup still work?
But i assume they will not hand me this? This looks like software that is only distrubuted to like triple AAA studios? 😄
Yes, later you'd just animate the size of it or something along those lines
the idea of using web tech in gamedev is, in any case, a business 'need' that a hobby developer could easily stay away from. The promises of webdev don't really work out often enough unless you specifically have the exact problem that the web-framework solves. And i'd venture to say that adding JS/HTML/CSS to a game project has potential to create many more problems, resulting in a net-negative return. UGUI is certainly not perfect but its also much leaner and independent of custom/separate tooling.
That's what Cities Skylines does for their UI btw^ but they have the resources to do it properly
Hey everyone. Please explain to me what's App UI and what's the difference between that and UI Toolkit? And which should I use?
its an opinionated way to build UI on top of UI toolkit, similar to how other "mobile first" and low-/no-code ui builders work... would ignore for the time being because
App UI is considered as an experimental product. It is provided "as is" without warranty of any kind, express or implied.
Hm... Strangely, they made such neat documentation for something they didn't intend to be public.
I'm new to game dev and I was wondering, for smaller speech bubbles in games that I want positioned near an NPC, it seems like that's not a Canvas child. My first instinct is to create a child 2D Sprite game object off the NPC and toggle it's SetActive() via script. How is this generally achieved in Unity 2D development?
a) Conversion from the character's world position to the screen position, then moving the bubble on canvas accordingly by some offset
b) Creating a world space canvas that can be placed anywhere in the world and set it up accordingly
c) Creating speech bubbles from non-GUI objects, making them fully 3D (which has pros and cons of 3D objects)
Great! Another question, the UI sliders I've made so far have a 9 sliced fill. What if I want to update a segmented health bar. Like one of these sliders https://bdragon1727.itch.io/basic-pixel-health-bar-and-scroll-bar. I was thinking instead of a slider, just make some UI sprite images and toggle which health bar image to render via script. How do fixed movement sliders like these work in Unity?
Simple patterns are done with image filling (as in the screenshot) - you set the fill amount from the script, and it automatically cuts the part of the image. More elaborate transitions are made with shaders. Here is a video that briefly describes the logic of such shaders:
https://www.youtube.com/watch?v=LnAoD7hgDxw
It allows you to create a transition using 1 extra texture.
In this Visual Case Study, we use shaders to recreate the various screen transitions seen in Pokemon and other RPGs.
Support me on Patreon:
https://www.patreon.com/DanMoran
Unity Documentation - Platform specific rendering differences:
http://docs.unity3d.com/Manual/SL-PlatformDifferences.html
Get the Assets for this Video here:
http://danjoh...
AWESOME! Thank you!
hey all, ive got a diamond outline with 4 panels inside to hold character portraits. when i increase the width or height of the outline, i want the portraits to fully fill the space instead of leaving a gap like in the second image. how would i do this? i assume its something to do with anchor points?
Anchor points define the stretchiness of the elements. If you set min to 0 and max to 1, then it will be fully stretched with parent's size. If you set it to something smaller, then the stretch will also be smaller. For example, min 0.25f and max 0.75f will make the object centered and only as half as big as the parent.
I also have an anchor point problem. Specifically, the position and scale of the UI elements are changing when I build, but none of my anchor points are stretch
but as soon as I build it becomes really tiny and centered
Perhaps one of its parents isn't stretched. Before building, I would suggest testing it out on different resolution previews. For better reliability, restart the play mode during each test (in some edge-cases, properties can vary depending on what resolution was used when the object was created).
Hi im having a issue on this hover state it works really well on the sqaure buttons but stretches on the long buttons. Am i cutting it correctly? if i just cut on the blue edges then the whole thing joins up and has no transparency between them
Does the long button (or any of its parents) have a stretched scale? The size of GUIs is meant to be modified with width and height. Stretching the scale might make some features not work as intended.
no the long button is 1,1,1 scales
if (highlightedButton != null && highlightedButton.GetComponent<Button>() != null)
{
RectTransform target = highlightedButton.GetComponent<RectTransform>();
if (selectionFrame != null)
{
selectionFrame.gameObject.SetActive(true);
selectionFrame.position = target.position;
selectionFrame.sizeDelta = target.sizeDelta + new Vector2(20, 20);
// Just make sure Animator is enabled (optional, since always animating now)
if (!selectionFrame.GetComponent<Animator>().enabled)
selectionFrame.GetComponent<Animator>().enabled = true;
}
}``` i am chanign the sizedata but that doesnt seem to make adifference if i remove it
Hey, small question to people more experienced in making good looking UI. If you were to make this kind of animated sequence:
(the Victory text showing up with glows and electricity behind it)
https://youtu.be/Ag6mDKrBu6I?si=csBWdjyASXECrrA9&t=681
1 whole hour of no commentary overwatch two gameplay. I hope you enjoy.
Weekly uploads every Monday and Friday at 7am.
What would be your approach?
-# Assume you are talking to a person that's well versed in tweeting and can make basic UIs. But never did something that animated and "organic". As that's the level I am at :v
The approach I can imagine using for that is rendering the effect into a video file using something line Adobe After Effects and rendering it either directly or behind some text in the UI
But I'm curious if there are better ways for such complex animation
Videos take up a lot of space. It's not a big problem for PC games, but it might be problematic on platforms with more limited resources.
The default tool for complex animations is Timeline. It lets you choose how stuff changes over time similar way it lets you do it in video editors.
ive attempted to make videos show on canvases twice its a pain
Electricity is most likely done by switching the sprites in each frame, or procedurally generated with a shader based on some kind of noise. Since it takes only 10-20% of the screen, having it as a set of sprites would take much less space than video.
But wouldn't a video taking 10-20% of the screen be more memory efficient than sprites? Due to better compression algorithms
Tho, I guess combining it with tweeting to handle the circles and possibly a shader for the glow could be a good way to make it lighter on the memory 
so glad unity doesn't pull this BS on me like Hammer++ did 🙏
I haven't taken into consideration making a video taking only a small portion of space. 🤔 But it would mean you would still have to animate the rest of the effects. You can also apply compression to sprites. I'm not sure which option would take less space in such a case, I think it's something you can test out.
It would probably depend on the coding Unity uses, and the content of the video. Because in theory i-frames would compress stuff a lot
What was the source of the pain?
From a brief research it seemed fine
Video Player -> Render Texture -> Raw Image
Confusing and it just not playing at all no matter what I did
Hi friends, i have use textmesh Input-fields in my unity android project and i have input field keyboard open issue when tap on another input keybord not open properly like showing in video.
It's being unfocused
I have tried on default textmesh inputfield on seperate project same problem
Does anyone know how to make the inner part of my UI repeat instead of getting stretched? The outer part(border) works perfectly fine.
make it two separate images. Slice the border as you did here and use an Image in Sliced mode for the border.
For the inside part use an Image component in Tiled mode
Got it, thank you
Sooo i purchased 3D webview and im now trying to Code the ui of my Project using js, CSS and HTML (Svelte). Im actually pretty excited how it Turns out. Tho having one big question. How do i make a web ui Look Like an Game ui? Web uis Always Look so Clean and smooth 🤔 any ideas?
sorry to get back to you so late but this worked perfectly, ty ❤️
Hi! I'm trying to set-up for my dialogue choice buttons to adapt in height when the choice is multi-line. So basically having buttons "collision mask" expand dynamically depending on how much text there is. I have my button prefab and the buttons appear inside a scrollview. All three objects (DialogueContent (inside of Scrollview), the dialogueChoicePrefab (button) and the TextMeshPro object (child of button prefab) have Content Size Fitter attached with Vertical Size Fit to Preferred and Horizontal Unconstrained. Still the buttons don't resize dynamically, which causes the choices text to overlap and clip. Anyone know how to acheive this? Thanks in advance ❤️ 🥲 (Also please refer me to the right channel if I'm in the wrong one, sry I'm supernew to this)
For reference:
Make sure that each your ContentSizeFitter is configured (by default, the fit is set to Unconstraint). If you're changing values via code, make sure to rebuild your layout groups, starting recursively with the children, and ending with the outermost parent.
In the past, I've noticed that layout groups made fewer issues when I used different kinds of layout groups (e.g., horizontal ones inside of vertical ones), but I haven't investigated this issue further.
Thanks! Yes I double-checked the Content Size Fitters, and set up the code recursively but the issue still remains unfortunately :/ But thank you for helping out!
Does your layout update properly if you disable its root and enable it? If yes, then the problem likely lies in its rebuilding. If not, then likely something isn't configured properly.
Omg I just had to literally resize the button, that was it haha. Because apparently it couldn't be "bigger" than the height I had gave it, but it can be smaller. 🥲
Such an easy fix 🤦♂️
Tysm for your input and help, otherwise I wouldn't have figured out it had to do with the configuration
where is this screenshot from?
make your image the same size as it appears on the screen
his game i'm guessing
Well, duh..
Editor (game view/ simulator?) or build?
I changed screen size and now my game broke. My UI images are now not showing properly, namely the instantiated gameObjects that I have in a scroll rect. They show up just fine in the scene view, but no longer appear in the game view.
I don't know what I broke but does anyone know how to fix it?
When working with UI, make sure the game view is never in 'free aspect'
Other than that, you need to make sure you anchor things correctly, don't leave everything anchored to the center, as they won't move when the screen size changes.
Also, press T to work with the correct UI gizmo
In the game view, the aspect is 1280x720 and the anchors are already set on the prefab, as they are in a scroll rect with a grid layout group. Also I don't get why it's only showing in the scene view and not the game view
show a screenshot with the prefab selected - make sure you include the inspector for it
I didn't see the 'angry' text in your scene view as it's obscured by the T gizmo
Nevermind, the Z value was messed up. Funnily enough, it was the exact same Z value prior to changing the size and it worked just fine
why?
Free aspect is some random resolution. It won’t be a useable aspect ratio. So when you create your UI it won’t scale or layout correctly on an actual screen
Shouldn't UI be ideally setup to accomodate random resolutions?
For games? No?
But if you do it properly, using an actual resolution as the base.. then it’s more likely to be ok
Using some random resolution as the base will fuck everything else up and make your life harder
Why would it fuck everything up?
Because it won’t resize/ move/ layout correctly.
If your UI stuff is anchored correctly it should adapt?
I thought that was like, kinda the point
Yes. So you use an actual resolution to get it setup correctly, so that if a tiny % of your players for some reason go windowed and change the size to a random one… it works.
You do not use some random resolution to set it up in the first place.
not sure if this is the right channel for this but in my npcs dialog boxes, the text looks all squished compared to the normal text up top (The Day and Time). The settings are the same, so why is that?
You may think everything is the same. But it’s not, otherwise there wouldn’t be a problem
First thought is the scale isn’t 1,1,1 somewhere in the hierarchy tree
When doing like tabs like these, what would be the better layout, to have an image that is the square shape + the tab it self and place it as a background image of a bigger panel, or have a smaller one and then add just the tab image as bg for the button and make them the same color so they seem joined?
Did I explain that well or too confusing? XD
Something primal in my brain likes the idea of the whole thing being one image and rearranging them in the hierarchy to bring one to the front, but in terms of actual workflow etc having the tab part be a separate image and just changing the color and text on the top rectangle is probably more practical.
So I should have the top part separated from the actuals tabs then, right?
For some reason, the areas I click dont correspond to the position of the buttons
The buttons are in a grid layout group and instantiated at runtime
I was wondering if there was any way to debug this, like gizmos for showing the clickable regions on the screen
open scene view with the Rect Tool and select one of the buttons
Check what the rect looks like
The issue has been fixed 😃 there was an empty textmeshpro in the child of the button
I wanted to quickly finish my school project, but I encounter this problem. I aim and click on the button but it doesn't change color am I dumb? I'm following some youtube tutorial, I think everything is correct, idk what I did wrong.
I follow this tutorial - https://www.youtube.com/watch?v=pKFtyaAPzYo the part starts at 4:04
Enjoy the video, if you have any questions ask in the comments down below!
Fonts:
https://www.fontspace.com/
Request a tutorial here:
https://forms.gle/JLBkpHt1ZFLpn7TE9
Patreon with fully explained c# scripts:
https://www.patreon.com/BlakeyGames
Main Channel: https://www.youtube.com/c/bblakeyyy
Join the Discord: https://discord.gg/cyskvvy...
All of your colors here are practically the same.
Set the one circled in read to full white (255, 255, 255, 255)
Set the green one to full green
Set the blue one to full blue.
^ Just for testing purposes
After you verify it's working just modify the Target, Normal, Highlighted, Pressed, and Selected colors.
Leave the color on the Image component itself as full white at all times.
Hello, im new to unity and i have to make flappy bird for a school assignment. Im following a youtube video which is helping me but Im struggeling with the UI. My whole scene is on x=0 and y=0 but my text is on like -400 on both sides. Also when I put my text in the scene I dont see it when Im testing it. Can anyone help me?
Double click on the Canvas object in the hierarchy
And turn gizmos on
and you will see the full extents of the canvas
it doesn't work. I'll record a video rn
The canvas represents the screen. Do not try to align anything with the game world
If you put a text object in the middle of the canvas, it will appear in the middle of the screen
open game view side by side with scene view to see how it appears on screen as you place it.
(note this is all assuming you are using a screen space canvas)
show your event system inspector
it is in within the canvas but it still doesnt show up
show
event systtem question was not for you
this?
oh
show both of those inspectors
your event system is missing the input module
press that "Add Default Input Modules" button
or delete the event system
and recreate it
oh thanks it was the problem now it's fixed
praetor it still doesnt work, could you help me?
I asked you to provide more information
I asked you to show me what you did
oh im sorry
i dont really know how to explain
i follow a tutorial and i should have worked but i didnt
the only difference with my and the tutorial was that i had tmp and he had normal text
weirdly none of what you wrote here is you providing screenshots that I asked for
what do you want to see?
I want to see what you mean by this
you said "it is within the canvas". Show me
Show me your canvas
and show me the text object inside it
Again you're not looking at this correctly. You need to do what I said here: #📲┃ui-ux message
Your text object is not positioned correctly
you have it all the way in the bottom left corner of the canvas
and very tiny
oh, how can i change this?
I fixed it, I changed the canvas render mode to world space and adjusted it to length 24 and height 12 and it worked now
thanks for your time
that's... not really the right solution here
you never actually looked at your canvas properly in scene view
all you needed to do was look at the full canvas and properly position and size your text.
Can anyone point me in the direction of an asset or tutorial that would be best to create responsive UI like this seen in Metal Gear Solid: Ground Zeroes?
https://www.youtube.com/watch?v=uqI18_MBgdg&t=11s
Metal Gear Solid V: Ground Zeroes - Main Mission Speedrun
S rank. Hard. Stealth, No Weapon, No Kills, No Reflex, No Retries. 7.15
PSN: Gunner411
Twitch: twitch.tv/arsenal411
https://store.sonyentertainmentnetwork.com/#!/tid=CUSA00211_00
anyone know how i can make the parent "Template" of this text, scale with the text?
the text already has a content size fitter on it
you probably need this: https://stackoverflow.com/a/79280999
I'm getting a pretty annoying issue in Unity 6 where I have to re-generate all my TMP fontasset atlases every time I open Unity, like the settings are not being saved at all. Every time I open the Unity project, the atlas is reset to a 1x1 pixel image, and the glyph data is reset to I assume the default settings. Has anyone else encountered this? Couldn't find any open issues about it on the issuetracker.
Having Unity regenerate the Library from scratch didnt change the behaviour either. Even happens in a totally blank, fresh project with only a single imported font file.
Ah, in case anyone has this issue: For some reason, and this was not the case previously, the newly created font assets are defaulting to "Dynamic" Atlas Population Mode. This is causing all the atlas settings to be reset every time the editor is opened. Switching this setting to "Static" and then regenerating the atlas will correct this issue.
I am not sure why this is happening now all of a sudden, I never had this issue before just a few hours ago, and I did not change any settings within the editor. Quite strange, but I am glad I can finally resolve it. If TMP's assets are hosted on Unity servers, it is possible they have changed that setting to now be the default. That is quite frustrating.
someone can help me? Im trying to make this scroll rect work, it was suposed to be elastic, but it never gets back to the place
When you say "get back to the place," do you mean you want it to always return to the starting point? The elastic setting is just for bouncing off of the bounds of the content size. When you hit the end of the content it will bounce back a little, not all the way to the center.
like, i lose it when it comes of the screen
i tested with other objects and they bounce a little back do the place, in this case it doesn't, if is off the screen i lose control
I can't tell from your video, but it's probably your viewport and content sizes. Make the viewport as large as the screen and the content as big as the content. If it's already that way, I'm not sure without being able to see the actual components and rects.
how can i make the "Template" object scale height wise with its children?
so its always at the lowest and highest point of the lowest and highest object
u see how when i move the ui elements around
i need the template height to scale to the lowest ui element
and to the highest one
automatically
thank you, i will try it
Auto resize the background of the Text in Unity UI.
#unity3d
#ui
#canvas
#textbox
May you can play around to get a result
im trying to understand how UI (more precisely canvas) works with nesting
for example i got a "main menu" prefab, that has a canvas and a panel (the background)
i have a "button" prefab, that contains a canvas at the root, as well as other stuff like a TMP button
when i add the button prefab to the main menu prefab (as a child of the canvas), the button isnt showing
You do not want to have a new canvas on every button. Multiple nested canvases is something you should only do if you have specific reasons. Just make a prefab with a RectTransform as root, and drag that into your canvas
the issue with that is that i cant preview the button in its prefab
You can, if you have a prefab with a RectTransform root Unity will display it with a dummy canvas
i dont have this behavior, even after removing the canvas
im using unity 2022
What's the root there?
empty GO with just a transform
Like I say the root needs to be a RectTransform
Sure it's not just out of view?
this is my button's components
nope
Try a fresh prefab by making a button on a canvas in a scene, then drag the button into the project window and make a prefab out of it
idk which solved the issue but i opened my other main prefab and removing the instance of the button and after opening the button prefab it was working
thanks for the help, i was very surprised that i couldnt preview without a canvas
i just wished the canvas isnt locked to the screen size
for example, i dont want my modular button to take the whole phone resolution, it should take the same size as the button
That's how it displays for me, in the scale I've set up the RectTransform
i cant hardcode dimensions because the content is dynmic
Then how could the canvas know what size it should be in the first place?
BTW this is how we set up most of our UI prefabs, and to make them stretch and fill areas we do that with layout groups in the hierarchy, not necessarily on the component itself
If it's easier for you, you can work with the button directly in the canvas instead and just apply the overrides to the prefab
it takes the size of the child
like the button does for the text
anyone knows a good way to make icons for an inventory system?
yeah im trying to do this rn, i have a horizontal layout, i want to have 3 button inside, i want them to act like the wrap css attribute
each of the 3 childs grows the same on the horizontal et vertical
on top what i want, at the bottom the default behavior
i think i found how to do this, but not entirely because in some scenarios i cannot replicate that behavior
When in linear mode, are the UI colors supposed to be different from gamma mode?
I'm confused, is there no way to render screen space UI in gamma mode when project is set to linear mode?
Don't think so (confirm with a google). Even though it's "screen space" UI, it's still in the scene
Hi im building a map of how to use the controller, do they seem to big. if i make them smaller the buttons seem hard to read. Just looking for opinion please.
i need to scale the "template" according to its children
automatically
so it will get scaled to the furthest child each side
the "content" object already has a content size fitter and a vertical layout group to make the templates be sorted in order
and i still need to be able to move the children ui elements freely
and automatically update the parent "template" size
so if i moved the "Time Text" object to the left, the "template" would strech to the left with it
pretty much a content size fitter on top of a content size fitter
How can play a gif on a Canvas?
get all the frames from the gif and write your own animator to change texture every frame
or convert it to a video and use video player
Tysm
i think it looks perfectly readable!
Hello, for some reason this prints the viewport size of around 25x25, when GameScreen (a RectTransform) definitely doesn't even cover the entire screen :/
Any ideas?
What mode is your canvas in
oh yeah sorry I fixed by using a different method
I'm working on a card inventory system where players can:
Add/remove cards dynamically.
Rearrange cards by dragging and swapping their positions.
To manage the layout, I initially made all card objects children of a GridLayoutGroup inside a VerticalLayoutGroup. However, I'm running into issues because having multiple layout groups conflicts with the drag-and-drop behavior.
What I’ve Tried:
-Disabling GridLayoutGroup on drag so cards can move freely.
-Re-enabling GridLayoutGroup on drop, but this resets card positions unexpectedly.
-Manually setting SetSiblingIndex() to swap card positions, but sometimes it doesn't update properly or indexes just don't update.
The Core of the Problem:
The layout system repositions cards automatically, which interferes with manual movement.
When I drag a card, the parent container resizes or shifts unexpectedly.
Nested layout groups seem to cause unintended UI behavior when enabling/disabling them.
Is there a better approach to managing the such inventory? Should I avoid GridLayoutGroup entirely and manually position cards or how would you implement such system. You don't have to worry about data's etc for cards i do have a backend
What im trying to achieve is that kind of movement for my cards inside inventory
my end product would be similar to this but i'll be using this as a inventory instead of collection etc. Only logic I'll have is drag/drop and click for each card
How can I make a grid layout that expands up to a max height (e.g., 500), and once it reaches that, any additional content stays within the 500 height and has scrollbar to see the remaining content? In web dev, I think this would be like max-height: 500px; overflow: auto;
UGUI layout components will not help you in making a fun UX like in Balatro. You have to custom-code all of that. UGUI layout only works for static views with a little punch scaling and color fading.