#π²βui-ux
1 messages Β· Page 5 of 1
decrease the time it takes to animate
you shouldn't be using the stretch anchors for this situation.
Those buttons are in a grid, either use a mixture of vert and horizontal layout groups... or use a grid layout
I have decreased the speed 0.1 to 0.01, I want to make sure the animation get completes as soon as I remove the mouse from the button
Decrease time equals increase speed, not decrease speed
okay I got it, I changed the speed to 10, can I reduce the duration of the animation, as soon as I remove my mouse from the button the animation should be gone this is the effect I am looking for, please help
I have put the animation on the highlighted one
If you need it to be instant just hide it? No need to animate if that's not what you want
@jagged monolith how can I do it, is it not related to animation?
I don't know how you've got it set up. I would just do OnPointerEnter/Exit show/hide game object
okay
Thanks that work in this scenario, but what about the other animation the problem is same
You need to choose between animation and instant response
About the UI ToolKit, when I touch the textField, the keyboard of mobile did not pop up through Unity remote. Anyone knows how to pop up it, thank you.
Unity UI Toolkit problem
whats that extra layer of white background of text which is prolly the original size of the TMP? Why two layers are given? one yellow one and the second the white line rectangle?
and those white Cross marks also. What are they?
I used to use Text earlier.
The yellow box is the padding area of the TMP component, you usually don't want to change it. The white lines are the rectTransforms
Press T and use the UI gizmo tools
and always keep the UI scale at 1,1,1
thanks brother
how do i get rid of this green circle
delete it
it's the slider handle
however if you're trying to make a health bar I recommend not using a slider at all
its not i deleted it thats the fill area
how would i make a health bar?
Welcome to this quick game mechanic tutorial on how to make a health bar using fill images in Unity 3D. In this lesson, we will teach you how to create and update fill meters that you can use for health bars, shield bars, stamina bars, or even experience bars.
Discord: https://discord.gg/hGJ4CRE
Website: https://infogamerhub.com
Become a Member...
why does mine look weird alot of pixels are gone in game
in game
in editor
it has to do something with my anchors
that doesn't look like UI..
it is
is your game another resolution as your scene view?
show the setup.. inspectors for the UI and camera
Hello guys, I have made this profile button, and on the pointer enter event I want to change the color gradient of the text which is it's child, but I am unable to see any result
Event Trigger component is on ProfileBtn object
i am so sorry for the late response
Hey guys, how can i make proper nameplate(aka overhead Healthbar) in 3d so it won't squish when unit moves on screen?
hi guys can i make a image appear top of my game object in 2d ?
.. and the rest of the UI ?
Does anyone know how I can change a bool in another script from a button in Unity?
never mind actually
Make the field public -> get reference to the script -> access the field using scriptReference.variableName, works with any type of variable, not just bool
Hello guys, I got a problem and I dont know how to fix it.
I just added (Unity UI) a Canvas an image and a text but it is blurry, and idk why. (screenshots coming)
i didnt change anything in the Image and Counter go, all default settings (except the picture and the text)
what's teh scale on your game view set to
on the game view window of course
also make sure you're using TextMeshPro and not the legacy Text
You've changed the scale.
height and width are what you should be using to resize UI. Scale should be left at 1/1/1
all the cool kids are using #π§°βui-toolkit which works a lot like html/css
The rest of us smashed our heads against this Canvas thing for a few years until it clicked enough to make functional basic UIs
srsly they should make it more simpler we dont need 2 different ways to scale our ui
#π§°βui-toolkit is the future - there's absolutely 0 chance Unity will invest in improving UGUI
oh alright
before i use that can i ask u how do i make my ui match the screen size so it stays bottom left? instead of staying same place when i go full screen
anchor it properly to the bottom left of the screen
Take 5 minutes to read this page and you'll understand https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
alright
thanks
i dont have a clue what he means by If the parent of a Rect Transform is also a Rect Transform, the child Rect Transform can be anchored to the parent Rect Transform
idk waht the fk i just did but ill take it
oh the pixels are gone and i give up
never touching ui ever again
is there a legacy/retained mode equivalent of GUI.Window
How do I move the button without it being resized?
nvm I found the solution, if anyone ever wonders it's "use sprite mesh"
rotate it to face directly at the camera (billboard technique)
anyone know a good way to remove a background but keep things like shadows or effects in any 2D suite? Photoshop?
Hello guys, I have made this profile button, and on the pointer enter event I want to change the color gradient of the text which is it's child, but I am unable to see any result
Event Trigger component is on ProfileBtn object
Why is my content overflowing the scrollview content?... Isn't it supposed to hide overflows by default?
if it has the mask that is usually has enabled
Ye the slot image had maskable turned off for some reason... It's working now
So, ive done it before except I cant get it to work with cm freelook camera:
The problem is im trying to have an actual gameobject in the camera canvas space of a CMFReelook camera and stay in the same spot when I rotate the camera. Not sure if I have to do this via code and track the cmfreelook pos values and track it, or if there is a simpler solution.
Does setting Transform.position on an object which has a RectTransform set the location of the object in screen coordinates (pixels)? This appears to be the way it works, but I cannot find any documentation on this behavior...
it depends on which render mode the canvas uses
in screen space overlay, yes
in screen space camera, no
in world space, no
Interestingβ¦ Also very useful; if this is an actual intended feature itβs a lot easier than doing the transformation myself. Thanks for clarifying this!
For some reason I can't find a single guide on getting emojis to work in TMP, is it because it's not possible to do, or what? I'm trying to just use the default Segoe UI Emoji font that is included with Windows, but when trying to use the Font Asset Creator it says 0 characters are included.
As long as you use a font that supports them it should be no problem
well I'm using literally the official microsoft emoji font so.. lol
supports 1293 different emojis
I'm assuming it has something to do with the character sequence, but how do I know what to put there?
Well I've gotten it to detect what I'm assuming are the emojis using a couple of hex ranges, but now I'm assuming my issue is UTF-16 vs UTF-32?
because the tweet strings are giving stuff like \uD83E\uDD74\uD83D\uDE12 which I'm assuming is UTF-16 whereas I need it to be u+0001f974u+0001f612
well I'm getting off, so please @ me with any relevant help, thanks
Hello guys!
I hope you are doing well!
I wanted to ask how can I transition from the first pic of Mic to the second such that the circles around the mic are going to be larger if a user speaks louder.
Could you please help me out?
Hey guys, how exactly do I go about making this character image scale to the same pixel size as everything else in the UI here? I've got it all set to the same pixel per unit size, but the little zombie guy's pixels are clearly smaller than the other ui elements
Oh, changing it from an image to a panel seemed to work out the pixel per unit size correctly. Is there something I should know about images vs. panels?
A panel is literally just a GameObject with an Image component on it
Did you maybe make the guy with a SpriteRenderer before?
I might have, just playing around with it now and I think I just believed it was pixel perfect with the UI, but it was a coincidence π€¦ββοΈ
Hm. I just can't quite get this. Is there something I'm missing here? This guy has somehow achieved my desired effect -- all pixels on the screen, both UI and in the scene, are the same size. I can't find a combination of scaling / pixel per unit sizes that does this.
scale them based on volume
is it expected for Unity to call stuff in the Start method of a class inheriting from Selectable while in the editor (not even having entered Play mode)?
I can work around it with an early exit based on Application.isPlaying, just wondering if that might be a bug or if it is expected
It has [ExecuteAlways] on it, so yes
thank you @frosty pewter π
Screen space canvas is not in the same space as the world. What you see is correct: that text will appear at the bottom left of your screen.
Just bumping this topic with another photo example. Anyone able to give me some tips on how to get my UI to line up with the pixels in the game?
So far I've tried messing around with settings for the canvas scaler as well as adding the pixel perfect camera component to my cinemachine follow camera, but nothing has worked correctly so far -- probably because I'm not understanding how the values interact. In any case, I haven't found a combination.
This has to be possible, right? Like, I just want a 12x12 pixel tile game to have 12x12 pixel tile UI elements.
Okay, I may have gotten things to line up with the pixels, but I still need help figuring out how to align by the tiles of the game. You can see that my camera allows for an 11x19 tile area. If anyone knows what settings I might use to have this dialog box cover, say, a 3x10 tile area at the bottom of the screen, please let me know π
Hi, you might want to try #πΌοΈβ2d-tools for tile map stuff
i'm not sure, but it might be more relevant there. I havent used tile maps before
Okay, I can try that! I figured this would be the best place since they are UI canvas elements.
I'm not actually trying to use the tilemap in this case, to be clear, just trying to scale the UI to match the size of the tiles (which are 12x12)
can you show the canvas inspector?
maybe try messing with the reference pixel per unit? just a guess
That was my initial thought, and actually what I saw online, but changing it to for example the same PPU I have declared in my sprite art has this effect.
And although this changes the size of the pixels on screen, I still can't quite figure out how to change some setting so that I can decide how many tiles wide my UI elements are, rather than how many pixels for example. I'd be fine declaring them in pixels, but I'm a bit of a fool and I can't find the relationship between 1 tile == X pixels on my own π
How can I get my second camera to see the game? Is solid color same settings as my main camera but i get nothing
when I paint grass with the tree paint tool it's stretched, left grass is painted, right grass is what its supposed to look like (I placed it manually)
Are you looking for #β°οΈβterrain-3d ?
Looking for help to this @mortal robin
I've imported PNG image and made it sprite, when I want to change color of sprite (in editor or in code) it won't work, any ideas why?
It will overlay the new color over it. So if you have a white surface then it will be coloured red, but if you have a black surface it will stay black. This also means that if you have an originally blue surface and you recolour it with red then it will appear purple.
I was just about to delete my message, I assume color works by multiplying values, so as black is (0,0,0) it can't be changed... Thank you for quick response anyways!
I can't quite see on your image but it looks like the camera is orthographic with no object in its view frustrum, therefore it will only render the background (which you set to white). Have you tried moving the camera or putting an object directly between the white lines in front of it?
So when you guys are making UI elements with pixel art, how do you prevent stretching in cases where the UI element becomes smaller than it can tile? I made this speech bubble, but I can't make it as small as I need to because it warps. https://gyazo.com/f2e187a68fe9f6f44aeaaf8d6aa1b6fb.mp4
When I set it up in game, I set the border to 12L, 12R, 12T, 12B. Makes sense to me that it would stop tiling once it gets smaller than the middle tiling section, but I'm not sure where to go from here.
Yes my canvas is in the white view lines , if you enlarge the image and zoom in it shows it
Just make that the minimum size
Do you mind elaborating? Minimum size of what exactly?
Of the chat bubble
Don't make it any smaller than when it starts stretching
Ohhh I see what you mean. I think what I have to end up doing is literally drawing it on as the minimum size I need Β―_(γ)_/Β―
It wont tile, but whatever.
We wanted to make a sprite (the overlay) overlap the main sprite, and by masking it so that it looks like a filler sprite, make it represent the item's charge, we put the mask in the main image, and the overlay as child, but somehow the mask blocks mouse interactions outside the area despite the main image having maskable disabled? Why does that happen?
The overlay has raycast target disabled too, so it couldn't be the cause of blocking, also proven as if I put the mask in a empty gameobject, put the overlay as child, then the interaction works totally fine
I am making this 2-player offline 2D multiplayer pop the bubbles satisfying board game. How to give the bubbles that popped up (pressed) animation or image/form for every bubble after it's clicked or tapped?
And any more suggestions for the UI?
Gameplay on linkedIN: https://www.linkedin.com/posts/arpitsrivstva_satisfying-activity-6988541814110597120-9GcS?utm_source=share&utm_medium=member_desktop
@vagrant isle Lets chat here now
Now, when the canvas is set to screen space overlay, it won't display in the viewport like a normal UI, but in gmae it will
Well, you can make that button into your purchase button by changing the properties you want
Alr, so ill deletre purchase buttonm
yeah
I'd recommend you look up tutorials on youtube and follow along. Look up whatever you need, you will find it. Search for unity UI tutorials if you want to do more with this UI stuff.
Don't use ChatGDP for your tutorials. It's literally a bot that scans the internet for common code snippits. Might only be good if you don't remember a way to code something like a basic inventory system or character controller. But, that would be the extent of it. Work on learning to use the engine yourself.
What do I drag to target graphic?
The button object has an image component. It should already be set as the target graphic. You can just change the image
The text object is optional, that's just part of the TMPro button.
Either your purchase button script doesn't exist or it has compile errors
Anything in your console?
Nope
Trying to drag this script to our button object, which I renamed PurchaseButton
ss?
and your console is empty?
Your file neam is "Purchasebutton" while your class is "PurchaseButton"
That's your issue
Change the name of the file so B in button is uppercase
Both the file and the class need to be the same
the B in your class is uppercase
Are you familiar with computer coding?
It worked
If not, I'd recommend holding off on learning Unity for a little bit to learn basic concepts of computer coding. A really good source is a youtuber called the coding train. He teaches Java, which is very similar to C#.
Uhh
I'm starting to take C# classes on tuesday
I cannot click the button and the buytton is the disabled col,or?
That'll help to. But either way, coding is important when it comes to game dev.
Absolutely π
π€
Your interactable box is unchecked
God damn
No
It is
Ohh
When you press play you have to chedck it agqin
LETS GOOO
It intercats now!!!!!!!!!
Can I call on you whenever I need help?
Sure thing! Happy to help!
Thanks!
For sure! 
I'll give you a vision of what I am tryin to make
It started as a simple tycoon, and now I'm thinking of a larger view. ex.
A tycoon where you can build factories to generate something, I'm stuck on that part
I took 2d because it seemed appropriate for me
3d seemed quite difficult
Interesting idea
Should I go down the 3d route?
Thing about unity, in my personal opinion, I think 3D is a little easier because Unity is built for 3D, but can manipulate the camera and use different methods to appear 2D. If you wanted to learn straight up 2D game dev, Gamemaker or Godot might be a little easier, but Unity still works fine.
It's just that you need to do a couple extra things to work in 2D in unity
π π
Nice
3D game dev in unity is very easy imo
I think I'll make a new project now for 3d
Sounds good.
That is so trueπ±π±π±
why is this not scaling the whole screen
transform looks like this
canvas like this
Show the texture
The texture itself, does it fill the whole square
And are you looking at it in the same resolution as the reference resolution in your canvas scaler
Hello. Do you know some good sources how to build UIs in Unity that scale (in terms of project complexicity, not screen size)? On YouTube I only found some basic ones. My problem is that everytime I make something UI related in Unity, I always end up with total unmaintainable mess. And my UI is decoupled from game via ScriptableObjects. :/
Heya, I'm making a UI at the moment, and I'm struggling to figure out how to make the background color opaque..
I've done a couple searches and can't find anything..
I'm generating the UI like this
private Rect window;
void OnGUI()
{
window = GUILayout.Window(0, window, SomeMethod, "My GUI")
}
^^ I'll also point out I'm using this GUI method as I'm doing it entirely in C#.
Can anyone help I have a game ok but whenever I try to go to the settings canvas no joke it disappears from existence nothing in script is causing it to do this
You need to be more specific about what disappearing means. Does the object get removed from the hierarchy? Does it turn off instead?
Can't take screenshots of cursors so consider that red dot as a cursor. Why is my input field have such a small "hitbox"?
yellow is the highlight color
am i crazy or is there no built in system for keeping a selected object in view in a scroll rect.
guys, anyone, please?
Help!
Why is there a 1-second lagspike when doing SetActive(true) on a scrollview with 50 ui images in it? I removed every single component and everything to find out what causes this, and there is still a lagspike when doing this. Googling told me that scrollviews are just badly programmed by unity. Is there a way to fix this, to avoid the lagspike?
Thanks, I'll check these out. I hope theres a simple fix for this because all im doing is enabling and disabling a simple standard scrollview
Hi, I'm trying to make two text boxes that adjust their size so that if there's text in one of them but not the other, the other will shrink down to give more space and vice versa
So if there's no flavor text it shrinks to nothing, and if there's a bit but a lot of rules text they adjust so it looks good
Use layout elements with flexible size:
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIAutoLayout.html#understanding-layout-elements
Alright I've gotten them to adjust sizes relative to each other, is there a way to make sure they have the same font size as each other?
I have here 4 buttons each rotated by 90 or 270 but for some reason they dont scale properly
The anchor points for them are in each quadrant's corner but it does this weird vertical stretch instead
Appreciate any help i can get π
Hey there. Anyone know why when I click on an inputfield (in game) to enter text, it automaticaly selects all the text instead of puting the cursor where I just clicked? I always have to click a second time to be able to put my cursor where I want to type.
removed from the hierarchy
Well, then something is deleting it. Search your code for any Destroy calls.
my monitor's resolution is 2560 by 1440
oh
i need to be setting it to my monitor's resolution
cant believe i didnt notice that
so then if i have the reference resolution to my monitors, itll properly scale on resolutions like 1920 x 1080?
The reference resolution mainly pertains to keeping your imported artwork to scale as you receive them.
If they were designed at 1920*1080 resolution, then using that as your reference resolution means you can keep them at their native size in Unity and it'll be the right size.
Is it normal to have to scale something like 20/50/100 times for it to be visible on the UI Canvas?
I can't tell if it's the Canvas that's too big or my UI elements that are too small
havent been able to get it to work
image looks like this
seems like none of my ui is aligning itself to the anchors
is it possible to remove the alpha blending thingy?
is the image parented to something?
i think i found the problem
yes, it is parented
@gloomy marten
for example, buttons
i think its because [Buttons] has a transform
but if i remove the transform, the children cant have anchors
how might i fix this
am i just unable to categorize them like this?
would i need a new canvas to organize better
Maybe you can make the parent fill the whole screen
as it says in the github:
dont enable, then?
you could try moving them out of view if you want to keep them enabled
since they will still affect performance in some way
this is false
if you read the links i gave you, you would know that canvasas only make 1 draw call once whenever a change occurs no matter how many things are in the canvas
so basically if something moves the canvas gets updated
and if you move it out of view for one frame you only need to do one draw call
first section of the first link for god's sake
Can anyone help me I have asked this before my settings canvas whenever I hit play and try to go on it disappears from the hierarchy and even when I try to go on it not playing the game just in the editor if I try to enable it just disappears into the abyss
Hello. I am having a problem in which the ItemOptions1 button is not pressable. Do any of you know what the problem might be?
its also not implementing a function via AddListener
Hey, for some reason my assets seem to be operating on different coordinate systems and finding 0,0,0 at 3 completely different places. Anyone have a way to anchor them all to one coordiante "system?"
probably a rookie question but
i could not find an answer
could you provide a bit more data?
there could be a lot of problems
I am not exactly sure but all I know is that whatever function I add to it is not running
cant really help with that
you could try buttonreferance.onClick.AddListener(function)
its another way of doing it but it might work
yeah that's what I have
the button in general doesn't work
did you referance it in the inspector
yeah
yeah
this is not true. AddListener is working. your issue is that your button is not being clicked not that AddListener isn't working
could you show the code?
well the add listener function that im trying to add doesn't really show up also
it won't show up in the inspector, that is expected behaviour
no the code
their code is fine. their issue is that the button is not detecting clicks. which is why they were sent here from #π»βcode-beginner
ye
is the debuglog shown running?
yeah
no idea what the problem is sorry
the problem is that the button isn't registering a click
i meant i dont have a a solution
ah its okay
go into play mode
open the event system
unfold the menu on the bottom
it will tell you what you are clicking on and hovering over
that will tell you what you are hitting
if its the button all good
if not you have to find out what that is you hit and why
Good evening gentlemen. I am following along yet another basic tutorial to hone in my basic knowledge of Unity and am having trouble with getting the text to appear in that little UI square.
Anyone have any inkling based on this picture?
the text box is probably too small
since the font size is 212
even when I make it smaller it also doesn't appear
oh wait
when i put it into decimals it does
but its blurry, what option woiuld I do to make it not blurry?
not exactly sure but text mesh pro might work
wdym by that
if you go into UI, you should see some option called text mesh pro
I think that makes it more clear
@real arch
i mean this on the bottom of the inspector
(only there in play mode)
what does it show when you click on your button?
nothing
so you are not hitting the button
see if there is any image over the button
every graphic that is drawn after the button (is lower in the hierarchy) can block the click if its over the button
even if its transparent
something strange I noticed tho is that the buttons from a scene I made inactive can be pressed
I don't think this should affect anything
on what object is the button component?
itemoption1
are there any UI object following below (not its children)
no
well just this canvas but it should be inactive
oh wait
I never set it to inactive
that might be worth a try
oh my god ima ctually unintelligent that worked tysm
or you can use a canvasGroup to disable block raycast for that panel
glad you found the issue
use text mesh pro
should be in package manager
built in unity text is bad
also fellow gmtk watcher?
yeah. this is my fourth tutorial
just learning the basics. this is the third engine I'm tryna learn
so whats the biggest reason I'd use Text Mesh Pro Text ui over the normal Text UI and vice versa?
well first
as you saw
it doesnt scale down
meaning if you want it to appear
you have to make it giant
or use some werid workaround
textmeshpro you can just scale normally
also you did kinda do it wrong
ui needs to be in canvas
so with that in mind, whyt would someone use the normal Text one?
to my knowledge few do
unity has it built in for a reason
why they havent just improved their current one
no idea
also ui is scaled and placed based on canvas
so the text UI needs to be in that big canvas rectangle?
it treats canvas as the camera
yes
instead of forcing you to make ui to move with the camera
you put in the canvas
which is stuck to camera
so your ui needs to be approiately scaled
to fit in there
hm
you could probably fit the text in canvas but i still recommend tmp
yeah
so I couldn't move the canvas around earlier when I was playing with it, is that normal or is there a setting I need to enable?
you shouldnt
its always stuck to camera
any ui element in the canvas
moves with camera and is scaled down to fit
its a bit complicated to explain
basically for any ui elements that are children of the canvas
treat the canvas as the camera
it will be that size and in that location
and it will also move with camera
is there a way to make the canvas go in the other direction?
so its to thr ight of the camersa right, but I want it on the left
Additionally, is there a way to transition a normnal text ui to a TMP Text UI?
you can move the camera i guess
as for that, i dont think so, but tmp programs the same as normal text, but you need to reference it a bit differntly
Why does the content of my scrollbar keep going to the bottom left of the canvas?
question how does the layering on canvas work? Causei notice that sometimes canvas objects with higher order in the layer still get layered under lower orders so i'm sure if there are exceptions to the layerings or not. Are the orders just within a certain scope and if so what are they?
It's just based on hierarchy order
Is it weird that I'm not able to use the rename shortcut? I'm on windows and every time I press f2 it just doesn't do anything
I have a canvas that I have set to scale with screen and in the editor, It's perfectly sized:
but looks like this when i export/build:
Yes. Basically lower is drawn after (which means on top)
You can freely test different resolutions in the game window before building
How can I make it fit perfectly for all displays?
^
I don't know where to put this, I guess this channel is a good place, but how can I set the camera to portrait?
Unless you've messed with the camera's viewport, or are rendering to a render texture, it will render to the entire screen
Are you asking how to set the game to portait mode on a mobile device or something?
Hey Guys, im struggling with the UI.
I made it for normal 16:9 aspect ratio, but need to make it useable on widescreens like 21:9 also.
my problem is, that my image is not scaling just stretching, and i have no clue how to deal with it:
I uses some background colors to see how my different ui elements behave. i used a vertical layout group in the menu container.
But no checkmark there is behaving like i thought it will π
Hey, I'm trying to print text to the screen letter by letter. I managed to do so but the text jiggle sometimes (but on the same positions exactly every time I run this code):
IEnumerator PrintCredits()
{
_CreditsTextBox.alignment = TextAlignmentOptions.MidlineLeft;
// Print the text letter by letter
foreach (char letter in text)
{
NewText += letter;
_CreditsTextBox.text = NewText;
float currentDelay = delay;
if (char.IsWhiteSpace(letter))
{
currentDelay = 0;
}
yield return new WaitForSeconds(currentDelay); // Wait for the specified delay
}
yield return new WaitForSeconds(RemoveLettersDelay);
StartCoroutine(RemoveCredits());
}
Here is a video of what happens:
(notice how the text moves up and down)
what could be causing this?
I am using an SDF font too + here is my text component in the inspector:
This is not a good way to do slow text reveal with TestMeshPro
Wow this is amazing. didn't know that was a thing. Thank you!
Thanks for this but I want the camera in the editor to be portrait, all the resolution settings are for landscape
This works well but when removing the characters this will remove from the end and not from the start.
Is it possible to do the removal with this method as well? so the characters will disappear from the start
@mortal robin Nevermind, I found firstVisibleCharacter.
However the text still Jigles.
Here is my Code:
IEnumerator RemoveCredits()
{
for (int i = 0; i < _CreditsTextBox.text.Length; i++)
{
_CreditsTextBox.alignment = TextAlignmentOptions.MidlineRight;
_CreditsTextBox.firstVisibleCharacter = i;
Debug.Log(_CreditsTextBox.maxVisibleCharacters);
yield return new WaitForSeconds(tDelay); // Wait for the specified delay
}
_CreditsTextBox.text = "";
}
I get the exact same result as before, and the text moves up and down on the same time
Silly question.. is it more performant to enable/disable a canvas game object , or the canvas component to show or hide elements?
@azure flame #π»βunity-talk message
So is the absolute positioning thing the problem
Use dynamic anchors for children and they will conform to the size of the parent https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
Oh thank you so much, by default it takes the size of its parent, but it just kinda stopped doing that randomly, but thank you so much for this I will try to fix it tomorrow
hey guys, quick question, does anyone know why i cant drag this tmp to the field ?
i believe it worked me in the past
Show the step counter inspector
You're using the type TextMeshPro when you should be using TMP_Text or TextMeshProUGUI
Ahh ok thanks, whats exactly the difference tho=?
UGUI is the UI one
TMP_Text is the parent class of both and so can be used for either
Ok i understand, and TextMeshPro is just the component (or script) on the game object of type TextmeshProUGUI?
No?
GameObjects don't have types
They are just GameObjects
TextMeshPro is a 3D text. It's just like the legacy TextMesh.
TextMeshProUGUI is to Text
as
TextMeshPro is to TextMesh
ah ok, thank you π
Does anyone have any idea why the android build UI is flickering? It only happens to the screen space canvas, it stops after I reenter the application.
Here is the example footage:
Also, I exported the project to PC and it works fine, but for reason on android it's completely messed up [Using Unity 2022.2.1f1]
My UI's position on canvas is okay in edit and play mode but when I play the game normally, its in wrong places
do you have code or anchoring that set position? It'll change when you hit play if code sets it differently
Nope, no code
Just a matter of properly anchoring your UI elements then
So i have an input field and i want it so that only the end it editable but i want it so you can click anywhere on the input field to edit the small portion, how do i do that? Ex: Lets say i have this Debug.Log(Something") and i want the player to be able to add the ; at the end to fix the error, how would i do that without the player being able to edit the first part of the script?
You might listen for changes and then use the SetTextWithoutNotify to undo any changes you didn't want
Check whether the start of the string has changed, and if it has, set it back to the old one
ah
ok thanks
um i ran into another problem, so as you see the message im trying to use has the "" in it, unity sees that as an error
its probably an easy fix but idk
Use \" as an escaped "
like \" before the Hello World
it got rid of the errors but when the player types in the correct answer it doesnt work.
im confused rn
is this correct?
didn't you want to have a ; in your correct string?
Also, add some logging, or learn the use the debugger so you can actually see what's going on
rather strange issue with text. it's a bit blurry for some reason
the font size is 72
it's really noticeable when zoomed out to normal zoom levels too
no issues when it's in scene view though. the text is on a worldspace canvas
Anyone help how I can fix this?
This is the code:
Collider2D[] proximity = Physics2D.OverlapCircleAll(position, AspirerClass.AspirerRange);
int numberhit = 0;
factiontext.text = "";
foreach (Collider2D hit in proximity)
{
if(hit.gameObject.CompareTag("FactionCenter"))
{
numberhit++;
if(numberhit < 1)
{
factiontext.text += hit.GetComponent<Faction>().fname + "\n";
}
else
{
factiontext.text += hit.GetComponent<Faction>().fname;
}```
then this is the ui panel and text
the vertical layout group kind of dont adjust automatically on first click
you could use LayoutRebuilder.MarkLayoutForRebuild or LayoutRebuilder.ForceRebuildLayoutImmediate to rebuild the layout
i feel kinda silly asking this but i couldn't get any hits on google, how would I detect the mouse being over PANEL, even if its over BUTTON at the same time? IPointerExitHandler is triggered when the mouse goes over the button, even though its still in the panel.
What do I feed him? I haven't used any rect transform in code before
A RectTransform, as it says in the docs and in your IDE
IsPointerOverGameObject can help there I think
I got it, thanks! I didn't know that transform and Recttransform can't be used in place of one another. I thought they Rect overrides transform
RectTransform is a child class of Transform.
quick question, so how do i change color of text mesh pro mid sentence
um no
you have to write valid C# code of course
strings in C# must be surrounded with quotes.
?
yes
you're missing the closing tag though (it might work anyway)
although IDK if it's going to work with an input field
does the Text component in the input field have Rich Text enabled?
I would imagine it's not enabled by default
What I need to use to recreate for example clash royale swipe left or right to change tabs midway you can see both tabs active if released it snaps to whichever tab was more visible I want this but horizontally 
Should canvases be included in the prefab of a UI item?
anybody know whats going on here, im using HDRP 2021.3
when i zoom in on the image in the editor everything around it gets really bright and when i zoom out it goes away
happens only when the image is there
both raw and normal
Seems auto exposure, you can disable that if you want (google how to do so, I dont use hdrp)
ah
thanks
i fixed the issue of the blinding lights on the edges but the image still kinda goes to the second image when zoomed out
how do i fix this
Familiarize yourself with https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
I'm going crazy with this UI problem I'm having. When I instantiate a UI element prefab, it automatically gets added to a canvas group, despite no object in any prefab having the canvas group component. Then, if I instantiate a second instance of said prefab, the canvas group component on the first one has its "interactable" attribute set to false, and cannot be changed. Does anyone have any idea what's happening?
You'd have to show your prefab and your code etc
like wdym by "gets added to a canvas group"? Is there a whole new GameObject being created with a CanvasGroup component? Show what you mean
@mortal robin First image is after a button is pressed on any input. It creates a PlayerSetupMenu gameobject appropriately. It adds the Canvas Group component automatically for some reason (MainLayout does have a Horizontal Layout Group component, so maybe that's why?). If there's only 1 PlayerSetupMenu, the Canvas Group is set to interactable. However, as soon as I create a second PlayerSetupMenu, the first one has its Canvas Group's interactable setting set to false, and it cannot be changed in the inspector or via code. This adds transparency to all members of the canvas group and blocks raycasts.
If I just plop 2 instances of the PlayerSetupMenu into the scene the same thing happens. The first has interactable = false, and the second has interactable = true.
can you show the inspector of your PlayerSetupMenu prefab?
and also the PlayerSetupMenuController script code
@mortal robin So even if I totally disable my MainLayout gameobject which has the canvas and stuff, and delete all other things from my scene, and plop 2 PlayerSetupMenu instances into the scene root and start it, they both get Canvas Group components and 1 is set to interactable and 1 is set to non interactable...
I have no idea based on this stuff where the CanvasGroup is coming from π²
I am using a slider to show exp but as a user i can slide it, How can i not slide it lol
with my mouse
why can I not access these properties?
Default materials cannot be modified. You need to create your own.
Should canvases be included in UI prefabs?
im trying to compare two values of string name inside two different size arrays is that doable??
public string[] questItemName; has 2
var quests = QuestManagerPlayer.instance.questMarkerNames; has 3 but i just want to compare if they both have the same values
Which string in the first array do you want to compare to which in the second array?
i ended up using linq var same = questItemName.Intersect( completeQuests ); thanks tho
Eventsystem has a RaycastAll method you can use to debug with
Can you elaborate? Iβm relatively new to this
Anyway to justify UI > Text? (No TMPro :< )
Guys how to change size of button field that you can iteract with?
Give the button an image child with the size you want with 0 alpha and raycast target on @static ridge
how do i stop TMPro from jittering when its text changes?
for instance having a speedometer
Got a video?
ye on sec
Can probably play with the text alignment
seems like it's not doing any difference at all
Then consider separating it to different text objects
it can still apply even to one text object
so not the best solution. i remember there was a specific option for this, i just dont remember which one
how can I decrease panel transparency together with all its children with it shouldnt this be like default behaviour
Use a canvas group
Might be a dumb question, but im struggling to center a parent and child as I'm not getting any snapping options like how I'm used to -
how am i supposed to find the x to center it?
I'm using the editor as well, no code
You could use a vertical layout group to center the elements automatically@tranquil pasture
how do i make my background in the background
use Ui layer
and in order in layer make it 0
yeah that one
yea but my text is still behind the bg
change the hiarchy order too
Okay thanks
do i move it down or up
No matter where i put it, its the same
Order in Layer is only used with canvases. If you have more than 1 canvas, this is used then.. it will draw the lowest number first, highest last. So for a background, you'd want a negative number - if you're using multiple canvases
if you're using 1 canvas, then you have to use the hierarchy, it draws from top to bottom.. things at the top are drawn first, bottom last
I only have 1 canvas yes
If you still can't do it, show screenshots of what your setup is, and what you're tring to do.
making a meme clicker game
that's why i added some russian bg
i moved the polar bears to the bottom still nothing
the canvas is at the top atm
carwash are u still alive
oh there u are
Moving the canvas up/ down doesn't change anything
It's the children of the canvas that use the hierarchy for draw order
Your screenshot is without context, I don't know what is wrong with it.. and the scene view objects are quite small.. I can't see the UI properly
so what is the course of action
ok ill zoom in for you0
hierarchy
scene
so your TMP isn't showing, is the issue?
select 'ScoreText' in the hierarchy.. show the inspector
Before the background I could easily see the text
I just placed the background in and the text went behind it
so if i move the background out of the way, the text is behind it
You're using 'screen space - camera'. The UI is on z pos 90, it's probably behind the sprite background
lower the plane distance
or use screen space - overlay
if i use overlay the text just goes away so i'll change the plane distance
K it works ty
if i use overlay the text just goes away
Then figure out why and fix it.
if it works it works
hey guys, could anyone help me with replacing game objects with other objects using a button
just need a script to proceed
suppose i have 2 objects a cube and sphere I want to replace cube with sphere using a button
and why is my camera not detecting the UI button
You probably haven't positioned the button properly. Double click your canvas in scene view and look at where it lies in the canvas
have button code deactivate the cube and activate the sphere.
hiya, im wanting to space and center these
i thought i could do it with horizontal layout group but they're not spaced equally as i expected them to be
Is there an easy way to do this considering the mismatched sizes of the boxes, or should i just be doing this manually?
nvm was problems with padding 
back again,
how would i align each of these centrally across the canvas (horizontally)? 
Hey everyone, I have a panel with four buttons that belongs to a scroll view, but when i try to scroll, the buttons take the focus and perform their functions instead of scrolling. I have tried to deactivate them when a drag is detected, but then it does not scroll and it just deactivates the buttons meaning i have to press again to scroll. Does anyone have any ideas that might work?
Does anyone know why my buttons in game would be disabled, despite everything set appropriately in the inspector?
but it wont be like replacing objects, i need the sphere to be placed in the place where the cube is
I don't see the problem
make them both children of a parent object
only move the parent
they will always both be in the same place
I have been working on my menu system, one of the options is the NewGame button
when I push the new game button the new game menu should appear immediately, I have to click it several times for it to appear initially, after that it loads instantly until the scene is reloaded (when entering play mode)
this the code that runs it (aside from unit's button system)
this is how the button is configured
I've been getting some reports for a TextMeshPro issue and opened a thread on the forums. I was wondering if anyone here knew something: https://forum.unity.com/threads/bug-unicode-array-size-issues.1381842/
So I have this bizarre issue where if I spawn a UI Prefab, like a card for example under a canvas that exists by default, it multiplies the scale of the UI Prefab by 108
Does anyone know how I can prevent this without adding extra bloat code?
scaling is controlled by the canvas scaler. You generally don't want to think about or touch it
worry more about the RectTransform anchors etc
Iβll take a look thanks
Alright, now I got these big red X's
One second
that means the thing is anchored such that it has negative size
basically the left side of the rect transform is on the right
or top/bottom
etc
Oh what the heck
actually for some reason the prefab just had negative numbers
#fixed
Edit: Problem resolved in code-general
The image I dragged in for mt button seems to off gained more pixels (this stuffs up mine as I am doing a pixel art style for my ui
Hello, In android build, TMP input field do not show the blinking cursor on being selected/checked why is that and how can I enable blinking cursor on select
Possibility #1: Mask it, build yourself a mask image by 9-slicing ( https://docs.unity3d.com/Manual/9SliceSprites.html / https://www.youtube.com/watch?v=gO4jnaxvMjk )
Possibility #2: Try this https://github.com/kirevdokimov/Unity-UI-Rounded-Corners
π Download package for FREE: https://www.patreon.com/posts/54505463?s=yt
This tutorial/guide will show you how to create a nice rounded corners for you Unity project with UI elements like buttons and images/frames. I will show you how to generate a rounded corner sprite image and then apply it to your project with sprite editor. At the end you ...
Thanks will look at them now
Nobody is going to write an entire feature for you. You need to make an effort at least. Break your problem down into smaller steps.
You need to be more specific about what you're trying to accomplish. Again, break it down into the smaller steps.
so first:
I have a normal table, I want to replace that with a chair or bed
to do so I want the player to click the button to replace the table with a chair
idk how to make it happen using a button
hey,
UI automatic navigation doesnt for some reason work properly. Stats/Skills/Recruitment button should target the button above, called "Gold+", but they seem to prioritize the button in the middle of the screen for some reason?
or prioritize buttons further up, based on current position
any reason why it shouldnt prioritize the first button above it, in this case "Gold+"?
it seems to do it correctly for "Skills", but not Stats/Recruitment
osteel can u help with my problem
what kind of button. a UI button that you click?
yea
google "how to make button do something when i click it unity"
now you say you want to replace a table with a chair or bed
that means you need to find out how to remove an object, and how to spawn an object at a position
google those too
wow thanks
]
I have made a script that makes a grid, then assigns a number to each of the tiles. i want the number to be displayed on the tiles, but i can't get it to work. anyone know how i can fix it? The green square is the one i am looking at in the picture
Your canvas is empty. Any UI element has to be under it to show up
wdym empty?
Also if you are using canvas in world space you need to set it so
ok i did that. but how do i make it not empty?
thanks
i made it work but it is too big. when i make it smaller it gets blury
any easy fix?
Yes. Default text elements are terrible. Use SDF ones, use TextMeshPro text components, it will install TextMeshPro package when you do so
THANK YOU
is there a way to have the position of certain elements depend on the presence or absence of other elements?
i did grid layout for the 4 stars thing but when i tried to do it for the scroll bar it restricted its size
Yep using the automatic layout groups
And layout elements
like vertical layout group?
Yes
and how do i change the size of each element in the vertical layout group?
That's what Layout Element is for
thanks for answering and i am confused what on layout element will change it cause i was tinkering with the parameters but it didn't change anything.
You'll also need certain settings on the layout group
You'll want the children to control their own height for example
so should i change this to vertical?
If you only need vertical layout, yes
i guess for something like a scroll bar it doesn't bode well with vertical layouts?
How do I make menu navigation with a controller?!? I'm using canvases. I wanna make it so with the controller, you can scroll through buttons.
Never mind, I figured it out. I had navigation set to none, which was obviously the problem.
I found the Shadow component but it has no blur effect. Any idea to bring that in? Are there plugins for that?
i'm not sure what you're looking for, but maybe this might be useful
https://github.com/mob-sakai/UIEffect
not exaclty what I meant but still a nice component! thanks
For what ratio should I design my UI?
In Figma I've chosen 1440x1024 - However I am unsure if this resolution represents the major screensize of players nowadays
what platform
Set the canvas scalar to scale with screen size
1440x1024 is an odd res though π€
The answer to why figma has that by default is here: https://www.reddit.com/r/FigmaDesign/comments/dk3cq2/why_figma_sets_1440_x_1024_pixels_for_desktop/
when was the last time you played a game in 1440x1024 though
anyone got a fix for rect transform values being constantly set dirty in prefabs and whatnot?
is there any way to lock such prefab values or prevent them from being changed?
is there a technique to have UI elements and even menus screens to scale and move its sprites around per device its played on? different screen ratios etc?
Hey, im trying to set character colors on an text mesh pro input field, but for whatever reason nothing changes.
public void SetCharacterColors()
{
//Text is the TMP_InputField, it's not null
var txt = Text.textComponent.textInfo;
var characters = txt.characterInfo;
for (int i = 0; i < characters.Length; i++)
{
characters[i].color = new Color32(0, 255, 255, 255);
}
Text.textComponent.ForceMeshUpdate();
}
When i go debug, the properties(color field) do infact change so I'm wondering why it does not reflect to the text in ui
And anchoring them properly. See the pinned message here on Layout
Thanks @sterile wedge I will read through that. I am very new to Unity so please mind my questions if they are too noobish. π
Hey, did 2022 remove the "width" option from the UI for rectTransform? I only have options for positioning and Height and have a harsh feeling that I am missing some setting somewhere
so i noticed my text is getting in the way of my mouse over event (where the background appears and disappears when i hover my mouse over it). Is there a way to fix that issue while still allowing the text to be visible?
basically if i hove my mouse over the background, it plays out normally but when i put my mouse over the text it treats it like the mouse is outside its range
Uncheck "Raycast target" on the text component
got it
how do i allow ui images or text to work with global volume?
you can set your canvas to Screen Space - Camera
thanks
the chromatic abberation kinda messes with it
Could you show me a screenshot?
ok
You could make a new camera just to render the UI stuff with a different volume where you can tweak it to your liking
without affecting other things
i would i make a camera that uses a diffrent volume?
the global volume is connected to all cameras that has the option on
are you using URP or hdrp?
URP
I'm not sure if that's in URP but I think you can set a volume to work on cameras with specific layers only
nope
how do i make buttons and stuff stay in the same place and the same size no matter if i have the game tab maximized or not?
I just created a 2D Object > Square for a health bar on the HUD UI. But for some reason it always hides behind the Canvas/Panel object. How can I make it appear in front? I already moved it up the Z axis but that did not really work
Learn UI anchors and pivot settings and the canvas scaler
2D Square is not a UI element
It's a game world SpriteRenderer
Use Image for the health bar
Yeah I wonder if I can make it an UI element?
UI - image
hm alright
On the right side you can see that my Script only has one parameter.
However in my script I declared 4 parameters. The missing ones are of type UnityEngine.UIElements.Image. Is that a problem? Cause I want to pass BodyInspector which is in fact UI > Image.
public TextMeshProUGUI characterName;
public Image bodyInspector;
public Image health;
public Image stamina;
ok the problem was I needed .UI not .UIElements
I'm trying to display the player model in their inventory with a render texture but this weird effect is happening. Anybody know why or how this problem could be occurring?
Is there a way to make the slider crop the image instead of resize?
How do I put a layout on this that doesnβt break it I tried a grid, horizontal and vertical but all donβt work like I want (This is what I want it to look like)
set the clear settings of the camera that renders that model to color then set as the color some color + alpha to 0
I'm very confused on how to use multiple canvases in a 2D game. For instance I have a HUD for my player but then every enemy in the scene need to have their own canvas to render things like HP and status effects. Currently I've set the player HUD to use render mode "Screen Space - Camera", and each enemy uses a canvas with "World Space". This works up until the point where I need to share UI prefabs between the two. One of my prefabs has a size of 64x64 which becomes perfect for the player HUD, but for my enemies this size covers the entire screen since 1 unit in screen space and world space doesn't appear to be the same thing.
Could I get some guidance on how I should approach using multiple canvases to be able to share things between them without worrying about size and stuff?
Generally you'd either combine the UI elements for multiple actors in a single UI by converting their world position to UI coordinates, or not use canvases for them- you can use text and sprites for status effects and the like without a UI
@gilded path Hmm, text must be used in a canvas as far as I'm aware, no?
How can i make sure that the ui buttons do not go outside the parent, parent is stretched. canvas settings are set to scale with screen size, match height 1. I also want the buttons to equally take up full space vertically
Ui text goes on ui. A tmp or legacy text object can go right in the scene.
Is there any actual documentation for TextMeshPro?? I cant seem to find anything useful about it.
Unity doesn't have any built in way to do lines in the UI.
This repository of UI extensions for Unity includes a line renderer
https://github.com/Unity-UI-Extensions/com.unity.uiextensions
How do I get the menu to appear behind the buttons? changing z axis didn't work for some reason
Anyone
how can I manage render priority of the ui images?
as you can see there is slots on the inventory tab
and there is some item icons
I want to render the slot's portrait on top of the item image
so it may look better
any idea?
Please
Try rephrasing your question in a way that makes it clearer instead of just repeatedly complaining about a lack of response?
I donβt know how else to word it
Is this where I ask about buttons? Anyhow, my buttons in my main menu don't work for some reason unknown to me. Does anyone know why this might be? I can show their properties if so needed
Okay, absolute expert level question for all the geniuses and masterminds in here...
How the hell does the favorites-thing-work? Unity Documentation on the projects folder has one line which is "drag stuff there" and that does not work.
Make sure they are children of a canvas, that the canvas has a graphics raycaster component on it, and that you have an EventSystem object(should be added automatically when you add any UI component to your scene) in the scene
works fine now thanks π
I am trying to make a card that is seen as UI.
I have followed this tutorial by Brackey's to the letter
https://www.youtube.com/watch?v=aPXvoWVabPY&t=199s&ab_channel=Brackeys
In it he uses a regular shape for the image and does not run into the issue I am running into
My Issue: I am trying to make an image holder for any cards image i place into the game for a card but the card has overlapping elements that should be seen above the image. The image when placed into the scene however will be placed above the elements that should be above the image. (sword, shield, and star) (Ex.DiscordCardExample)
The card is the first image in the post. As you can see the sword and shield Icons both overlap the top green area. this area is where the cards image would go.
Question: Can I make some sort of mask to allow it so that whenever I add an image to the card UI it has a mask applied to it that will only allow the image to be seen below the elements such as the sword and shield and star icon.
Things i've tried: Mask component on Imager holder Ui Element (I think i am using this wrong as no image shows when I apply this
using photoshop to indiviually add the mask applications to the image (This kind of works but i wish to avoid this as I know there has to be a better way)
add-on: The cards in the example is made in Photoshop and is a png if that helps
When making a game you need a good way of storing data. This is where Scriptable Objects come in! In this video weβll learn how to use them by looking at an example: Making cards for Hearthstone.
β Project on GitHub: https://github.com/Brackeys/Scriptable-Objects
β₯ Support Brackeys on Patreon: http://patreon.com/brackeys/
Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·...
Does any one have any ideas of could anyone help?
This doesn't show the problem you're having, so I'm not 100% sure I've understood your issue.
If you're saying that when you add a card image to the main area it is on top of the card features.. then all you need to do is order things correctly in the hierarchy. UI is drawn from top to bottom, so the things at the top will be drawn first and bottom last.
the middle top area is supposed to have an image however when i place an image unity ui element in that area it is a square. This square image when placed on the single photoshop image blocks a small part of the sword and sheild icons that are part if the single image. Is there a way to fix that?
Should i just get rid of the middle part of the photoshop image where the image will go? Or is there a way to make a custom mask to cast the image onto that is not a square
Dunno why you won't just share a screenshot demonstrating the issue ...
The background gradient should be 1 sprite
The card title area/ description should be their own sprite
The sword/star/shield/ boot/ circles should be separate sprites
Doing this will allow you to put them in the correct order, so when you put in the card image after the gradient (and before everything else) in the hierarchy, it's all displayed correctly
all my ui just disappeared it's still left in the project it just won't show
they are all active too
Using my magic ball, I see they're positioned offscreen, probably
they're not
Hello, can someone explain to me why this is happening with my ui? images width is different (or completely gone) depended on how big screen is or how much I zoomed in. (Sorry for low quality video)
Is there a way i can track/log when a canvas becomes "dirty" and is relayouted?
Then until you actually SHOW us something, no one can help .. without spending hours just randomly guessing
They're 1 pixel in size?
3
when that happens it's because the line is too small
It was 1, bet then I read about how it can be +-1 pixel when moving, so made it bigger, it does not disappear when it's 4 pixels wide, but still flickering
what's the scale of the recttransform ?
1x1x1
goodo
look into pixel perfect, see if that's gonna sort it for you
I don't know enough about it to say for sure or help further with it
yes, already tried to play with pixel perfect modes, render modes and set canvas scaler to constant pixel size, same thing happens
Another possibility is that this is a visual artifact from the editor rather a problem in your code/set-up. This could be because your scene or game window will try to render a 1920x1080 (for example) screen in a smaller space (the specific editor window). So to make all the pixels fit it would combine or ignore a couple of them resulting in these artifacts. Have you tried running this in a build or have your window at the same size as you wish to render your game?
Yep, make sure the game window is set to scale 1x
That actually might be true, it looks fine when screen is some specific size, but also other strange thing that I found out, that this also happens when moving ui object, not scaling screen
Scale is 1
So yeah moving objects will result in the same artifacts when your editor has too small of a window for the visuals it is trying to render. So, I believe you are fine on that front. Also for accessibility purposes keep in mind to make sure your UI and important elements are large enough and not in the single numerical pixel range. For a border you should be ok.
Got it, thanks for explaining π
Let's move discussion here @spice swift
#π»βcode-beginner message
sure
Can you show your hierarchy
the layout element only takes effect inside layout groups
and only when the group allows it to
should i expand everything?
oh, only some text that im not using
and thats right
i made a group
for the buttons
this is the inspector for the shop
do you see something not allowing my game objects to be resized
?
all those checkboxes in the horizontal layout group can mess with things, some of them are misleadingly named
I always have to re-figure them out when I use them
i literally have no idea what most of them do
How to make my game use "Free Aspect" as resolution? And get rid of these
Free Aspect isn't an option outside of the editor
That window also isn't available anymore, in newer versions of Unity
That question also doesn't belong in here, it's not UI/UX
I disagree with your last statement. I do think questions about the screen resolutions are relevant to the User Interface channel. Or which channel would you otherwise recommend for this topic?
As for lyxerexyl: Why do you want to enable free aspect resolution? We might be able to give better advise if you could explain this a bit more.
Is there an event on rebuild/dirty-ing of an ui element?
Hey guys, wasn't sure if I should post here or #π»βcode-beginner but this felt more appropriate.
This code is updating my slider in the inspector, but not the canvas -- what did I mess up here?
https://gyazo.com/255bbbd4ea73e452c65ac86ae9adbeb2.mp4
if (selectedTileHealth != null)
{
healthBarSlider = healthBar.GetComponent<Slider>();
healthBar.SetActive(true);
healthBarSlider.maxValue = selectedTileHealth.MaxHealth;
Debug.Log(healthBarSlider.maxValue);
healthBarSlider.value = selectedTileHealth.CurrentHealth;
}
your slider is not even active
Oh my godddddd
also - for a health bar you shouldn't use a slider
I just saw that as you sent that. Why shouldnt I used a slider?
you can just use an Image component with image type set to Filled
and just set the fill amount
it's much simpler
slider is a sort of ancient "hack" way to do it before we had filled images
Huh, the slider just kind of made more sense to me. I'll try a filled image.
Yeah I can see the utility in this now, thanks again for pointing out my issue Praetor
Yep, the main difference is that a Slider has a bunch of stuff you don't need for a health bar like... the whole handle and mask situation.
filled image is just, the minimum you actually need
Hi, hate to bother, but im having issue with the legacy button and I think this is the right channel? My button sprite has a hole in the middle of it, and because that the button only works when clicked above the hole
any tips to fix...?
Put that image as a separate sprite that's a child of the button.
Make the actual clickable button invisible, but using a sprite with the correct shape for what you want to be clickable
Ah, makes sense, thank you!!!
Hello gamers, I have a problem relating to UI and particles. If this question does not belong here please let me know where it should be.
I have a UI box with four children with Box Collider 2D components. And I am instantiating a particle system which I want to collide with these colliders so they bounce back. However, these particles only collide if they goto the left side of the box, not the right side. Alongside this, the particle bounces of in a incorrect location. Why does it do this?
He is a video demonstration
I have a UI box with four children with Box Collider 2D components
You've already got a big problem here. UI and BoxCollider2D don't even live in the same plane of existence
unless it's a world space UI
oh?
My suggestion is - don't build your game out of UI elements!
My canvas is set to Screen Space - Overlay
I get that, I just don't know another way of doing my combat system this way
If you want an effect like this where gameplay is happening inside a UI element, use a RenderTexture/RawImage to display a separate camera output in the UI
What do you mean? Have a render texture of the UI and do the colliders and particles ontop of it?
so i mean you do the colliders and particles in the game world
with a camera looking at them
render the output of that camera to a RenderTexture
and draw that RT in the UI with a RawImage component
Anyone familiar with localization package?
{0:c(0|1|2|3|4|5):Minions prepare a rebellion|Minions hate you|Minions are unhappy|Minions are neutral|Minions are loyal|Minions are happy}
Any idea whether I can swap out those inlined strings with LocalizedString?
Never seen anyone talking about the localisation package on this server. I'd suggest the best place to ask is the Unity forum Localisation section
why is it increasing at the top and bottom when i scale it, i only want it to increase upward
UI should keep it's scale at 1,1,1. Change the width/ height to make things the size you want them to be
The 'canvas scalar' component, which is on the same GameObject as the Canvas, set it to scale with screen size, and set the resolution to 1920x1080... then move the slider between width/height until it works for you. Might actually just want the slider at 0.5
Tried that isnβt working π¦
Anyone familiar with localization
What is the best way to change ui layout depending on the device i'm on? For example change the position of a ui element if i'm on mobile.
Use the device simulator , and set the canvas scalar to scale with screen size
Can device simulator change layout of ui? I though its literally just for testing
I say to use it because you're working with mobile..
it's obviously not going to change the UI...
What is the intended type to pass as reference if I need to pass some strings as argument?
For localization I mean
I need to pass dynamically multiple decision options that can vary
and this involves localized string in one way or another
how do i make this not increase up and down when i increase the height
i thought making the pivot point bottom left corner would but nope
i just want it to increase in height and the bottom of the purple block stays in the same spot
don't mess with the size
put an empty white image in the Source Image field, then you can set Image Type to Filled
fill type to vertical
and just play with the fill amount
mmm idk what any of that means
it will be clear as you follow along
@mortal robin it doesnt let me drag the image into the source image
what are you trying to drag in
ok where do i get just an image
here
that doesnt drag in either
make sure you set the image type to Sprite (2D and UI) in the import settings
@mortal robin how do i set its type to filled
image type
in the inspector
Is there a way how to Have two buttons over each other, and when you click you trigger both of them? aka raycast goes over both elements and triggers both click events. As normalyyoutrigger the one that is on top layer, but cant find way to disable it
Why not just have one button that does one thing, and another that does the two things
Then you show/hide the button you want to use
Reason is that I need overlay that will trigger function on pointer down event. This overlay is invisible and I want it not to interupt gameplay. Reason why i need it is: In webgl on iOS no sound can be running until user interacts with one click before that.
so i have this stamina ui that drains from right to left, basic stuff, but how can i make it so that when it drains, instead of right to left vice versa, it reaches 0 in the middle of the stamina ui
Press T so that you're using the UI tools.
And change the pivot on Y to be 0, so the blue circle is at the bottom
