#π²βui-ux
1 messages Β· Page 59 of 1
Why is this text hidden behind the image? Any possible solutions?
I went off from 2d to 3d to check the other side of the image, image is still hidden by the image.
Hello. I want to ask why my button UI cannot clicked although that was interactable? Wait I'll give a screenshoots
please help :((
Do you have an event system in your scene that I'm not seeing @zealous remnant
Ahh, I forgot to add that, because I'm just copying that canvas from another scene. Anyway thanks for correction
So each object has a Canvas attached to it for using it
Is this okay?
or is this a performance hog?
and what is recommended way to do this?
using multiple canvases is good, and should be done π
why is my slider not moving in the game?
Do you have code that sets the slider value in a script?
for example whats in the SetVolume method that you have hooked up?
yes but this is only one time and can't be the issue because I still can move it in the insprector without that a code would reset the value. it is a problem with the UI interaction somehow, I made a new slider and connected the scripts I have and everything works just fine, but why was it doing this troubles before?
I still can move it in the insprector without that a code
Doesn't this imply that the code is indeed the problem?
why you give my code the fault?
I said in the inspector like video position 0:16
I did'nt changed anything of tghe code but after I created a complete new UI slider and put my same scripts into it. the problem was gone
I made the sliders new but drag and drop the same scripts inside
@mortal robin
this video doesn't tell me anything tbh. Yes if you make a new slider in a new scene it will work. That proves that sliders work in general. I fault your code because this is a basic feature that is working in everyone else's game, so it's something to do with your code or your scene setup.
You have something in that original scene causing it not to work, probably your code. It might not be the OnvalueChanged code. Could be any script in your scene referencing that slider
I have not changed the code it is still running on the old code but is working now after I deleted the old sliders and made new ones...
Like I said it's not necessarily that exact code
Could be any script doing it. Now that you re-created the sliders you've broken whatever reference that other code had to your slider
but why is it working now without changing the code?
Now that you re-created the sliders you've broken whatever reference that other code had to your slider
Please does anyone know why my game over Ui, works on one level, but not in any other levels
Not without you explaining how it works and how all the objects and scripts are set up
the code dosent really control much, other than setting the each text labels, and also showing the game over ui when the player dies
but the problem is like as if the mouse never get detected on the other levels when i put it over the button
That most likely means you don't have an event system in the scene
wow, thank you so much, i didn't realize it was such a simple issue
why do classic Text even exists why even unity themselves claim that text mesh pro is better?
legacy compatibility.
They don't want to break projects that are using those components
Imagine you made a whole game with thousands of Text objects, and you go to update Unity and it's removed. Now your whole game is broken
Make sure the UI package is installed in package manager
how to fill border. i have alpha, but how do i apply it?
any reason why an image would show in game view but not in the build?
there's lots of possible reasons - is the display of the image controlled by a script?
the fist panel is active and there is a button that sets it's active to false but on opening the project I don't wee it in the build
I do see it when I play the scene though
Does dropdowns work horizontally? Never mind, they do.
is there a way to sync 2 sliders across different scenes?
for example, like an audio volume slider
That's not really a UI question per se
just a "how do I transfer data across scenes" question
I feel that a ScriptableObject for game settings, referenced from a Monobehaviour in both scenes, would be a good solution, backed by PlayerPrefs.
You might also look into a dedicated menu scene that is additively loaded and reused across both scenes
Hello. I have app with UI which is build into window form. I have problem with changing the size of the window. The UI changes and goes over the panels etc ... I used pivot but didn't help maybe I use bad pivots ... :/ Do you know how make it effective?
I have a couple of problems I need to solve
#1 I have set up a scrollview with a vertical scroll bar, the content, viewport, and scrollbar are linked to it, and have identical settings to another scrollview I have set up, yet (unlike the other one) this one won't scroll when I alter the position of the scrollbar in the editor. Is there a common mistake made when setting these up that I might have made? I'm not sure what else to do to solve it.
#2 I have a horizontal scrollview to hold an unpredictable number of items. I want the far right edge of its contents to fade to translucent to indicate there is more without simply being clipped by the edge of the screen or scrollview (which looks ugly). Presumably I need to do this with a mask of some kind with a semi-transparent gradient at the end of it. Scrollview's have one by default which would be great, except that I can't know the size of the scrollview in advance because it will need to adjust to the different screen widths of different devices - this would mean that the mask is stretched and the gradient would be stretched too. I'm also unsure if you can do a masking gradient (vs just a shape)? What structure of layout do I need to get that masking gradient working for this scrollview?
I can't drag textMeshPro into this prefab i can only drag it when the object is not a prefab how to fix that please
Assets cannot reference objects in scenes. You have to assign the value in code when you spawn it https://help.vertx.xyz/programming/variables/other-members/prefabs-referencing-components
If you're not spawning it, the reference can be applied to the in-scene instance as an override.
Hello! I have a specific issue when using LeanTween to animate UI. If anyone uses LeanTween, please help out!
In general, unless I use "ignoreTimeScale", my UI animations bug out and either stop completely or start looping in a random interval. For example, a blinking alpha that was supposed to go from 1 to 0 starts going from 0.780081237 to 0.709971. In other cases, the animation seems to not happen... That is, unless I have something else using the Update function in the scene, which is when the animation seems to work correctly. It feels to me like LeanTween is waiting for other things to update in order to update itself
Did anyone ever see this?
Hi. What is the best way to hide windows in window management?
Is it enough to set the canvas group alpha to 0? Or what components need to be disabled?
setting the alpha to 0 doesn't stop
- the transforms updating when something else moves
- interactions with the elements under that group
Toggle the gameobject with the canvas group on
I want to anchor some UI panels to physical anchor points in a 3d world, but I don't want them to overlap with eachother so I can't use a World Space canvas. So I guess I would have to manually place the panels through code, to display in a Camera Screen Space canvas, but does anyone have any advice on how to actually keep the panels separated but as close to their anchor positions as possible? Can I use 2D physics for this somehow?
Hey, I have a question about TMP, I have imported a monospace font yet the rendered text don't seem to handle the white spaces as equal width as all other characters, how do I fix this? This becomes a issue when multiple white spaces are added in succession
how do i only fill up border space? i have an alpha texture if needed.
Been there, done that, it totally ignore when white spaces comes in succession
anybody?
Have you tried using a mask component?
I can't tell you exactly where it needs to be in your case. But take a look at how it's set up on the default UI slider
aight
also, watching the official uninty tutorial on this, but it won't work for me since the image is grow on the y
and this looks weird
You don't want to scale it but change the fill amount
so to change the alpha progressively on y?
If you set the image type to filled, you get a slider
Hello guys, so I have one question. How can I like get a debug.log message when someone pressed the determined "cancel" button on UI? Because I set up a join menu and I want the player to reset his actions by simply pressing "b" on controller or any button. I dont really seem to find anything.. im kinda new to this. Thanks for any help. Im using this in the screenshot
assign a listener to the PlayerController/Back InputAction
Ok, so nesting canvases is really bad for performance because it requires rebatching all nested canvases when something changes, however, by not nesting canvases, each canvas needs its own graphic raycaster which is also really bad for performance.... is there a way to get around this? or Do you just have to find a balance between the number of canvases for rebatching vs raycasters?
do all these canvases have clickable buttons? you can remove the graphic raycaster if it's not needed
They all have buttons, they don't need to be clicked but they do have to detect when they are being highlighted(hovered over) by the cursor
you can try and group the interactable objects into their own canvases and only have a graphic raycaster on those
Is instantiating a graphic raycaster super expensive or something?
Pretty much all the objects are interactable, so I might have to rework something
i don't think it's super expensive but it's something to consider
@halcyon heron seems more like a UI thing, let's move here
Change the UI Scale mode to 'Constant Pixel Size'
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-CanvasScaler.html
Nice thanks π
Hmmm so I had it set to scale with screen size
Which seem to work well with UI elements, Although I need to use a sprite
image components use sprites
So that I can animate it (it's my character speaking in dialogue)
if you mean Sprite Renderer -> that's not UI
Sorry I'm a bit confused on terminology
this makes it clear
It's actually a PSD file*
like a pokemon dialogue box thing when you interect with something
Yeah something like that
I don't know about the animating bit of it, but to get the size of things so you know how big to scale the PSD canvas.. setting the CanvasScalar to a constant pixel size (eg: 1920x1080) putting an image that's 64x64 on there will always been 64x64
The problem is, I drop by like 15 FPS right now cos I exported it too large (from Illustrator, so vectorial)
you'll want your image sizes to be err... divisible by 2 IIRC
I'm trying to wrap my head around the problem so I can explain it thoroughly rather than bits by bits ^^
So right now, my player's scale (the whole PSD object) is scaled to 25 so that it's size is the one I want IG
I'm trying to reverse the process : get the current scale of the object, so that I can export a smaller version out of Illustrator
Is that clear?
Like right now, I can tell that dividing the size by 3 wouldn't change much the end result, cos the current image is way too high definition. I'd like to actually calculate that factor
@low pike Just @ ing you cos it took me times to work it out :p
this is the value in Unity?
Yup
sooooo.. what might work is
Create a second UI, and set the canvas scalar on that to a constant pixel size (eg: 1920x1080). Then drag the player from it's current canvas to be a child of this new canvas. The scale of it will change.. that should be the size you can use in other programs
I already have a canvas scaler set to scale with screen size (1920*1080) on the canvas I'm using
Holy crap did I really made it 25 times too large? Lmaooo
Difficult to say without being able to see it
It seems smaller than that, but then again I didnt use AA so this might be it
I'll give it a go, thanks for the help π
np π
25 times too large would explain a drop in 15 FPS tho xD
I appreciate that now in 2021.2, the non-TMP UI components are considered "legacy"!
It's definitely not 25 :p a rough measurement on paint tells me it should be 500 pixel in height, I just have no idea how to determine that number another way =/
You're looking at a RectTransform width/ height in Unity yeah?
scale should be 1,1,1 for UI always.. and then ^ that gives you the values you want
Anyone know how to implement occlusion culling on 2d Images ?
Or can give some tips? I have a bunch of Images off camera that are killing render times, but activating/deactivating the objects is super slow... is there perhaps some alternative that I don't know about (occlusion culling)?
off camera would be Frustum culling, not occlusion
Unity does Frustum culling by default for 3d objects, but IDK how it deals with UI
Yeah it definitely does not cull my 2D Image components... Is there a way to manually set this? I know when the objects need to be rendered and when they don't but enabling/disabling is incredibly slow
What if you use a canvas group and set alpha to 0? Does that help?
Or put that group of objects on its own canvas and disable the canvas (rather than the GameObject)
Both good ideas... unfortunately they will both require major changes to the architecture... The offscreen images are parented to onscreen images... so theres not an easy way to separate the two in the current state of the game. Yes I can separate them, but i'd like to avoid that if possible.
Basically each object represents a Die. The Die has a single face view (left) which will show the currently rolled face and a multiface view (right) where you can see all faces of the die and apply upgrades to them (each one is a button). The multi-face view is a child of the single face view, so when the dice are rolling, I don't need to see/render the multiface view, but since it is attached to the single face view which does need to be rendered I have a problem.
Unfortunately you may have to bite the bullet and restructure things if your current approach isn't working out
BTW I'm also making a dice game at the moment π
Nice!
In my game you can upgrade to the point of 10k dice, which is making performance a nightmare
I think i've got everything running just about as smooth as I can (with what little skills and understanding i have) except for the render times getting out of controll with all the multi-face views being rendered
with 10k dice thats 60k buttons lol
Yikes.. yeah that's not gonna work
Do you need to actually draw them all? How could a user even click on 60k buttons
Or read 10k of them
You can zoom in/out
When i run the game with all the offscreen images diabled, Camera.render runs in about 10ms, but when the images are active (even though they are offscreen), Camera.render runs about 30ms on the CPU
I don't think its GPU though... its the CPU thats capping
In computer graphics, level of detail (LOD) refers to the complexity of a 3D model representation. LOD can be decreased as the model moves away from the viewer or according to other metrics such as object importance, viewpoint-relative speed or position.
LOD techniques increase the efficiency of rendering by decreasing the workload on graphics p...
Or basically summarizations of areas as you zoom out
Instead of drawing each individual thing
Yeah, thats what i've been thinking... unfortunately i think thats over my head programming wise and over budget timewise for me
Yeh it's complicated
Like i said though... it doesn't even need to be drawn most of the time, but it still gets draw calls when its offscreen
I think i can set the layer of the child object (multiview) as different from the parent and then use the Camera's culling mask to not render that layer... As long as i can change the culling mask efficiently at runtime?
FFFFFFFFFF
Ok I ended up just reparenting the child object on instantiate to a new canvas group where I can set the alpha⦠Hacky but it seems to be working
I'm new to Unity and I'm trying to setup a start menu for my game, but when I hover over the button on the GUI, there is no visual difference. I've been stumped for over an hour, and thought it was time to ask the community. I've read an article (https://answers.unity.com/questions/1365672/buttons-will-not-change-color.html) on the Unity forum that was useless, and I don't know what else to do.
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.
does your button actually work? It's just the color changing that doesn't?
Or the whole thing doesn't work
I just tested it, it's only the colors.
Well
Your image color is clear. That's your main issue I think. It's working fine just your color is invisible.
The various "highlighted color" etc for the Button component get multiplied by your highlight colors etc
TLDR:
Change your Color on the Image component to 100% white with full alpha
Don't forget the alpha, because that's the most important part
can someone help me? im trying to figure out why my buttons arent staying within bounds of my scroll rect
you can do what you want in a few ways. the built in scroll view has a mask that masks out things outside of the area of the panel.
if you want to force all the buttons to squeeze into your panel, you can add a vertical layout group
thank you I am looking into this now
can someone help me figure out why my scrollbar is not working? I made sure I assigned it to the vertical scrollbar part of my scrollrect but it doesnt appear to be workin
There is no job posting on this server. #πβcode-of-conduct has links to the forums
k sorry
Is there a way to set up a button to repeatedly call a function while held down without a script? I thought a button + event trigger component would work, but I can only get it to register on click, not click + hold
Is there a way to dynamically divide the column equally from a container. The container transform is set to stretch stretch
How does one set TMP's (not UGUI) to be rendered within masks like sprites can (visible inside mask) instead of outside?
you know what
I'm kinda dumb
realized my mistake as I was describing it
baka brain
it be like that sometimes
you can use a layout group i'm not sure if you want a vertical or horizontal one from your question
Should I be scaling UI elements with Scale or should I be adjusting the width/height?
width/height
thanks, is there a specific reason why?
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.
ahh ok thanks
it's not a hard no no, but definitely recommended
yeah i did notice in one of my prototypes scaling sliders messes them up alot
if you're only scaling to like.. 1.1, and maintaining the aspect ratio, it's okay
i do it when I want the children to scale up with it, and I didn't set the anchoring for them properly XD
but only small amounts
I would also like to know if spacing out icons via code is the proper way to do it. I made a turn based battle system before and I spaced out icons via code i.e. x+10.
there are.. layout groups you can use. Allows it to be more dynamic
awesome, looking it up now
i wouldnt say proper or not. it's just whether you want to code it yourself, haha
one problem i thought of with spacing UI images through code is that I would have to adjust it based on the resolution that the user chooses
i dont want it to go off screen or look wierd
yeah, in that case, using one of the layout groups might make that easier
there's grid, horizontal, and vertical
take some time to tinker with them. They require some fiddling
yep it seems like this is what i was looking for
also helpful is the Layout Element component, for cases where you want the element in your layout group to have some unique setup
its great, it auto spaces everything out wayy less work.
great
Is it possible to use SVGs as images?
can someone help me? why doesnt the ui text appear in the scene but not in the game
anyone?
this hurts my brain
why
how do i open that ui editor
where i can see alignment
if it's on the center etc?
Don't crosspost please.
That only appears on objects with a RectTransform component as a child if a canvas. What are you selecting?
a panel
https://www.youtube.com/watch?v=Iv7A8TzreY4&list=PLPV2KyIb3jR5QFsefuO2RlAgWEz6EvVi6&index=10 3:30 ish
Let's make a way to reach new levels!
β Download the Project Files: http://devassets.com/assets/how-to-make-a-video-game/
β₯ Support my videos on Patreon: http://patreon.com/brackeys/
Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
This video is part of a mini-series on making your first game in Unity.
Β·Β·...
Show a screenshot of what you're selecting including the hierarchy in which it resides.
Right and the issue is what? The inspector would show the anchoring on the RectTransform.
and when i focus on it misses the grid
there's no grid
when i move the object example text i can not see text being aligned like how he can
You mean the scene grid? Turn it on by clicking the grid button at the top of the scene window. Though, it's not really that relevant for placing UI.
but be4 once when i was placing my ui
i had the grid and when i move a ui component
a line pops up if it's at the center for example
or on the far right
You mean snapping to other edges? Right now your panel is the full size of your canvas. If you were to drag an edge of that panel, it should highlight the edge of the canvas or say the text's bounds as you got near to align with it.
Not sure what it's calledtbh
yeah ima just quit this for a bit
Scroll content disappears after trying to scroll on Android, on different aspect ratio devices.
I have some scroll panels set up and in the apk build version they work great on newer devices like Huawei P30 Pro, Oneplus 8 Pro, Samsung S8 Plus, but the content of these scroll panels disappears (gets invisible) after trying to scroll on my older devices like an Asus Zenfone 4 or a Samsung Galaxy Note 10 2014. This app is forced to stay in portrait mode, and all the devices that had a problem with the scroll content disappearing were 16:9 aspect ratio. The other devices that had no problems had wider aspect ratios. What can I do to solve this problem?
Firstly, don't spam your questions around the discord. Use a single channel (left this one).
Secondly, you can change your aspect ratio in the game window to test on that, or use the device simulator package to see what the app looks like on specific devices.
My guess is that it's not anchored correctly and you positioned it with a larger aspect ratio set, so when it shrunk, the object simply stayed off screen.
You would have to confirm that's the case by changing your ratio in the game view and seeing what happens in editor with the object. Then if that's the case, you'll have to rework your UI with proper anchoring.
Thanks! Sorry for the spam.
I'm trying to give some text some highlight and it seems stupidly hacky with textmeshpro
anyone used mark tag before?
textmeshpro is so dogshit holy fuck
Is it possible to make an image that receives raycast events but does not block them? Like it would still get pointerdown/hover events, it just wouldn't block them from being sent to the image behind it.
You might be able to call Reset() on the PointerEventData: https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.EventSystems.AbstractEventData.html#UnityEngine_EventSystems_AbstractEventData_Reset
not 100% sure how that works
but worth a shot
how?
got a different text assets
what did you find from google?
Uhh the fact that my dumb ass cant use a spritesheet
You can use an animation on an Image component and change the sprite.
is there a good way of putting a button within a paragraph of text?
like something like a hyperlink in a paragraph on a website
textmeshpro has that feature
How do I convert from an anchored position vector to a screen space position vector?
i.e. If my canvas is 384x216, and the screen resolution was 1920x1080 at the time.
Then an anchored position of -192, -108 should be the bottom left, and when converted would be 0,0.
And 192, 108 is the upper right, so would convert to 1920x1080
How do you approach menus that aren't on one row/column? I'm working on a menu that's 2x3. My approach currently is to have two lists that contain the transforms for each column but I feel that it isnt very dynamic.
To add more info:
I plan to let the user use key button puts like ASDW to navigate rather than only the mouse
Use TextMeshPro instead.
but how d ou refrence it in a script
TextMeshProUGUI
k
do i need to add another using tag
Right Click on it and view suggestions
If your IDE is configured properly, it will tell you what you need
If not, go configure it, link is in #854851968446365696
ok
Hint, your problem is that you need to import the text mesh pro namespace
But i want you to learn to figure that out
ook
thats probly what it is cus it says that
Assets\scripts\dialougemanager.cs(9,9): error CS0246: The type or namespace name 'TextMeshProUGUI' could not be found (are you missing a using directive or an assembly reference?)
I know that it is that, haha. But i want you to learn to debug π
k
Do you see red underlines in your script
ye
Good. Means itβs configured
k
Right click the TextMeshProUGUI
k
do you see thereβs the first option like.. quick actions bla bla
Click that, look at the suggestions
There should be one that tells you what namespace to add
it says no quick fixes avalible
Take a screenshot of your whole IDE please
Spell it properly and try again
@weak dew Have you looked at Grid Layout Group?
yep it lays them out for me but it doesn't help with the actual gameplay part
If you're using Unity's buttons and other UI, you should able to navigate them automatically with gamepad. Keyboard input would depend upon how your inputs are handled
@sterile wedge
hmm you mean like the gamepad is raycasting?
@weak dew Nope. Unity builds a navigation graph for its own selectable controls, and if you don't disable it somehow, it will know what's to the left of your button if you push left, and then select it for you
oh wow i should look into that then
Im also using the new input system
It will still work with the new input system
As a trial run, just place a bunch of buttons down in a canvas and see what happens when you move the gamepad
If you can't use unity's controls, then you'd need a script to manage a group of controls in a grid layout group
The script would wait a frame, to ensure the layout group had moved everything, and then go through its children to find the controls and where they're placed, and make a 2d array of them
Then that group needs to listen for input, and move the selection accordingly, or click the control, depending on the input
If controls get added/removed, it needs to wait a frame and then refresh the 2d array
thanks, ill give that a try im glad to know its possible
I have that issue with certain images, if thats an image make sure to check preserve aspect ratio
Use TextMeshPro
Hello guys, can anyone help with following problem: https://forum.unity.com/threads/dynamicly-loading-text-and-scrollbar.1207522/ ?
@rapid ferry #π»βunity-talk message
It's going to depend on what lanauge and what's included. Mine are <1MB, but it's just normal ASCII
My UI renders in Scene but not in Game View. Any idea ?
Lol, it had to do with the position
z was -1000
Canvas scaler
no i wanna change the text size it self not the scale
Then write a script I guess. Canvas scaler is the built in way to do it.
Hey how can I make a auto scroll cards ui like this?
https://youtu.be/Phz882tKBh8
Featuring JioSaavn
Immerse yourself in the magic of JioGlass and sing along with your favourite artists. Play any song, album or playlist on demand while enjoying a one-of-a-kind spatial audio experience. πΈπ·
JioSaavn allows you to listen and interact with more than 10 million tracks of the world's largest music collection, with a 3D visual ca...
How are login screens and character creation workflows generally? Iβm super new to unity, right now I just disable the canvas for login and afterwards enable the another canvas for character creation and so on.
I feel like I'm missing something that shows this code occurring on the UI.
if (hit.collider.gameObject.tag == "Enemy")
{
for (int i = 0; i < reticleGraphics.Length; i++)
{
reticleGraphics[i].color = Color.Lerp(reticleHiddenColor, reticleColor, reticleFadeTime);
reticleGraphics[i].fillAmount = Mathf.Lerp(reticleFill / 2, reticleFill, reticleFadeTime);
}
}
@topaz flume Bunch of ways you can do it.
Turning on/off canvases
Turning on/off canvas groups
Turning on/off image panels in one main canvas
@serene sparrow I figured it all out! New question, is there a way to add effects to images such as blur?
That I don't know, been mostly doing retro pixel perfect UI without transparencies
there is this
https://github.com/mob-sakai/UIEffect
Hey pls help me on this
has anybody here tried the Vector Graphics package?
im thinking of using SVG files with my UI, but im not sure if I should use a package still in preview so im looking for some feedback
Yes I've used it. It's fine as far as the basic features go.
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.
Can anyone help me with this?
Can anyone tell me why a UI button/toggle wont click or highlight on hover?
my canvas has graphic raycaster on, my buttons are interactable and all on
i set up the same thing in a new project and it works fine, but in my existing project it acts like my mouse cant reach the canvas
Do you have eventsystem in your scene
hi i have a problem... I did a Canvas and made a game with this canvas. The problem is that until now the canvas was scaled on a constant pixel size, and now that i try it using Scale with screen size... well i have a really really bad surprise so if someone can help me to scale this thing it would be greatly appreciated
also how to know the scale of the free aspect?
yeah i figured it out, the input system on the event system somehow got removed, just had to re add that
Is there a way to keep a UI element constant even in world space? Alternatively, is it possible to position a UI element NOT using world space to where an object is ( i doubt this one)? I have an HP bar using world space but the scale is inconsistent because certain targets are farther away
https://gyazo.com/db86dfeeefeea3cebee68ac731254ea4 why is my button not unhighlighting when I disable its canvas?
I have tried that but it still doesnt seem to work.
i fixed it. Just forgot to animate the normal animation
So my world space ui that is behind gameobjects cant register clicks. Ive two cameras, one for UI and for everything else, everything is set to correct layes, what could be the problem?
EDIT: the ui that is above gameobjects works totally fine
i am trying to spawn prefabs into ui set to camera mode with a screen scaler set to expand, however whenever i spawn it at a different resolution they spawn weirdly, what should i try to do to fix this?
Is there a good way of scaling a mobile UI?
Canvas scaler with a 1080 x 1920 reference cnavas doesnt scale nicely
bits of the screen get cut off instead of scaling smoothly with the screen
wait nevermind
okay, I tried the scaler and it looks great in. editor mode, but its completely different in play mode and nothing is interactable
it was working. before hand
ah
hidden overrides
I got this issue and the fix for me was setting the targeted frame rate to 90 or 60, setting the max to a high number caused the scroll rects to have NAN errors when going in a negative direction
Guys I'm ripping my hair out trying to figure out why my OnPointerEnterHandler and OnPointerExitHandler events aren't firing
The related canvas&canvasgroup aren't being obstructed by anything and are drawn last (bottom element in canvas child hierarchy)
There is an eventsystem in the scene too, some other UI logic that I implemented works perfectly
Graphic raycaster on the canvas object?
@sterile wedge tried that too.
Feels pretty cursed, I made a complete empty project with just my script and the basic UI elements and it does not seem to trigger OnPointerEnter or Exit events
blocks raycasts also does not block raycasts, contrary to what you would think it does
Another one of those 'oh unity' moments
Layers?
nope
good guess though
Unity UI is just such a joy to work with
my god I can't believe I'm doing this on my own time lmao
@obtuse pasture with issues like these the best way to find out what's happening is selecting the EventSystem to see its values
Thank you so much! That was the issue and now it's fixed. π
Hey, random thought and this might not lead anywhere, but have you tried also implementing OnSelect or one of the similar interfaces? I don't recall exactly, but I remember there used to be some "unreliable" behaviour when some but not all of those where implemented.
I was searching through my project, because I was sure I had exactly what you describe @oblique sun. A Pointer transition class that also needed to have OnSelect or OnClick implemented in order for it to work. But I couldn't find the class and was starting to think I'd imagined it.
Yeah, see, exact same situation. Almost everywhere I have OnPointerX, I also have OnSelect. I'm pretty certain that's also because of some "gotcha" in the past.
But now I can't find evidence of it anymore either.
Found mine
public void OnPointerDown(PointerEventData eventData)
{
// Do nothing. Just need it so this component gets marked as the interacted object
}
But I'm only using PointerUp and Down handlers in that class, and Scroll and DragHandlers in its parent class.
I've actually asked colleagues because it's bothering me now. XD
So my friend is having an issue where every time she plays her game the buttons on the UI disappear, any thoughts on why?
I have an image that has some parts of it transparent, but when I add it to unity those transparent part get filled with color. What should I do?
How can I make the text appear in front of the dropdown UI?
On a UI image @empty juniper? Is the texture set to sprite mode?
Have the text further down than the dropdown in the hierarchy
if you mean the texture type then yes
Can you show a screenshot
Can you share the texture file?
Turn the BG into a "panel" instead
Have you changed any of the parameters under Advanced @empty juniper?
You have the alpha set to none
thanks
Hey I have a black, very transparent UI button. When I hover over it, I want the highlight color to be black but with less transparency. But somehow this doesnβt work. It only works if the image color is white or a gray :/
Because you're multiplying a colour against black, which is going to be black.
Instead change the source colour to white, and change the normal colour of the button to black+transparent.
ahh it worked! Thank you
i have a scene which is the gameplay scene and when the player dies a gameover ui screen pops out (its still in the same scene) but when i hit retry button(which reloads the gameplay scene) the player model becomes black
here its normal
here after i hit retry and reload the gameplay scene
also when i press play from the main menu same problem is happening
Hey guys, I am working on subtitles, and was wondering if there was any way to bring the text down according to the number of letters? So for example, only one line would be like 100 up, but if the subtitles have 2 lines, it would be 200 up
and vice versa. Please ping me if you have an answer. Thanks
why dont I get a box around the text mesh pro child on my canvas, I can't see its rect
are Gizmos enabled in your scene editor?
What is the cause of the grainy distortion of the text? Im using world space and I made sure eveyrthing is scaled to 1
Are you using TextMeshPro?
i am
What size did you make the canvas
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.
100x100
thank you i'll check it out
Creating ui is hard
Is it possible to set a max width on something? The tags are dynamic, if something ends up with more tags than the width of the screen, it goes off screen (I put it on two lines manually for this gif)
sooo that red square is my background and i want to put a button on it but when i try the canvas and button are both massive compared to it
how can i fit it with the red square
Are there any fonts like this for textmesh pro ?
Ui elements need to be children of a canvas
you can use any font you want with TextMeshPro
it is because when i create a button it automatically puts it in a canvas the thing is the canvas itself is massive and doesnt even let me change its size
How do I only show one image in front of another? I don't want the image to be displayed at all if it isn't behind another image
The canvas is supposed to represent the screen so of course you can't change it's size, make a object that's a child of the canvas and then child the button to that object, should be able to resize it
okay i will try it later today .Thanks alot
How do i mask the 3d models i have placed on the scroll view?
I googled it and saw a few non-useful answers on unity forum,stack,etc.
this is my unmasked complete scroll view content
This is the masked or partially required one.
You can see the apple and mango are not masked but their buttons are. How do I mask both of em>
hi
I changed the platform to andriod in my unity project. Now I put an joystick in the game on the canvas. Is it normal, that i cant click it now with my mouse?
Canvas renderer
@mortal robin who they?
I guess u r talking abt the apple and the mango. They are just 3d objects
If they're 3D objects they are not using Canvas Renderer
they are using MeshRenderer
which cannot be masked with UI or sprite mask
So what do i do?
find another way to mask them
you will need a custom shader if you want to partially mask them
Yeah that's what I'm askingππ
this isn't a UI question, it's a #archived-shaders question
I tried but i got a not supported issue
?
It was some problem with tags
Geometry tag
Maybe my gls version is not supported with that type of tag
I have no idea what that means, but seems like a #archived-shaders issue
how can I get rid of this? UI is very big
This is normal and expected behaviour for UI which is set to be in screen space. The white box represents your screen edges.
If you want UI to be a world object in your scene, then change the canvas to be in World Space.
Also can hide UI display in Layers
Nono, I know, I mean, it's kinda hard to work like this. Is there a way to make it smaller in the editor?
It's not related to the world space. Displayed separately.
how do i make a button with round corners? i've read i have to slice a rounded button but for me that isn't working, it stays too rounded
Higher resolution and smaller corner sections.
i am using an image from a tutorial, the guy has a rounded button but not too rounded i am using the exact same image as him but the result is completely different https://youtu.be/cW-E4WEogzE?t=283
just look how mine looks
higher pixel per unit also does this (sharper corners)
you don't have side slices
It's a 9 slice not 4 slice
i dont? i put everything 40 just like in tutorial
the guy also has 4 slice
oh
the higher pixel works indeed, thanks
I'm trying to show/hide an UI element by serializing the GameObject and using SetActive(). However I think it's not working because the GameObject is a prefab and it's not referencing the actual GameObject in the scene, is this what's happening? Should I not use a prefab for UI elements? I don't instantiate them where I'm using SetActive().
Just asking here before I make any changes because it doesn't feel right to instantiate a UI element (a menu window, to be more precise.)
I'm trying to make a UI, but whenever i set my Ui's opacity to 0% it shows as 0% in the editor, but in the gameplay mode it has some level of opacity. Does anyone know what I could be doing wrong?
info on UI:
uses the outline component (yes that is set to 0% too)
is a button, and has default button settings/colors with opacity set to 0%
darker img is in gameplay mode
lighter img is in editor mode
Set active on a prefab father than an instance in the scene is not going to affect the scene, no. If you want the UI element to show up in your game you need to Instantiate it.
I want to have a different Sorting Order for my UI Elements. I know it would work if i change the Hierachy, but i feel this is a bad way of sorting it in the End. Anybody knows how to properly set this up?
how can i make a tmp button not be able to be selected
i dont want to have there be leftover tint when i click I just want to click it, the tint shows, and dissapears.
Don't use a button component
Use a regular Image component plus an Event Trigger component
and set a listener for the pointer click event
Or just set the selected color of the button to be the same as the "default" or normal color
is there a setting in unity to set a certain font as the default? it would be nice to have it automatically set the correct font in the ui elements
If you use text mesh pro then yes
I'm testing my game in free aspect and I noticed that some window resolutions produce these kind of lines.
I'm using cinemachine and pixel perfect component. I would like to know if there is a way to pinpoint which resolutions might cause this and perhaps have a method that finds all these resolutions so I can skip them with a custom method I have for when the game window gets resized.
Edit: for reference this screenshot had a game window resolution of W: 1840 H: 508
I usually change the 'Navigation' mode to Automatic to reset the color tints
so... wierd issue that has been plaguing me for several hours - am generating a menu at runtime - image and tmp as part of prefab, generating a button on init. Everything is fine when playing in the editor, but after building the images do not show. The tmp text is updated and the buttons still function though! any ideas?
Help, I don't know what I'm missing. I'm trying to place an animated sprite in the UI as an image and it won't budge no matter what I do. Hope the screenshot works.
Hi, I have a score and timer in the top left/right of the screen but sprites are appearing in front of it
Even though the text is on a higher (the ui) layer AND has a higher z position??????
Nevermind, found a fix
How would I go about snapping a panel to the top of a scrollrect?
im trying to create multiple new panels for each inventory item instance, but im just trying to get them to dock to the top of the panel
I want to have a different Sorting Order for my UI Elements. I know it would work if i change the Hierachy, but i feel this is a bad way of sorting it in the End. Anybody knows how to properly set this up?
Add the UI Elements to a dictionary (thus sorting them in whatever order you would like) and instantiate them in code?
Thanks i will try that. Where can i find the dictionary?
It's a collection, like a List, but you add elements as a key : value pair so you could add a {0, UIElement} {1, UIElement} etc.
Does anyone know how to fix your custom cursor being all blurry?
question.. when i adjust my resolution the UI elements should change their size.. but they dont unless i close and reopen the game... what can I do to change the scale of all UI elements when i change the resolution WITHOUT closing the game
i have done that already but on the built application it didn't work
can you show what it looks like and what you want it to look like?
sure**
π it is not working perfectly....
sorry
no
What do you guys think of this?
Here is a little context: https://medium.com/@caraveo/i-was-thinking-about-passwords-xd-b850cb5ba5b7
Hi guys, I am making ui for mobile and checked on my mobile and it's looking good but phone screen size is 6 inch and concerned how it will look on smaller devices.
Whether the button will become too small to tap or text become to small to read.
Any tip ?
I don't have a mobile with small screen
π
is there a maximum character limit for TextMeshPro Text . i noticed that it would start to cut off around 99,910 Characters. However, the scrollrect still expands beyond that based on what should be shown if the characters were there. Is this a limitation of the UI component or of the string itself?
where can i find free realistic item icons?
Is there a way to underline a portion of text in a TextMeshProUGUI? It seems to me that you can only underline all the text or none of it...
Anyone know why my UI is still changing size when i have it set to constant pixel size??
Look up TextMeshPro rich text tags
Constant pixel size means it will look relatively smaller on a higher dpi screen
Nvm i think i figured it out. Thanks!
Yes it does, this is the same for every type of graphic too I'm pretty sure?
Anyone know what would cause TextMeshPro text to have issues with rendering in game view (possible multiple transparency layer issue?)
Looks totally fine in Scene view , but then terrible in game/builds
adding more font padding in the font can help if the text is in displayed in a very small resolution.
yes i tried this, but it was actually being Perspective Filter being set to 0 as the fix.
ah nice
its an obscure setting under the "Debug Settings" below Outline/Lighting/Glow on a textmesh component (and probably somewhere on the font atlas too)
thanks for ur help
thanks for sharing what did fix it for you π
Hi, I didn't know exactly where to ask but I can't seem to figure this out. I have some ui (and I'm not used to working with ui in unity) that I'd like to have the two keep the same height relative to each other (like two panels in a box in some other ui systems). I just have no idea how to accomplish this and nothing I try works.
Hey, im creating a scrollview/viewport/content layout. For some reason the content is not aligned to the center
In Content object, my ChildAlignment is center, and i have no uneven padding for content, viewport, or scrollview
Pivot is centered too..
OKAY. It was infact padding, under grid layout group, there was an option to extend a view to see padding, there i apparently had some π
So I still have this problem:
I have a video, that plays when the game is loaded.
It's render mode is set to camera far plane
But it also seems to take time to load, so the screen is transparent for a while, and then the video is loaded. Is there a way to add the video loading time to the scene loading time so you can't see a empty scene for a while?
The video is gotten from a web server at the moment
The delay is likely because the video needs to be buffered. So a solution could be, to call the VideoPlayer.Prepare() method, and only switch to the scene once it is prepared. But since this is the first scene that is being loaded once the game is started, this wouldn't work.
Question one: Maybe it is possible to add the loading time to the game loading time at the beginning?
If that is not possible, there could be another way, by making a loading screen scene and starting in that scene, until the video is prepared.
Question two: Is it possible to prepare a video from another scene?
Another solution would be to just put an image of the first frame of the video on the canvas, but that doesn't seem to work for two reasons:
- The video plays behind the image, so it can't be seen.
Question three: How do I fix this? - The image scales differently on different aspect ratios then the video for some reason. The video player scaling is set to 'Fit Outside'. It is described as:
Scale the source to fit the destination rectangle without leaving black areas on the left and right or above and below, cropping as required. The source aspect ratio is preserved.
Question four: is there a way to replicate that scaling behavior on a UI plane?
what are the settings on your canvas?
why is it under the player?
Is there any way to force an inputfield to stop being focused?
EventSystem.current.SetSelectedGameObject(null)
Why is this a thing? π
Does anyone know if there is a way to trigger a button's Click event on an input action? For example, press A on a gamepad and have the button appear to have been pressed. I can invoke the OnClick event easy enough, but the button art doesn't respond as normal
how do I get rid of this annoying "T" with textmeshpro?
thank ya
I have a UI system that works off of .SetActive statements, and my main UI constantly updates every frame, however when it is set inactive and then back to active again, the text doesnt update and goes to default
these are the only lines of code responsible for working with these two UIs
Is there a way to dynamically change the position of a left or right aligned TextMeshPro text to place it where it would be if it was center aligned?
i have a weird issue where my SetText functions doesn't work anymore. It worked before but something broke and now none of my texts will work
and yes there are functions refrences to the text. i have a feeling when i fiddled around by the canvases (duplicating and changing the sort order on them that it somehow caused them to break)
Can you show what you mean about the outline?
okay this is weird, so i have 2 canvases, one of them prohibits the second one from setting text
wtf
Gonna be really hard to say without seeing your code/scene setup
these are my three canvases that I use. Bavkground/Foreground objects are just blank images while Message/Text are TextMeshPro components
there's a lot to show though so im starting with this
i can post some code though hang on
Try making your canvas pixel perfect
and also check the alpha of everything - could be a transparency thing?
should i drop the code here?
This is applied to the ReadCanvas object
[SerializeField] private float fadeSpeed;
private TextMeshProUGUI readableText;
private PLR_ReadText plrreadtext;
// Start is called before the first frame update
void Start()
{
readableText = GetComponentInChildren<TextMeshProUGUI>();
plrreadtext = FindObjectOfType<PLR_ReadText>();
}
// Update is called once per frame
void Update()
{
TextToDisplay(plrreadtext.textToDisplay);
}
private void TextToDisplay(string text)
{
Debug.Log(text);
if(plrreadtext.isReading)
{
Debug.Log("ok");
readableText.SetText(text);
readableText.alpha = Mathf.Lerp(readableText.alpha, 1, fadeSpeed);
}
else if(!plrreadtext.isReading)
{
Debug.Log("no");
readableText.alpha = Mathf.Lerp(readableText.alpha, 0, fadeSpeed);
}
}
The code for DeathCanvas is much much longer though so I can't really share it here, although that one works as intended. ReadCanvas is what is breaking everything. If i disable it, everything goes back to normal
@mortal robin good enough?
What is PLR_ReadText?
oh yea hold on
And what object(s) is it on?
Since you're using FindObjectOfType that seems a little sus
[SerializeField] private float viewingRange;
[SerializeField] private LayerMask layerMask;
private Camera playerCam;
[HideInInspector] public bool isReading;
[HideInInspector] public string textToDisplay;
private void Start()
{
playerCam = Camera.main;
}
private void Update()
{
ReadText();
}
private void ReadText()
{
Ray playerAim = playerCam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
RaycastHit hit;
if (Physics.Raycast(playerAim, out hit, viewingRange, ~layerMask))
{
Debug.DrawRay(Camera.main.transform.position, Camera.main.transform.forward * viewingRange, Color.yellow);
OBJ_DisplayText objdisplaytext = hit.collider.gameObject.GetComponent<OBJ_DisplayText>();
if (objdisplaytext != null)
{
textToDisplay = objdisplaytext.textToRead;
isReading = true;
}
else
{
isReading = false;
}
}
}```
PLR_ReadText is on the player and there is only one player
@mortal robin well then i fixed it
had to switch the position between death and read (previously, read was above death. now its the opposite)
how and why does that work, i have no idea. my assumption is that one of them layers on top of the other and blocks it
TextMeshProUGUI
and to update it, i usually do
String
TextToDisplay.SetText($"String");
Variable
TextToDisplay.SetText($"{Var}");
String & Variable
TextToDisplay.SetText($"String & {Var}");
i have a problem with my scroll view, i dint move either tough are enough items, so it shold move when i scroll but it dont, any help please?!
how r u controlling your ui? is there some kinda controllers or you using some frameworks?
You may need to add a content fitter and vertical layout group components to your content object
Okay ππΌ
Hello, I started making a UI for a game, However I ran into a Problem with my Horizontal LayoutGroup and Content Size Fitter. The problem I am encountering is when I enable the Content size Fitter inside the GreyBox_1 and set it to preferred, It sets the Width of the Box to 0. I can change the Text Box Perfectly fine and it resizes itself depending how long the text is. I just need to the GreyBox_1 to follow the text. Any ideas, please ping me
https://cdn.discordapp.com/attachments/497872424281440267/924128185145258034/unknown.png
https://cdn.discordapp.com/attachments/497872424281440267/924128185367547934/unknown.png
https://cdn.discordapp.com/attachments/497872424281440267/924128185564676106/unknown.png
https://cdn.discordapp.com/attachments/497872424281440267/924128185795346452/unknown.png
I'm using textmeshpro for outlines within unity text, but it is applying to every single textmeshpro text as opposed to select ones. Is there an option I am missing?
Ah for future ppl who might be searching this, you need to change the material to a different one.
Hello guys, I am new to unity, and I was working with Text mesh pro but the text isnt rendring in game mode and now i am stuck, need help.
Show what you tried
Hello, how can i rotate image here so spikes are pointing to the middle of Particle system?
They were supposed to point to the middle
Sorry if this is in the wrong channel, but every time I start a game in the editor, my font goes black.
If I delete and insert it again into the assets folder, it regains its colour.
@rapid ferry You can execute events directly on the event handler. GameObject will be the button and event will be for example PointerClickHandler
idk if im in the wrong channel, but i have this problem when i select the text thats in the canvas, the canvas goes invisible. is that normal? because it wasnt like that before
So apparently, my game's UI is differently sized depending on the screen resolution
(as I saw in the Game tab of the editor, it looks bigger on low res and smaller on high res),
what's the "fix"?
I anchored the UI parts to the borders but only position-wise
Check out the canvas scaler
"Constant Physical Size" mode might be what you want, or "Scale with Screen Size"
Hello, how to make particles to be seen in ui?
I made a particle system in canvas but its not showing in game as a ui part, how can i change it
You can't generally. My "standard" workaround would be to use a Screen Space - Camera canvas with a Plane Distance of n and put the particles between the canvas plane and the camera
So is it possible to make some particles visible if i sprint?
You said that i cant
You can't draw particles on the UI
Unity's particle system is a world space thing
but you can draw particles in front of the UI, using the workaround I described above
hm, okay
Update: worked all fine, thanks further!
Hello! I watched this tutorial (https://www.youtube.com/watch?v=8yzpjkoE0YA) and I was wondering a few things:
- Can I do this in run-time above my characterβs model?
- Can I display a different game object every few seconds with script?
- Can I have multiple characters on the screen and display a different item like this for each character (above their head)?
Ever wondered how to add a 3D object to your Unity canvas? This is great for screens like weapon select, inventories, skins, etc.
I see this question asked a lot so figured I'd make a quick tutorial on the matter.
If you enjoy my content, you can support me via Patreon: https://www.patreon.com/tarodev
Alternatively, you could use my affiliate ...
Anyone see the problem why when I start my UI, It puts all my Felone_1 _2 and so on all on top of another? Once I click in the Hierachry on one of the Felonie it puts them back in order?
I've been trying to figure out the problem for a while and cannot find it at all
(don't miss these guys' questions above, everyone deserves support! ^^')
So I have another issue with my UI.
I'm following tutorials from YouTube and I've made a health bar (made of a border and a filling).
The filling is connected to a variable and is meant to use a color gradient system, but the filling has a default color that it just sticks to instead of changing depending on the color gradient.
What can I do to make it functional (hopefully the attachments help you understand the issue better, and that I made myself clear)?
What value is slider.normalizedValue
slider.normalizedValue, according to the tutorial, normally corresponds to the Slider's value "normalized" so it's a value between 0 and 1 (to read the gradient)
Your gradient runs 0-6
The gradient is meant to go from 0 to 1
that's how it works in Unity if I'm not mistaken
By this, I meant that
for example
2 out of 6 is 0.33
which is in the interval [0,1]
(basically between 0 and 1)
so it should be alright
what happens if you were to print out some direct numbers of the gradient
Do like, 0.1f, up to 3.0, with a few intervals
Print out/log gradient.Evaluate(0.1f) and others
You mean, if I try to get values for specific points of the gradient?
eeeeeeeh
i dont do the scripting on our unity projects but i wanna say Debug.Log()
Think I've seen that recently today
I'm forced to go to bed so I won't be able to directly make tests now, gonna wait till tmr (8~9hrs)
will still be checking this channel for a bit
probably your content size fitter
is making it height of 0
I legit have 0 clue....
I've tried remkaing it from scratch a few times
Just the same thing happens
At 1 time, I got it to set the position correctly. However the The other Felonies didnt move down when the other text boxes got bigger
This is an issue when you child content size fitters inside other ones.
So I shouldnt have one in each of the Texts?
A hack is to try Canvas.ForceUpdateCanvases(); or LayoutRebuilder.ForceRebuildLayoutImmediate(...); to try to get it to refresh at runtime.
Well, Im just making a UI for the game. Sadly the game that it is for dosent allow scripts to be used.
Its eaither I get it so when I update the Description and make it longer, The Background follows it correctly and then when I click play on it, It makes them all go to 1 area. Or I get it to stay in the correct spots however when I try to update the Description to make the box bigger. it dosent push the other boxes down.
I just dont understand at all...
It acts like the Spacing does not exists at all....
Well. I watched a few other videos on Verticle Layout Group trying to fix it. Still nothing. I am getting that same problem.
So Far I spent 3 hours and no progress on this issue yet. If anyone got any idea. Please.... Please ping me... I need this to work
How is this possible?
Custom scripts would be the only possible way IMO to fix things like this
Also, is there a way to automatically find all used images in a folder and add them to a sprite atlas? - I have hundreds of images in a folder but only ~100 are used, want to automatically get all the used ones into a sprite atlas to save on batching
I imagine the "Find references" method is accessible to scripting, so yes. #βοΈβeditor-extensions can probably help with specifics.
Well. I turned on Height on controlled child size and it seemed like it fixed it.
Hoping to revisit this question as it's a bit time sensitive -- Is there a way to dynamically change the position of a left or right aligned TextMeshPro text to place it where it would be if it was center aligned?
i.e.
The quick brown fox jumps
over the lazy dog
vs.
The quick brown fox jumps
over the lazy dog
How do I prevent the camera from becoming bigger in the exported project? This is the camera in the game view as it should be:
And this is the exported camera view:
Or is it mandatory in order to look good?
it's because you have a different aspect ratio
A couple ways around this:
- Show black bars (letterboxing) on the outside
- Force the game to run in a certain aspect ratio
The third option is:
- Stretch everything to fit
but that'll be ugly
Ok thanks
hello guys, I would like to make a toggle (with a check mark) which plays music, when it is on, but when it is off, it doesn't play music, could someone help me please? Thank you
im not sure if this is the right channel to ask but it's part of my UI so i figure ill put it here. i have these images to represent units in my game in a shop. the one on the right i like, its higher quality than the rest and came with that asset i bought. but i dont really know how to go about creating higher quality images for the other units. any suggestions?
i think you could make a new scene with the models you want to have in the images and create a background behind them, (like the one on the right for example) and then take a picture from the angle you like and use it
Talking about the quality of the photo you could use shaders or post processing, or play with point lights, or directional light, or spotlights
ill give it a whirl, thanks
your welcome
Do sprite atlas work automatically or I have to assign sprites manually using script ?
Update: found why it was not working, it's possible you couldn't guess it anyway (I somehow missed a small yet important section of the tutorial) Β―_(γ)_/Β―
Are buttons on worldspace canvases clickable?
yo guys, what is the best mode to set UI Scale Mode in canvas to support different display?
Hello, I am using Vertical layout group and want to spawn knive images. it is spawned from up to bottom but I want it reverse.
this is what I mean
I want it to go upwards when adding
How do I remove this error when using a Unicode character (specifically, the leftward arrow ( \u2190 | β )) when using it with TMP?
Error:
UnityEngine.Material:GetFloat(String)
TMPro.TMP_SubMeshUI:ON_MATERIAL_PROPERTY_CHANGED(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.6/Scripts/Runtime/TMP_SubMeshUI.cs:360)
TMPro.FastAction`2:Call(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.6/Scripts/Runtime/FastAction.cs:109)
TMPro.TMPro_EventManager:ON_MATERIAL_PROPERTY_CHANGED(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.6/Scripts/Runtime/TMPro_EventManager.cs:41)
TMPro.EditorUtilities.TMP_BaseShaderGUI:PrepareGUI() (at Library/PackageCache/com.unity.textmeshpro@2.1.6/Scripts/Editor/TMP_BaseShaderGUI.cs:144)
TMPro.EditorUtilities.TMP_BaseShaderGUI:OnGUI(MaterialEditor, MaterialProperty[]) (at Library/PackageCache/com.unity.textmeshpro@2.1.6/Scripts/Editor/TMP_BaseShaderGUI.cs:158)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
Do I have to regenerate the font?
I have an issue where my canvas wont recognise my buttons at all. it wont even change colors when im hovering over the button. this is how it looks like on the hierarchy
this is what i have on the button atm
hmm it doesnt recognise my cursor at all
Do you have an event system in the scene
i had one, but it was outside the UI prefab, although now i moved it in and it still won't work
but the answer is yes
Does it have an Input Module on it?
Input System UI Input Module?
Yes
then yes
Can you show a screenshot of the input module inspector
'
yes
also should the input module use my own action map or should i leave it to default?
Leave default
Ok last thing probably is just that some other UI is blocking your button
Or you have a canvas group that's set to not Interactable or something
Try disabling all your other UI elements
Until it works
And you'll find out what's blocking it that way
well disabling my other canvases did make it work
but should i add a canvas group to all of them and set to interactable?
I don't think I understand your setup enough to make a recommendation
But you know what your problem is now so you should be able to figure out a way around it
yeah true
but thanks a lot now!
nvm found the issue
the variable Sort Order on the Canvas component. Had to pump it up and make it above the other canvases
I want to have a TextMeshPro objects resize themselves based on their preffered width. I want them to be inside a HorizontalLayoutGroup so their positions get updated accordingly. I tried to use a ContentSizeFitter on them but it conflicts with the HorizontalLayoutGroup. Any way to acheive this?
why my slider value switching script isnt working ?
I call its method to modify the slider.value and slider.maxValue to my object health and max health points, but its value doesnt change.
I tried switching parameters to floats instead of integers, doesnt change anything
It'd be helpful if you showed your code and explained what kind of behavior you're expecting and what you're seeing instead.
I ended up making it to work
public void Quality(int qualityIndex)
{
QualitySettings.SetQualityLevel(qualityIndex);
}
i'm using this to change graphics quality with a dropdown menu (brakeys tutorial) with on value changed set to Quality
however when i change the drop down the quality level stays the same
this is the dropdown
Am I correct in assuming that a Graphic Raycaster component is only required when you want to player to be able to interact with the UI directly?
Directly as opposed to?
It's required when you want the player to be able to interact with the UI via a pointer
Hello anyone using AR UI/UX with Android? Having some issue
Hi, I'm guessing it's a common issue where using the standard way of navigating a menu using keyboard breaks once you click off or use the mouse or whatever. Is there a reliable fix for this that prevents the keyboard navigation from not selecting anything?
Disable deselect on click in your input module
is there any really good tutorials on UI? Id rather not end up learning outdated ways if possible
i can help you with main menu i found a good one here it is https://www.youtube.com/watch?v=Cq_Nnw_LwnI
Ever wanted to make your own main menu in Unity? Settings, Options, Graphics, Controls and and more! We'll learn how to create, design, add buttons, sliders, toggles, dropdowns and text elements. We'll learn how to code these elements and make our sliders affect text boxes, create dialog boxes, best practises. We will learn how to save this data...
Hi there,
not sure if I'm right here
does anyone know a way to prevent UI elements from showing their backside?
hey! is there a way to somehow create pixel perfect UI, specifically a crosshair, like in VALORANT? i'm currently using a simple image for crosshairs and changing its scale, both factors can be changed by the player, but it changes size depending on the user's resolution
the big problem is that with certain resolutions, parts of the crosshair disappear (for example while playing stretched like 4/3, 5/4 or even 1/1) and i'd like to have the crosshair be of a fixed pixel size, no matter the resolution
my canvas is using Scale with Screen Size, my reference res is 3840x2160 and screen match mode is on Match Width or Height with 0 being on stretched aspect ratios like 4/3, 5/4 and 1/1, and 1 being on ultrawide aspect ratios like 21/9 and 32/9.
if your new brackeys is basically the best
fairly slow paced, good practices, updates when hes wrong or if theres a better method and covers basically everything
Why does the value of my scrollbar always reset?
I want it to be at 1 but it always resets to 0.5
Works now, had a content size fitter
Guys i want ask one thing, is there any chance to do something like this ? in photoshop you can make Clipping mask, do for example square will be visible only on sphere (Squere Red, Sphere Black)
Yes. There's a Mask component
i want do something like this, so image will be in image
Thanks i am going to check it
Okay, thanks it work β€οΈ
So why is every text blurry on the UI ? i added my own font but when i go lower then 16 it gets blurrier
are you using TMPro?
nah i dont but i trough TMPro created many unessery files in my project i dont need. to mutch crap making the shit load slower
Ahh. Well TMPro may have a lot of files, but it's pretty good at avoiding the blurry text issue.
yeah tmpro works kinda fine, but seems like it filling my project with enormous files
i want to keep everything clean, so there is no why to change my font to make it crispy?
.< damn this unity UI please unity update it
If you're confident you don't want TMPro, then try setting your font to a MASSIVE size, like 150pt. Then use the Scaling tool to make the font smaller. May help
so i should change inside the font to 150? then just scale every text in the canvas to lower?
yeah try that
if that doesn't work or it gets confusing, then just use TM Pro and accept that it has extra files.
Tip: You can delete TM Pro's "Examples" if you really don't want them
Hi there, looking if anyone has recommendation on what i might be missing to debug: working on a rts game, I have a panel that populates the unit icons for each unit selected, and that selection comes from a script to track mouse clicks etc. Now im trying to prevent moving if the mouse is clicked on a UI component but im having trouble. if I put a if(EventSystem.current.IsPointerOverGameObject()){return;} at the start of the selection update method, this seems to prevent clicking on any UI component/button instead of just preventing the one script from running and a debug.log says its returning true no matter where i click.
thanks alynn i will try. to drunk now but maybe tomorrow
Was thinking about the method Crow named, IsPointerOverGameObject, how can i see if its over my UI and i want to drop item if its not
any recommend some tips? just show the way and i do it
just wanna detect if my mousepointer is over my ui, else i drop the item
How hard can it be?
just dunno where to start so if anyone is kind show me the way
the IsPointerOverGameObject() should work to detect if its over a UI element or not so something like might workif(Mouse.current.leftButton.wasPressedThisFrame && !EventSystem.current.IsPointerOverGameObject()){DropTheThing();}
Does anyone know why my font is blurry? (Before telling me to google it I have and tried pretty much everything I could find to no avail.)
What component are you using?
Hello, how can I use Text Mesh Pro Font creator to generate Japanese glyphs? I am trying to follow this tutorial https://learn.unity.com/tutorial/textmesh-pro-localization#5f433c30edbc2a0020942eb3
And Im stuck where it says I need to enter the numerical range of unicode values I wish to include. Question is what are the unicode values for all Japanese characters?
Thanks in Advance
Sorry, I'm not sure what you mean by this. Can you elaborate?
Are you using the regular text component? If not, try TextMeshPro instead
I'm already using textmeshpro
Can you show what it looks like then?
Does anybody have any idea how to update an InputField's text representation (i.e. the subset of the overal string currently shown because it's centered around the caret)? I'm trying to make a "coding window" with line numbers, which is just another read-only inputfield next to the actual text. All other logic (getting the right line, caret position and what have you) seems correct, but try as I might I just can't update the text. I've tried any ForceThis and SetThat method or property I can find on Inputfield.
Example of what I'm trying to do and where it messes up. Note how it correctly adds linenumbers, but once we drop below the frame edge still get added but don't move up like the rest. I can verify the other numbers are correctly there because I can page through them manually just fine.
IIRC, TextMeshPro has a tool to parse a bunch of text and generate the characters for all Unicode characters in it. This is often necessary because for languages with lots of characters, it's impossible to include all characters if there's e.g. tens of thousands. The TextMeshPro texture would be enormous.
Hey there! I'm trying to use the SetBool() on an Animator in a UnityEvent inside of an EventTrigger component but i can't seem to find it, just SetTrigger(). Am i blind, or is the function missing?
SetBool takes two parameters
UnityEvents don't allow you to call methods with two parameters
At least you can't set up those calls in the inspector
in the bottom middle of the screen i have an item holder that moves away when the round starts, and im using onpointerenter and exit to set a bool mouseOverItem to true and false, and then the holder moves in and out depending on the bool. in the clip it works mostly fine as intended except if i very quickly enter and exit, then it will just stay isntead of going away like it should. does anyone have any suggestions for a better way to do this?
Hey there! I need some help with setting up a scrollbar and scroll rect. Basically when I try to assign vertical scrollbar to scroll rect, it just fills the entire scrollbar area with scrollbar handle and generally doesn't work. I can post more info and screenshots if needed.
Thank you in advance! :D
Hello, I want to make a health bar like this
with the circle going down as the health goes down
but I cant get a circle slider
hi, how can I make the children stretch with the parentΒΏ
don't use a slider
just use a filled Image component
As long as you fill the "source image" field, you can set image type to Filled and fill method to Vertical
and adjust the fill amount as you wish
@mortal robinI tried the gridlayout
it just rearrange them
so I lose my own arrange of the cells
You arrange them by their order in the hierarchy
@mortal robinIm making a sudoku grid style
the grid container scales with the resolution, but the cells inside wont
use canvas scaler settings
Font Problem
So, uhh, I have a problem with the grid layout, it doesn't work on smaller screen sizes. What it looks like on fullscreen (1920x1080):
What it looks like in the smaller game window:
You can try searching how to make child objects in a grid shrink when parent is too small
My problem is im already using a content size fitter, so I don't know why this would happen in the first place.
Both axis set to preffered size, that also isn't the issue.
does anyone know why my font is like this when zoomed in? This is the game window. It's sharp in the scene window.
I want it to be sharp since it's a pixel font but it's blurry
Maybe change the generation method in TextMeshPro?
I currently have a problem with pixel perfect not working when checked in the editor.
In fact the whole Canvas GUI is messing up
and GUI not showing up at all in build
^^
I think I have the same problem...
Scene // Game
The white background is the camera one, not an error
any ideia why the components are behind the background image?
show your hierarchy?
UI elements are sorted according to the hierarchy. Lower ones are on top
oh yeah, thats it lol
didnt know that
thankss
Is there a recent fix for GUI using pixel perfect camera?
Can we say it's not worth using?
am quickly following a brackeys tutorial for a pause menu and it seems the shadow effect isn't working for me
i am adding it on my text component but i see no visual changes
is it maybe because it's not compatible with textmeshpro?
I found it, text mesh pro has it's own
Hey guys! Iβm working on a game but I am really struggling on making the menu UI match with the in game UI.
What's the best approach to make a pannable UI canvas? E.g. Shader Graph/VFX Graph...
If the scale on the UI element on the Z axis is 0 then it won't render with pixel perfect. I'm pretty sure it's a unity bug
Hey, guys! I'm trying to build an inventory UI with dynamic buttons, but I'm stuck at the navigation... does anyone knows how can I navigate dynamic UI objects using keyboard/gamepad?
Since they don't exist before runtime, I cannot use the navigation component option
You can set up the navigation stuff in code. You can also rely on auto navigation if the objects are arranged sensibly
How can I get a parent object to resize its size respectively to the children's content? E.g. if the child expand with more UI elements, how can I get the parent to reflect the new size boundary? ATM Content size fitter doesn't seem to work on the parent control (parent does not have Layout Groupping, but all of the children does)
What's the setting on the parent content size fitter?
Figured it out, I had a few elements that had min size set to 0. Aftwer unchecking Min size for both Width and Height, the content size fitter actually works.
@rapid ferry that's remarkable and thanks buddy, I'll check it out.
I can't remember doing this on the GUI scale. It's food for thought.
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.
Does anyone know a tutorial how to change a background color of a editor button?
Guys how can I make the particles show above the UI in the game view, I've tried watching a tutorial but it was just confusing. If anyone could help it would be much appreciated.
Is there a good place to get references for the latest UX interactions working best in game design?
so, why is there this slightly visible background on the letters while using text mesh pro?
Can i somehow have UI thats pixel-perfect (as in i have a loading bar with just 1 pixel width background edges) while keeping the resizing based on screen size?
Look into 9slicing
nope,not a viable solution
Hi, can someone tell me how can I use Adobe XD ui in unity?
who can help me to scale my UI I am having a hard time even after watching video + I do not understand many thing. thanks to anybody who will help me
hello everyone, what causes this strange effect with the UI elements 'trailing' behind?
I want to actually have the N pivot even further past the circle [higher up], and if I do then it just makes the effect worse
I wind up with 'copies' of the N 'trailing' around the circle as N rotates on the pivot
this is outside of any Camera view as the cam view ends here:
how do i lock the height of my uppertab if i disable my lowertab?
solved the old issue. just had to change camera view so it would be 'in' it but now I'm having this issue. by the time X has rotated 180 degrees, X is here.. [white lines to illustrate where centre is]
when X is at 0 degrees, though..
how is this possible?!?!
Hey how can I add my 3d model in my normal ui
Hi. How can I resize a Panel with my cursor (by dragging)?
In runtime or editor @signal pelican?
editor
Press T to activate the rect tool and then you get handles to drag @signal pelican
guys how can i get particles behind ui so like on the canvas rather than in world space
How can I find the UI element that I clicked on? My canvas is set to Screen Space, which means raycast can't "Detect" any object if it's not in world space. I am having issue where several of my UI element isn't receiving clicks, and some element does receive my click. It appears as if there's another invisible UI element blocking my mouse click.
Any chances I could debug on this?
I have made an if statement for my hearts and i need a restart game function or end game function here
if (playerHealth <= 0)
{
// End the game
}
WHat do i add there so the scene starts over and all gameobjects come back?
SceneManager.LoadScene( SceneManager.GetActiveScene().buildIndex );
Be sure to include using UnityEngine.SceneManagement; somewhere at the top.
Also this would be answered quickly in the #π»βcode-beginner channel.
Okay tysm, srry for typing it i n the wrong channel
How can I adjust the drag ratio between the mouse/finger to the scroll rect's content? Currently in one of my scene, the Scroll Rect appears to be 25% slower than the drag received from user's mouse/touch. How can I fix this? I checked other scroll rect, and they appear to move 1:1 ratio.
padding should be 10% of Sampling Point Size. Otherwise will occur this
Alr, thanks
does anyone know a way to add caption to an image? I want the text to appear below the image when the player click a button to show the name of the image, but I dont really know how to do this
What's the purpose of a nested canvas?
Does it provide benefits over just having a single canvas with panels as children?
Thanks, so basically if there are a lot of dynamic elements, then the dynamic elements should be on it's own canvas to maximize performance.
should probably fix that huh
this is what it looks like in Unity
It appears to be a problem with the camera changing scale in the build
do you have any clue why
instead of giving me a snarky answer
I could really use the help π¦
UPDATE: this only seems to be happening with the WebGL version as the windows version's ui is fine
Any one know????
is there any way to do this?
add a child object then add the component to that
Is that itch.io?
If it is, you might try to add a fullscreen button
It would really be nice for when there are two Canvas' set to Screen Space Overlay which target different displays that they don't draw on top of each other in the scene view in editor. This is especially annoying when testing stuff in editor because event system can get undesired input from the wrong Canvas because the editor "thinks" there is only one display.
Even if two separate display editor game windows are open it doesn't make a difference. All the Canvas' just get the dimensions of the last clicked game window and they draw on top of each other in the scene view, which is not how you'd expect it to behave if it is supposed to be drawing to separate displays.
yes it is. I have full screen on and it does not help. It also does not actually fullscreen for some reason
I did not mean to send it as a file but heres a video of what its doing
Convert it to MP4. It'll embed
ah
Is this where to ask about in game UI? I'm trying to use a toggle group, but can't figure out how to keep the selected item selected. It keeps de-selecting when i click outside the toggle group:
https://gyazo.com/c51fac00f8f8444aa3c7d4a6afdc5bf4
Using GUI.DrawTexture, having trouble getting a box-select texture to stretch correctly. If I don't use BorderWidth then the border stretches with the size of the box-select. If I do use border-width, then ONLY the border shows, it is clipping out the interior of the texture entirely
My expectation is that the interior fills to stretch, while the border only expands, while remaining 1 pixel thick
Are you expecting it to do 9-slicing?
I don't think it does that
I think borderWidth just makes it draw only the border
I am unfamiliar with that term, but that sounds right
Indeed right now it's only drawing the border π€
Yeah that
Maybe that is relelvant lemme see if I can configure the sprite like that
Is there some way to set the GUI Style to do Slice style with the texture like that link describes?
Or is the 9Slicing stuff only available for Sprite Renderer? It seems... pretty relevant for UI stuff so I'm surely missing something
not that I know of. 9 slicing is avaiable for SpriteRenderer (which is not UI) and Image (which is a UGUI component)
The GUI.DrawTexture stuff is the legacy IMGUI
which I don't believe has any 9 slicing support out of the box
Okay so I should be using this UGUI business instead, which does support 9 slicing?
Cant manage to remove this white border around the TextMesh Pro dropdown list area... Any ideas on where it's located?
I mean yeah , it's also a lot easier to work with
are you sure it's not just the REctTransform gizmo?
try turning gizmos off for a sec
So I have a main menu empty gameobject that is a child of the canvas(UI Manager) and I want the width and height of the main menu rect transform to always match the size of the canvas. How do I do that
I can set the size to match the canvas but once I change the aspect ratio it no longer has the same height and width
Change the anchor to stretch
Hey! I've got a little issue, when putting an asset in my sprite renderer's sprite box, the sprite scales weirdly, would you got any idea on how to fix that?
Show the inspector of this object
Is this Image or SpriteRenderer?
Hi. I have a Panel which shows me sprite images, when I click on a buttons. I want a fade-in effect. I made it like this
Any ideas how to script that?
This is my button btw
tween the alpha of the image
Hi, i'm using a coroutine to smoothly fade in some TMP_Text but the effect flickers and resets when i am resizing the window.
Is there something I can do to prevent this?
Originally it permanently messed up the text so at the end of the coroutine i simply apply the final color to it all, just to make sure
//Grab dialogue text properties
dialogueText.ForceMeshUpdate(true);
dialogueMesh = dialogueText.mesh;
dialogueVertices = dialogueMesh.vertices;
Color[] colors = dialogueMesh.colors;
//Slide curve from negative index to end of text
for(int x=-characterFadeSpan; x<dialogueText.textInfo.characterCount; x++) {
//Iterate from current index til end of curve
for(int y=x; y<x+characterFadeSpan; y++) {
//If index is in valid range, modify characters
if(y>=0 && y<dialogueText.textInfo.characterCount) {
//Grab character info
TMP_CharacterInfo c = dialogueText.textInfo.characterInfo[y];
int index = c.vertexIndex;
if(c.character != ' ') {
//Apply color to all 4 vertices (Each char is on a rectangle mesh)
colors[index].a += 1f/(float)characterFadeSpan;
colors[index+1].a += 1f/(float)characterFadeSpan;
colors[index+2].a += 1f/(float)characterFadeSpan;
colors[index+3].a += 1f/(float)characterFadeSpan;
//Apply color effect to vertices
dialogueMesh.vertices = dialogueVertices;
dialogueMesh.colors = colors;
dialogueText.canvasRenderer.SetMesh(dialogueMesh);
}
}
}
yield return new WaitForSeconds(characterFadeInterval);
}
//When done, assign final color
dialogueText.color = defaultDialogueColor;
This is within an ienumerator, you can see i call ForceMeshUpdate() once at the top
i set text color to transparent before this.
Once again the effect seems to work fine but resizing the window breaks it
How? Never did that. Any ideas?
Are you modifying the asset properties?
You can swap to a material copy and fade that instead.
Or use CanvasGroup, it has built-in fade function
Per character, and control their vertices to make the text squeeze?
because i dont want to fade all the text at once, thats lazy
This is for scrolling dialogue
You can see in the middle of the code where i made comments
//Apply color effect to vertices
I'm updating the mesh
If there's an event that reinitializes them on redraw when window resizes, you may need to hookup to same event and reset everything after.
kk
Its not exactly gameplay breaking, and kind of rare since the player has to be resizing the window while text is populating
fortunately the end result pops up when it needs to, but it does flicker a bit
How do I make a field in my inspector to select a folder in Assets?