#📲┃ui-ux
1 messages · Page 6 of 1
Thanks I'll look into it
I prefer using an asset that gives you control over the shape
This is the one I use: https://assetstore.unity.com/packages/tools/gui/procedural-ui-193375
There's also this one, which is free: https://assetstore.unity.com/packages/tools/sprite-management/shapes2d-procedural-sprites-and-ui-62586
And there are other paid ones, I've only used one other besides the Procedural UI one above
What's your actual question
Hey, does anyone know why my Colors are a bit darker in the scene view? (Using URP)
Because your game camera doesn’t have PP turned on
I have a Scroll Rect in my game for mobile apps and I've noticed that, on my phone, when I try to scroll faster than a certain value, the speed gets clamped
And it doesn't feel very much like a native scroll view would
any way to fix this?
How can I export gameObject as image? Or is there any way for me to put a gameObject in a canvas?
I am creating a "how to play" scene. I want to include my power-ups in the canvas to help the player know about the power-ups. However, I don't know how to put a gameObject in a canvas, (I know this won't work but I'm just thinking if there's a way to change some properties of that obejct so I can paste it in my canvas along with the text on it.) I also want to know if I can export a gameObject to a transparent image. Snipping tool is out of the question.
A world space canvas
Or... An image UI?
Then you can assign the sprite
Gonna try
Why is my vertical layout group modifying the space in-between the child elements of my other vertical layout groups ?
I am getting different spacing in-between my text fields even though all the checkmarks that are related to spacing are disabled, this is messing up my layout and I can't seem to figure out why it keeps happening.
solved
Hello. I have a particle system that I want to render particles on top of everything I have on the screen. I have tried creating a camera, with these settings: - Setting the canvas to use that camera, but the particles are really big in size and still do not render on top of the UI. The layers are set correctly. Could someone help me?
https://gyazo.com/a98c04978b8e17349dca7ef489ab9d88 - I have solved the size being too big, but they still render behind the UI.
why doesnt my canavs show on camera?
hi there, I have a 2000x1869 sprite (imported from a png) in Unity. I'd like to use it lower sizes (around 256px) and in its full size. The sprite uses bilinear scaling.
When using a Raw Image in the scene, with the native width and height (2000x1869), it works fine.
When scaling it down by half, the black arcs get aliased.
Again by half, and it's even worse and more ugly
Is there a way to fix this? Mipmaps don't seem to have any effects. here's the image
here is the image he is referring to
Hi
I was reading the TextMesh Pro Unity Documentation
This means that in this box I must set the size in pixels of each character? Sorry for my low english level 😅
For example, if I type "7" here, Will each character be 7x7 pixels?
Hello! I am working on creating a computer interface in Unity using UI canvas. I am wondering if it is better to use multiple UI canvas and change the order layer when different screens appear or to use multiple image components. Can someone give me advice on which method is best?
how do i resize pixel art images? i know there was a way but im not sure which settings do it
Hello ! I have a problem with a UI element that does not show on camera. I've set it in UI and still.
I cannot see a canvas anywhere here
set it in UI
means what?
The layer i mean
I've set it in UI
Here is an example of an element i want to appear in Camera UI
The layer does not make something be UI
You haven't set up any UI by the looks of it
http://learn.unity.com -> do the Ui basics and learn what you're doing
Thanks.
I'm having problems with UI too
I want to disable/active screens with event trigger
but isn't working
Does anyone know why my image isn't showing even though its behaviour has been enabled? When I manually enable and disable it in-game, it works again. Seems like it only works when it starts enabled.
code should be fine, since it's just a simple .enabled toggle
The reason why I'm doing this instead of enabling/disabling the toggle is because I have OnValueChanged events that I don't want to call.
Check that it's not a parent with a scale 0, or a mask, or a canvas group with 0 alpha
why is my scene grayed out? It looks normal when i start my game
None of those are applied. Scale is 1, even checked the parents of the checkmark object. There's no mask either and no canvas group with 0 alpha. The only thing that strikes me as odd is the default UI material. Instead of showing the checkmark, it shows nothing. But when manually toggling it in the inspector, it shows the checkmark again in the material preview.
My guess is that, because the checkmark image component started out disabled, the canvas treats it as such and doesn't render it properly even when enabled again.
No idea how to circumvent that though.
I can honestly just turn the alpha to 0 and keep the component enabled.
Gonna try if that solves it
update: that didn't solve it
Make sure toggle isOn is true
I ended up solving it using an EventTrigger, thanks anyway 🙂
i have two buttons in a scene that suddenly stopped working. they dont react to hovering or clicking
what setting do i need to change to fix this slider? It's stretching instead of filling, but i Don't know what's going wrong.
don't use a slider for health bar tbh
just use a filled image
slider is overcomplex and hard to configure
oh true didn't even think of that...
well, i fixed it by changing the slider image type to "filled" lol so guess that is the easier way 😅
yeah exactly
as in "filled image" is the easier option rather than slider lol
Hello, could someone tell me how to stop UI elements from going off-screen? I'm not supposed to use math to align their spawn points am i?
Simply anchor them properly
Will do, i wasn't sure how to go about anchoring since in my case i have issues with pop up menus that spawn on top of objects that are close to edges of the screen
learning about anchors was useful but i'm not sure how to use the info to solve the problem i have
here's the problem:
you can right click a unit to get a pop up menu, then view cards in the unit's deck and hovering over card previews enables child element with expanded card info
i could simply put it lower to avoid this particular problem but is there more dynamic solution?
you need to figure out how large your popup is going to be and see if there's enough space on screen for it
if not, pop it up in a different direction
yes this will require you to write some code
right, that's exactly what i wanted to do
idm writing code, this entire project is gameplay prototype + me trying to learn my way around UI
i guess i know where to start now
apologies for the tag but i do believe i figured it out, thanks for the direction!
hey for some reason I cannot scale/manip. canvas can someone help?
If you're using a screen space canvas, the size of the canvas is determined by the game resolution
you cannot resize or manipulate the canvas
damn
the idea is it matches your game window
why would you need to? Just make a child object of the canvas
you can do whatever you want with that
I am making a app style UI and I want to be able to scale down the canvas to the size of my phone model so I can have a proper frame of ref
go to the game window
and set the resolution of the game window to your phone resolution
that's the point of it
(i.e. take it off "Free Aspect")
alr got it thanks!
very vague question...but what do you think this UI missing? Here it is in 1080p and 4k (with some dialogue)
Or is this enough? I was thinking hotkeys or a minimap, but I can't think of a use for hotkeys in the game since it's mainly dialogue and set collection. Or maybe even a keybind reminder? (WASD, E to interact, etc.)?
gameplay is top down 2D pixel RPG, hence the inspiration from stardew valley for the UI 😅
Less is more when it comes to UI
I wouldn't add anything unless you have a compelling gameplay need
must add cruelty squad ui border 👍
Hello There. Does any of you struggled with overlapping score? If that's not correct channel, sorry about that. I'm quite new in here, happy to fix it! 🙂
i just googled. peak UI design right there 😍
i think you're right 🙂 I'll leave it as is
Someone here who is good with unity UI? I try to make a simple grid layout group where the background scale with the amount of gameobjects inside the group. But I cant get it working?
I tried everything with different combinations of UI elements but its not working and google couldn't help me too.
content size fitter on the grid layout, with the image component also on that same gameobject
Got it, thank you very much 🙏
Does anyone know why this text will not go above the grounds and all?
what't he position of the ground
Also whhy use legacy TextMesh when TextMeshPro exists?
I said before to go into 3D mode and check, did you do that?
Is it closer to the camera than the background?
it will stay behind everything else
Can I see it in 3D view?
probably some kind of render queue thing then
its infront
doesn't look that way 🤔
A 2020.3 project that I have been given already has some third party 3D assets. How can I check their (I apologise for not knowing the proper term) 'quality' so if I were to introduce other external assets they look as real as each other?
Does anyone have idea how to fix it by any chance? 🥲
You should use the Text Mesh Pro versions of controls, not the legacy text. Legacy text isn't good
TMP uses signed distance fields to draw text, which are sharp at any distance
I'm having problems with my button not working - I haven't even gotten into the point of scripting it and it's not even clickable
In code, I have the enemy prefab always face a target, but I dont want the ui attached to the enemy to also face it. How could I have the ui canvas always face the camera while the enemy faces the target?
Also, is this the right channel for this question?
hey there, wondering why TMPro is giving me this error on trying to build? i dont know if it has to deal with a custom font or not, but that's what it's hinting towards
You can try one of the various Constraint components (like a LookAt)
Does anyone have an idea why the TMP in my button is ten pixels closer to the right side than the left? The text is center aligned and all paddings and margin settings I can find are set to 0, I have no idea why this is happening. It looks terrible when the button is activated
Doesnt look too rerrible to me...
Hye; is there any other way to build the ui for unity game other than in unity itself, like use of figma , adobe XD etc.. is it actually recommended to make ui in unity ?
tell me, do ping me--
Depends.
If you're making a mobile app, with the app built in native (which then runs the Unity build within) then use whatever UI solution you would for native.
If it's just Unity, then I've never seen a way to do it outside of Unity
got it thanks
Anyone here familiar with Localization package?
I can't quite understand how to properly use global variables.
// You would normally set this up through the Localization Settings Editor, however
// we do it here for the sample so that it can work without any changes to the project.
sample says this, but...
I literally can't find how to set it up in editor anywhere
Localization Settings asset does not contain any variable group fields
i want to change the properties of a UI material at runtime, but i want to only affect that UI element instead of all of them, is that possible or is there a limitation on that?
i'm able to do this with sprites but when i try to do the same with UI elements it changes the main material and affects everything
Duplicate the material (with Instantiate) and assign the duplicate to that particular Image
oh bet didn't know you could do that ty
How to put image overtop ui elements?
I have used this icon with transparent background, why there is this line above "lock icon", and how can I rid off this line
i cant put a ui image over a ui button from another canvas
I want to build a deathscreen where the highscore and the amount of enemies killed (for multiple types) as well as a sprite of the enemies move to a specific location. I also want to make the elements move back to their original positions when the player clicks on try again for example. Whats the best way do achieve this?
By any chance, could it be that some elements can't be put into canvas? I've got a Mapbox map that I'm trying to bring into a canvas, which works first, but when I save the project file and start it up again, it didn't save the position and rotation. It's still a child of the canvas, but the positioning isn't saved.
Hi im having some problems when trying to use untiy UI and UI Toolkit I explained the problem in this reddit post, would be glad if someone could help: https://www.reddit.com/r/Unity3D/comments/10g1cz2/unity_ui_not_working_with_ui_toolkit_because_of/
0 votes and 0 comments so far on Reddit
why i get the whole pro text ui displayed?
what is the code you're using to display the text?
{
[SerializeField] TMP_Text scoreText;
public static int score = 0;
[SerializeField] TMP_Text liveText;
public static int lives = 0;
private void Update()
{
scoreText.text = $"{scoreText}: {score}";
liveText.text = $"{liveText}: {lives}";
}
}
dont crosspost please. stick in #🧰┃ui-toolkit
well, because you put scoreText in the string
what did you expect it to look like?
it is a string, right?
yes i stored it as one
what did you expect the text to look like
then just put scoreText.text = $"score: {score}";
you dont need to print your scoreText variable, so why put that in the string?
I've just started working on a customization UI, and I'm about to add color options for skin, eyes, hair, etc etc.
When you click one of the buttons (head, hair, eyebrows, facial hair) the row of options appear.
Where would you initially place the color options?
Have them always displayed in its own section?`
Have only hair color displayed if hair color button is active, etc
Hello first time Poster and kinda lost about which channel to use but I think this might be the correct one. So I'm using unity 2022.2.1f1 and I'm trying to make a model show up in my Ui. I've got it working with render textures however following other tutorials I couldn't get it to work with transparent background. (using hdrp) since I wanted to make the 3d model itneractable anyway (to make a turntable kind of thing) I was thinking about switching to using a 3d model. Checking out some tutorials online I figured out that this is only possible if the canvas render mode is set to screen space - camera and using an extra camera for it. However im running into the problem of the Ui showing up in the editor but not in the actual game and I'm a bit lost on what to actually do (same happened for the model before I changed the render mode so I'm guessing I'm doing something wrong)
It's easier for us to help us if you actually show:
- the issue
- the settings you're using on the camera/ canvas
Localization Settings asset does not
why are the guns blacked out? and why dont they show up in the playtester?
showing your hierarchy panel in the same time shall greatly help
heres the hierarchy
i fixed the lighting issue but idk why it doesn tshow up in the thing
playtest
UI is the canvas
the objects have animator components
Are tehse guns part of the UI?
What components do they have?
Make sure they have ui Image components.
NOT SpriteRenderer
that must be it then, they have sprite renderer
is it possible to animate ui components with a sprite renderer though?
i mean
image
component
Will do so is there a good way to share those or is Screenshots the best way? (I didn't want to send thousands of Screenshots
idk i thought it was only for sprites
The Animator is for everything
its the same one used for 3D models you know
It just animates data, it doesn't care too much what that data is.
What kind of animations are you doing anyway?
Seems hardly worth using an Animator for
how would you do it?
myImage.sprite = whicheverSprite;```
That's all the animator is doing ultimately
i guess it makes more sense
which image would i use? to change an image
UnityEngine.UI
How do I add a border to a gameobject?
I tried using Outline but it didn't even show
If you think you need to be sharing "thousands" of screenshots, then you should be doing a screen recording and sharing a video
A GameObject doesn't tell us what you want to outline.. everything in the scene is a GameObject
uh
I wanna outline
this
is it a primitive cube? a sprite renderer? a UI image?
right, that's not UI so not for this chan 😉
Ask in #🔀┃art-asset-workflow - I've not worked with 2D, I dunno if Unity has a built in way to put an outline on something. I would just do it in PS
oh okay
so i have a tmp_text
on a canvas set to screen-space camera
the text is clipping through objects - how would i sort the text to always be rendered above?
Use a screen space overlay canvas instead
Or reduce the plane distance until it's closer than any objects
Is that the only solution?
Reducing plane distance would make me have to reposition everything else on the canvas
Is there any way to set the cursor to the windows pointer?
hi, I've tried to use OnPointerEnter and OnPointerExit on a 3D object, so I have an Event SYstem game object with Standalon Input Module and Event System component, I also have the Physics Raycaster on my main camera, and I have this script attached to the game object where I want to use OnPointerEnter and OnPointerExit :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using TMPro;
public class LaptopScript : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public TextMeshProUGUI onPointerText;
void Start()
{
onPointerText.gameObject.SetActive(false);
}
public void OnPointerEnter(PointerEventData eventData)
{
onPointerText.gameObject.SetActive(true);
Debug.Log("Pointer entered Laptop");
}
public void OnPointerExit(PointerEventData eventData)
{
onPointerText.gameObject.SetActive(false);
Debug.Log("Pointer exited Laptop");
}
}
But it doesn't work at all, I don't know why, if someone knows, I would be very happy to know what I miss :)
You can look at game UI database
It's a site. Can look there for inspiration
please someone explain to me how i am supposed to get the reference
How do i fix this?
^^ I fixed it by changing Canvas scaler to Match width and height and setting value to 1
any ideas please ?
Not sure, does the object have a collider
Are you sure nothing is blocking the object? Look in the bottom of the inspector of the EventSystem to see what your pointer is actually on?
no but I tried with it
you need a collider
How about checking the EventSystem?
I tried with it but nothing happen
what do I need to check ?
Play the project --> Go to inspector and click on the event system --> Open the bottom tab (You need to drag it up) --> Try to interact with the object and check if it's detected
You have to use it, actually
@tall oak
I disabled the canvas and it still doesn't work
nothing is detected
Disabling the canvas disables the graphics raycaster
I diasbled the childs of the canvas but still nothing
It should not affect nothing, he want to use physics raycaster
Yeah, I meant that
Look in the tmp Input field inspector and see
i cant find any property to change it...
hey! i have a tmp text object inside of a scroll view. I am adding text to the text object every 0.5 seconds. how would I be able to have it so that the text object automatically scrolls so that the bottom line of text is at the bottom of the scroll view? or how could i do this without a scrollview? the scroll view isnt really necessary for me, thats just the way I thought of doing this.
https://forum.unity.com/threads/scroll-to-the-bottom-of-a-scrollrect-in-code.310919/
I think you could do something like this whenever the text changes..?
it's the simplest way I can think of, without asking for more context or actually testing
i tried that but it doesnt seem to work. ill keep playing with it. thanks
a video would be clearer, with the inspector of the text and scroll view shown as well
Does the content for the scroll view have a content size fitter on it, and set to resize with children? If not, then it won't scroll with additional text because it's already at its limit
How do you change the alignment of a texture image on a handles label?
I keep getting the issue of the texture rendering with the top left at the center
just position it up and left by half of its width/height
question
someone knows how to make an Canvas animation to
not... slide?
like, it starts slow, then fast, then slow again
(im animating a fog cloud, that moves to left to right, and im changing the X position)
I mean... presumably however you're doing your animation you set it up that way
with some kind of easing function
You'd have to explain your setup for this animation
no
oquei :c
Hi I don't really understand content size fitter. Preferred size especially doesn't make any sense to me, it seems to base the "preferred" on what size the original sprite was, how can I get my UI object to start at a specific size?
Hello, do you still need help with this?
Is there a general recommendation on which of these two methods you should use for opening/closing a UI screen (such as a pause menu, inventory, etc.)?
- Instantiate a prefab of the UI screen to open it, and then destroy that instance to close it.
- Embed the UI screen in the scene, but have it default to be inactive. Activate the object to open the screen, and deactivate it to close the screen.
I've used both methods, but I haven't worked with UI enough to have a strong opinion one way or the other.
Generally instantiating/destroying is frowned upon as it causes garbage collection. If it's going to be reused you should deactivate/reactivate it
That helps, thank you
sorry wasn't online... and no thank you... kept on searching in the internet and found the solution... thank you a lot though 😄
hey, can i ask you guys smth ?
i am making a Drag and Drop workflow (or screen idk), but i dont know how to make it ( maybe scroll ui ) ?, it may be procedual generation (bc its width and heght maybe infinite), btw i need help to make a grid like this too (and when u scroll u zoom in instead, u hold middle mouse u Pan the workflow) (u guys just have to explain, dont share ur own srcript)
(sorry for my english)
(sorry the vid sucks too)
(or diagrams sorry)
Either buy an asset from the asset store that allows you to generate sprites in the editor, or create a sprite in an art application (eg: Photoshop) and import it
This being the UI channel, the first suggestion is for UI assets..
Search for infinite scroll @rapid ferry, that's the commonly used term
if i scroll it zooms, if i hold middle mouse it Pans, how can i do that ?, like, keybinds or ?
Hey folks, a little brainstorming here, what are the common reasons a Button is not interactable ?
- missing event system
- missing graphic raycaster
- missing input module
- raycast target is disabled
- another ui element blocking it
It was a missing module in the event system 🙂 thank you 🙂
right the input module
as mentioned
oh yeah you mentionned it sorry 😮
It's not weird
is it possible to render text onto a ui image without having a text object there
like the only object in the hierarchy would be the image with a script on it that renders a bunch of characters onto the image
hey i got a slider ( which has the value (of the handle) from 0 to 1) , but i wanna make the thing at the corner follow the slider too (which has Vector 2 (i guess) transform), pls help me, for my english
What's wrong with a text component?
i would need to determine the number and position of the text elements at runtime, and instantiating a bunch of text objects seemed inefficient
doesn't seem like an issue to me 🤔
oh ok lol
thanks for the confirmation!
I have a Scrollview with buttons in it. Whenever you try to click anywhere other than the dead center of the viewport, it just scrolls the rect and doesn't click the button. Is there a way I can either disable the click-and-drag scrolling or find some other way to make a UI button work properly inside of a Scrollview?
can you disable raycast target on the scrollrect panel or mask or whatever it is that detects that click and drag?
Oh, good idea. I was looking for some way to disable the drag but I don't need the mouse to interact with it for anything else so that would do the same thing
Has anyone here got emojis working with the new version of TM Pro?
I'm trying to follow the docs but I don't even have the option for creating a "Color" font asset
Did you ever get emojis to work?
they will work as long as your font supports them AFAIK
Well I downloaded a font asset. But my main problem is not being able to create a color font asset.
Right click in the Asset folder, and then select Create > TextMeshPro > FontAsset > Color. This ensures that you create the font asset with the right shader (Sprite) and the right atlas rendering mode (Color).
^ that is what the docs say
When I go to Create > TextMeshPro > FontAsset > there is no color option
I tried in both 2020.3 and 2021.3
I have TM Pro 3.2.0-pre.4 installed
No lol, it's a nightmare
I believe in the font asset creator you can set the renderer or whatever to color
At this point I'm not sure where I'm failing so I sort of just gave up lol
Yeah I'm just going to give up too haha. It's not very important right now.
It's very weird there's literally zero documentation or tutorials on it, I feel like it wouldn't be too uncommon of a use-case
hey just checking this will make the main menu disappear and popup the new UI correct?
It will deactivate the Settings (UI) GameObject
that is all
Is there a way I can put it in the players hand and when they put their hand at a angle it will appear
huh?
Ok so I’m making a Vr game and I am making a phone spawn in your hand if you position it at a certain angle
What does this have to do with the question above about an OnClick listener?
Oh nvm I’m tired and running on 3 energy drinks lol
will this work
The top one will do nothing, since you have it "Off"
The bottom one will deactivate the Main Menu in the editor and at runtime
Hi everyone. I'm trying to make a panel in which dialogue should be shown, but I'm struggling to get something right. I'm using a parent object with a vertical layout group, with a child background object with a horizontal layout group. The background object has two children: Name and DialogueText. Both will be filled with the correct strings by script on activation.
What I want is to sort of give the Name a width priority so that DialogueText can only stretch so far and wont actually squeeze Name into being smaller. Is this possible? Thanks for any tips in advance.
I already tried messing with Auto Size and enabling/disabling Wrapping in the DialogueText and Name objects. I also can't really use min/preferred size option as Name and DialogueText are variable, because when a long name is entered it'll move the last letters on the next line anyway.
I want to sort of give Name priority in sizing. For example, when someone has a long name like Christopher or something, It'll stretch and push DialogueText away, but DialogueText shouldnt be able to stretch and squeeze Name.
Nevermind I've moved on to another idea.
i have a bunch of tmp_text objects on a canvas
none of them are showing
except for a square symbol in one
none of the vertex colors are transparent
an image on the canvas is visible, so probably not an issue with the canvas
wondering what could be causing this
send pic of what you're seeing and some of your TMP component settings
select the TMP object, then show a screenshot of the entire editor so we can see the hierarchy, the scene view and the inspector
also, side note, BoxCollider2D is for sprite renderers.. not UI
fixed it, it was a weird dilation on the text material
how else should i add text highlighting?
on hover specifically
thanks 🙏
I want to build a UI element that's like a small social media post, it has a profile pic, username "x minutes ago" and can contain an image optionally.
truth is I suck at UI design, are there any templates that could get me started?
anyone know if there’s .guiskins anywhere on the internet that make IMGUI look better? imgui is super useful for game jams but it’s just so ugly
how do I take a sequence of separate pngs or an animated gif and turn into an animated sprite in unity
everytime i try dragging them all into the scene tocreate an anim it creates an anim with a "sprite renderer" not an "Image"
nvm i did every frame by hand
how to render particles in front of the canvas
is there a reason why the button in my game isnt working?
its not even showing that my mouse is hovering over it
You're probably missing the event system in your scene
why is a canvas so separate from the actual scene/camera? how would i light UI?
Because screen space overlay just draws directly on the screen completely ignoring cameras.
Play with and understand the different Canvas render modes
I'm currently re-making my Customization ui, and I need some suggestions
What kind of layout would YOU prefer? make the left box a bit bigger and add Male/Female on top?
The numbers are each option for a picket category, this will be displayed in a box somewhere, probably under the other options
It's an RPG game, so I might add the option for some traits, so maybe have a longer bar at top with "Gender, Apperance, Traits, Skills" etc
I'd make the colors smaller and make them sit in the top right of the screen but thats just my personal preference. the way it is now it feels like it takes up almost your entire view.
@ionic saffron TMP has a non-UI component so you can have text in 3d space without a canvas
Currently working on a new UI, where'd you prefer having the color options on this?
the numbers on left are the different options in the category selected. I was thinking of having only the colors relevant for what category you clicked on be available, if you get what i mean
color grids still too big for me. appearance/traits/skills too big. male/female etc looks fine
and maybe accept button in the middle below the character
again this is just my preference
The color grids havent been touched yet, I'm gonna test out having the head/hair/etc buttons on a grid, giving more room for the options, which in return will free up an area at the bottom of the panel for colors
Which is why I'm asking, I wanna know what people prefer 😄
Appreciate the feedback!
yw gl
and yeah i like option 2 more with the numbers thing inside male/female thing more
together with head hair eyebrows facial hair
Colors are the bottom will be color options for the different categories, as the player click on them
Anything you hate about it?
correct lol
Adding keyboard/gamepad support has been very tedious and long process
how do I use a png image for this
You probably need to change the type of the image you imported in the import settings of the image
ok thanks
i made an empty and attached some sprites to it and then added a horizontal layout group but its not working, why is that?
Show the inspector of one of the children
Sprites are not UI
Actually you don't even have this on a canvas
The layout group only work on canvases and UI images
Hi I just exported my unity 3d game to my phone and the canvas is much smaller than how it looked on pc
you need to set the Canvas Scaler component on your Canvas object to Scale with screen size
and set the correct reference resolution, which is the one you were using in the editor
and how can I change my game scale to 1
That has nothing to do with UI or game scale. There's rarely a need to move that slider away from the far left.
I've made these options and they both work, but for some reason only one at a time depending on which one is in front
I can't figure out what's causing it
if i move the volume option down on the hierarchy i can adjust the volume, but i cant change the graphics settings
and vice versa
Does anyone know why i cant clikc on the button listed on the left of the box ?
I added setactive false to it, but it doesnt do anything when i click it, like i cant click it at all,
When i settrue or setfalse with cute it does work,
But the button seems not clickable
ok I fixed it, no idea what why or when
I'm having issues with adding a text on a prefab.
Once I add a text, a canvas is automatically added.
When I go into the game, I do not see the text
even when I change the position to the camera area
I can only see it in the Scene
I cannot see it in the game
I am guessing Canvas is pretty much screwing the text
is there a way to add a text without a canvas?
Nevermind
I found a solution
Create a GameObject + add TextMesh component
how do i make it so i can click these worldspace canvas buttons
cant you click that yet? Maybe try turning raycast target off for those textmesh pro, they are blocking your clicks
alright ill try that
i don't see the button for that @rapid ferry
i might be blind but i don't see it
I havent used tmp before only text
you can try to disable the TMP then try to click
just to be sure that it is the problem
clear the objects that blocks the buttons, then try
the button already has this btw
i just deleted the tmp and it still doesn't go dark when i hover over it
Wierd, I had to change my canvas to world space, should work fine
buttons in world space canvas are clickable by default, you dont even need to change anything
well im probably missing something obvious
can you show your heirarchy?
ill try adding some more events and see if that works
if your button isnt under canvas, obviously it wouldnt work
out of curiosity, why?
hold the phone
if its not under canvas, it would work?
is that a typo or an actual fact
typo haha
ok i was gonna say
that would explain a lot
fyi i know like, probably nothing about ui
the most i've done before is a main menu
have you fixed it?
im currently trying to debug
@rapid ferry i reckon its probably very simple
is it possible to click UI when the cursor is locked?
yes, but only on the center of the screen
whereever the cursor is, if it is hidden, it is only invisible, but you can click on whevever it should be
you really should try to make that button work while cursor is visble first
I dont see any problem with that code (unless the script name is not payHimX)
it is
try to figure out what is wrong with the button first, because something seem to stop you from doing that
this is so confusing
theres no errors
or anything
it just simply does not click
can I see the button in editor?
have the whole screen
canvas looks fine
Debug.log("hop out at the after party");
you prob need to have event system to the gui ngl
uhh, i don't follow
I thought he had a spelling error lol
what does this mean lmao
click on the button and add a OnButtonPress event
then find EventSystems
add your script the pay thingy
you prob need to have event system to the graphical user interface not gonna lie
i have added an onbuttonpress event
is the script on it?
yeah lol
and where is this script in the explorer
he is using button
yes but when you make a gui
it creates a event system
yeah test that
ok so that did nothing
im glad i did that lol
well, im starting to run out of options
You can still convert to Screen overlay canvashaha
anyway you should try that
there is no way that this worldspace ui just don't work
what do i do
i don't wanna convert it to boring ui
ok well it works as screen overlay @rapid ferry
but i want it to be worldspace so what do i do lmao
this is communism smh my head
disable that whoever that is
how?
set a method that will turn that off when not needed
or whatever is in the center
turn off the raycast target
if you have panels, image, text, or any ui element that blocks the center, turn that raycast off
but how
there is nothing in the canvas
it causes errors
because some code refers to it
i can delete it
big brains
@rapid ferry i deleted the canvas and it still doesn't work soooo
this is literally 1984
Is your UI not responding to input?
your Canvas object needs a Graphics Raycaster component as well, if that's the issue @hearty mulch
alright i shall add that
okay. I dont actually know the issue you were running into
its worldspace ui, a button to be specific, but i can't click it
it doesn't go dark when my mouse is over it, it doesn't fire an event when i click it, you know
no errors in the code, just literally does not work
can you show the current inspector of the canvas? @hearty mulch
yeah
and what's the object you want to detect a click on?
show me its inspector
i have to go
there you go
alr cya
hmm.. afraid at first glance I can't see what's wrong. I dont work with world space canvases much either. Hope you figure it out
i just realised, how will it work with a locked cursor
You should have a script that can point the camera to the choice you want. Then when you click, the center will be chosen. But ofc you have to make the button work first
but how would i do that if its not worldspace
you cant
so this does not work
you should unlock your mouse ofc
when choice appear unlock your mouse, then when you select option, lock it again
you can even use OnEnable and OnDisable for it
For my ground material im using a texture in albedo and the same texture in detail albedo for secondary map. I shift them by x & y and get enough randomness for my game.
The problem here is when layering both textures above the main color heavily changes. Is there a way to keep orginal color when layering ?
How do I ensure that one element of a menu I have is in front of all the other elements of it? Some of the elements are ones I'm generating by script so when they are created they are generated in front of an element that I would like in the front.
Set it as the last child, the order of objects in the hierarchy determine the draw order for UI.
So just access it in script and object.SetAsLastSibling()?
What is a good way of setting up panels like this in game? Are the things on the sides and bottom ui elements? Seems like it is because of its interactability, but I also dont want it to be in front of other things, I just want it to be its own area.
hi guys, trying to create a tooltip but struggling to get the background to auto size and also get everything aligned, im sure this is something someone has done before, anyone provide some guidance please?
hello
I have a problem with content size fitter.
Why isn't the component resizing the object to encapsulate the children?
It works if it has a layout group, but I need the case without it.
here is the image of the problem
the parent should have red bounds, but it is 0, 0
hello
can someone help me with my ui? its blurry for some reason im not sure why
Use TextMeshPro instead
im trying but its so goofy
How to make these options stick more to the center?
hi, I'm working on setting up a settings menu right now, and for some reason the sliders for volume, sensitivity, etc, and the sliders change color when I click them, but I can't drag them at all. Any ideas?
for reference, they are part of a horizontal layout group inside a scroll rect
toggles, dropdowns, etc. all work
Uncheck child force expand height
ahh working now
That was very quick fix, thanks! I havent really messed with layout groups before
My TextMeshPro-Text ist above Elements it should be behind.
Sorting options, Z-positions all fine according to the topics i found. Shader is not the OverlayOne.
Which part am i missing?
I'm trying to make UI that displays in-game time, so far i have this but when i click play it doesn't show up?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Clock : MonoBehaviour
{
[SerializeField] TextMeshProUGUI clockText;
private void Update()
{
clockText.text = System.DateTime.Now.ToString("HH:mm:ss");
}
}
You didn't reference any TMP text
I want to do something like this but like as shown in the bottom picture when i add another it adds it to the right
@gentle iron they were talking to me not u
you werent meant 😄 you can go to beginner or #🖱️┃input-system 🙂
ah-
So, whats your issue. Instantiating it or the positioning? You gottta give some progress you amde to try to achieve or a question, not just "how do I make this"
positioning rn i dont have any progress bcs i gotta lotta crap to do before i get there
i just wanna learn how to do it
i can make a mock up
I suggest looking into the unity learn tutorials about UI for example. Alos reading the docs about layout groups. And if you want to have sorting, you can use lists or the sibling index of items in UI
hmm ok lemme explain exactly what i wanna do
so im making an rts game where i can highlight select things obv like a normal rts game, and when i have multiple things selected of diferent types like a building and a unit I want to show the ammount of each of them i have selected
pain i gotta go to bed now gn
Use TextMeshPro version. Old text you can find in Legacy menu.
But it's already installed.
Not sure what you are trying to show. You have Text-TextMeshPro right there
and if you look under those options you will find Legacy components
Are they just the same?
No. Old text uses huge atlases if you resize something and TMP is compact SDF fields.
Button not working for some random reason
My other buttons work perfectly fine
NVM JUST redid it and it worked
in the editor this ui image has a transparent backround but it isnt transparent in the game view. why is this happening and how would i fix this?
how are you presenting it in game?
is this a UI image component?
What are the import settings for the image?
its an raw image component
Why
why not use Image
also why are you using some weird material
well neither image nor raw image worked
and the material is transparent, but the transparency isnt showing up on the ui in the game view
does it have its own camera?
i fixed it by changing the canvas render mode to screen space and using the camera
I still got this problem. 😯
Using a custom material is overcomplicating this. You don't need a custom material unless you're doing some kind of special shader stuff
just a basic Image component with the default material would work fine
Z should be 0
UI is drawn in hierarchy order, from top to bottom. Things at the top of the hierarchy are drawn first, at the bottom last
The image shared is tiny and impossible to understand what's going on
In order to create a better explanation of the problem i found the solution. One element was masked which made it looks like the draw order was off. So thanks 😄
nvm figured it out
i used a deselect event trigger on a button which only works when i press any other button, how do i make it so that deselect event trigger works when i stop pressing the button?
not sure what a "deselect event trigger" is exactly but you can use the "OnPointerExit" and/or "OnPointerUp" events if I understand what you mean
nvm i just used pointer up and down and it works now
Anyone able to tell me how I might be able to get this tiled scrolling background I made to only be visible within the heal bar's background -- for example a mask?
My assumption would be that I can use a sprite as the 'area' that will contain the texture
Does anyone know how I'd achieve this type of UI Button effect? (hit play and look at the "Equipment" soft golden glow)
https://www.youtube.com/watch?t=253&v=t_bLZNf4ldI&feature=youtu.be
I can't figure out if it's shader stuff, VFX, or animation, so I don't even know what terms to search for
I'm using text mesh pro and after looking here : https://forum.unity.com/threads/change-color-of-a-single-word.538706/
And here
http://digitalnativestudios.com/textmeshpro/docs/rich-text/#color
I came up with this:
_calandarDateText.SetText($"{"W" + _playerData.CurrentWeek }" + $"{"<color=#FF0000>/D" +_playerData.CurrentDay.ToString() + "</color>"}");
and when I open it in the inspector in game I see the text field of the component change to W1<color=#FF0000>/D1</color> but for some reason the second half isn't red...
Anyone shed a little light on this?
I think it's because I'm using a font file? but I don't know why that would stop the tags from working
it is a tmp_pro font asset
Hey yall couldnt find the "right" channel but i think this is the closest. I am wanting to make a "card" but it has a weird shape (see attachment) How would i go about making a card take that image without the white? i tried making a 3d object the shape of the card and applying it as a texture but the texture splits into 4.
Do you want the card to be 3D or UI?
If 3D, you'll need to model it to the same dimensions (or proportional), then UV it to use that image as the texture. You can project it directly down onto the mesh and manually align it.
Hey folks - just posted this to the Unity forums, but thought might be relevant here - I've been working on a free, open source Figma importer and just released
You can check out a WebGL demo here with some features - https://simonoliver.itch.io/unity-figma-bridge - if any of you are Figma users, would be great to kick the tires a bit and find any issues
#502171626805133312 / #502171717544968212 to showcase your work
Got it, thanks
is this the right place for questions about post processing?
no #💥┃post-processing is
why is my canvas visible in the game view?
why wouldn't it be?
im talking about the outline
because you have Gizmos enabled in game view
oh thanks
Does anyone know why these text are shown in the editor and small game preview but when I go maximized they disappear?
Quick question, there's no reason to use Legacy Text right?
So you should always use TMP?
Probably has to do with scaling, do you've your game window on free aspect?
(If you do, probably don't?)
Yes
Thought so, thanks
GetPrefferedValues doesn't seem to do anything? It has worked before with single lines/words but apparently it doesn't like a whole paragraph? Anyone ideas on how to solve this?
using TMPro;
using UnityEngine;
public class GetPref : MonoBehaviour
{
[ContextMenu(nameof(Start))]
private void Start()
{
TextMeshProUGUI text = GetComponent<TextMeshProUGUI>();
text.GetPreferredValues(text.text);
print($"{nameof(Start)} has been run");
}
}
(The print does run)
Without the parameter for GetPreferredValues it also doesn't work
(Please @ me if you respond)
My usual go to when I try to do more advanced stuff with TMP is the original tutorial collection on YouTube, I think it is listed in the manual on asset main page too.
you likely haven't actually placed them in your canvas
My text looks good in game but really crappy in editor.
Anyone got an idea?
I had to reinstall my PC and switched from 2022.2.1f (?) to 2022.2.5f1
Okay, i reinstalled the TextMeshPro-Ressouces. Now my text that has no outline configured has an outline.
how do i change scroll bar scroll speed for dropdown
Since I have moved this question several times, I will just post the message link here. I am hoping for someone familiar with scrollbars and content size fitters to be able to provide some useful information about what is going on here. Any information is appreciated. c:
#archived-code-advanced message
There are multiple steps that could be the error.
So youre adding a new text in the hierachy. The content fitter should position it in a way that the position is visually below the last message. So first message is at -100, second is at - 200, third is a -400 etc. depending in their height. Does that happen correctly? Are the elements in the inspector even if they are not visually correct, logically correct?
Then there's the content panel which should increase in size with all added elements. Does the content panel increase to the correct values?
All the scrollbar does is fit it's values to the size iof the content panel.
@zenith mulch the content panel is not scaling to fit the child content size fitter
why does these text keeps shaking?
Well, for a start, that explains why the scrollbar doesn't act like you assume it would and why your script code does not work. So, are the positions of the text elements correct? Does the last one go out of the bounds of the content panel? Do you have a vertical layout group and is it set to increase the size to fit its content?
You also need Layout Element on your text. The vertical layout and content size fitter of the parent use that.
I already resolved it by making a new panel that uses vertical layout and many UI text. But was there a better solution? For future convenience 
how do i change the size of ui with bigger res
canvas scaler
How are you supposed to have a Horizontal Layout Group whose children have auto width? Each child is a game object with an Image component, who then has a text object in it with a Content Size Fitter component with Horizontal Fit set to Preferred Size. I can't figure it out...
Am I doing doing thing wrong with importing an SVG for a button background?
How to fix text mesh pro is blurry?
keep the scale at 1,1,1
How can I make an image behind the button and make it as child of this button?
EmptyParent
- NewBehindImage
- Button7
then move/resize EmptyParent etc
However, I want to make an animations and I can't understand how to make the animations for parent and brothers. I know how to make it only for child. Do you know another method to make an image behind the button.
i don't understand this sentence or what the animation has to do with anything
you can make your animator animate any object you want
Hello guys, I am looking for some nice GUI-assets. I want to use it for a fantasy game (PC). The most GUI's in the assetstore are too casual or have bad reviews. Can you recommend some assets? It should not be too cartoony. Thanks!
https://cdn.discordapp.com/attachments/1033929408790155274/1071528324922343545/image.png
So... the selecting thing that is usually here is gone
Idk what its called but its the thing that lets you select the alignment
anchor presets are completely gone on some objects
with no explanation
Hey everyone,
It's been a while since I used Unity (about 1-2 years).
Back then the whole UI situation was quite unfinished and I used the UI system that came after the IMGUI one.. not sure what it was called.
I want to start a new project with the latest tech, what's the currently recommended way to build UIs in Unity in 2023? I am shipping my games to desktop, mobile & console.
UIToolkit will be the UI future for the whole of Unity, but it has major limitations right now that make it only suitable for specific projects. UGUI gets the job done otherwise.
Oh, okay, UI Toolkit is still not production ready, then?
I believe I used Unity UI (UGUI) on my last project but I was not exactly happy with it.
Would have hoped that the new system was ready after so many years.. okay.
Thanks for clarifying
Is UIToolkit supported on consoles?
Can somebody please tell me why is this happening?
Its m,y TextMeshPro doing this, whyyy?
Keep the scale at 1,1,1 and the font size above 1
Why does adding/changing the outline and underlay of a text add/change it for all other texts in the scene?
It’s a shared material
Question, is it better to change UI images using the width/height or the X/Y scales?
width height. you almost never want to scale
Hmm, so what's the reason for that?
unless you're making like a.. tweening effect
scaling will affect children
quite bothersome to work with
and another reason i'm not sure about, it'll cause the quality to detioriate
Ah, okay, thanks for the clarification then! I'll keep that in mind
How can I rotate Textmeshpro text by 90degrees when the RectTransform is stretched using Anchors? For example I want to have the "Position" text be rotated. But if i set a Z rotation of 90; it rotates the whole box so no longer the right size/position.
Using the <rotate> tags on the text only rotates the letters individually.
Is there really no way to change the step value of an slider for controller? I've been searching for days and I can't find it
i wish i knew how to make nice looking uis lol
watched a video on it so i know some basics, ... i guess ill just keep it super simple since this is the first game prototype
trying to make a compendium ui with entries on the different locations and creatures you can encounter etc
i was going to just show/hide different groups of texts and images depending on what is selected but theres probably a better way
Is it possible to disable certain characters in tmp text?
How can I center the last line of images? I can't find it
GridLayoutGroup with 1 column constraint, then give each row a horizontal layout group
so something like
GridLayoutGroup
-Row
--HorizontalLayoutGroup
----Image
----Image
----Image
----Image
-Row
-- HorizontalLayoutGroup
----Image
----Image
----Image
----Image
I was beginning to implement some UI side of things and I was curious. A lot of beginner tutorials have you put a canvas on enemies/player units and then apply their health/mana/energy/whatever bars to them individually as prefabs
Is this not a bad practice and shouldn't I be looking more towards making one canvas that contains all character UI?
No
Multiple canvas good
Many small canvas. One thing in canvas changes, only one canvas gets refreshed. Refreshing not so heavy
Was just whooshing by. Good day
Does anyone know why this canvas element would be rendering at 60px width?
The health bar thing
This is what it looks like in the inspector
oh wait I'm silly
the canvas was scaled despite me disabling the canvas scaler
nvm
hello guys i wanna ask why i cant hide my canvas ?
is it bug or something?
my version is 2021.3.16f1
i try it multiple time but not working
Can someone help me figure out how to make a health bar with a slider, the type fill method isn't there and I have no idea how to get it, because rn the health bar (that actually fills) just moves left when you increase the slider.
You shouldn't use a slider
use a filled image
You will see image type (including filled) once you assign a sprite to the Image component
How do I use a filled image?
^^^
just set image type to filled then you can simply play with the Fill Amount
ah okay thank you!
Is there a way for TMP text to go right to left when displaying text instead of left to right?
You mean like changing the alignment? Have you looked in the inspector?
I'm having issues with a scrollbar. There is only one method that changes the value of it,
but when calling it the first time, the scrollbar resets to a relative value instead, and it has to be called again for the scrollbars value to be properly set to 0.
Is this some in between frame inertia of the scrollbar value of some sort?
public void Wake()
{
StopAllCoroutines();
canvasGroup.alpha = 1;
scroller.value = 0;
}
void HandleNewMessage(InsightNetworkMessage netMsg)
{
GameObject msg = Instantiate(messagePrefab, contentWindow.transform);
TextMeshProUGUI messageText = msg.GetComponent<TextMeshProUGUI>();
ChatMsg message = netMsg.ReadMessage<ChatMsg>();
messageText.text = message.Data;
switch (message.Channel)
{
case var value when value == LocalName:
HandleLocalMessage(msg);
break;
case var value when value == AreaName:
HandleAreaMessage(msg);
break;
case var value when value == WorldName:
HandleWorldMessage(msg);
break;
case var value when value == PartyName:
HandlePartyMessage(msg);
break;
case var value when value == GuildName:
HandleGuildMessage(msg);
break;
default:
Destroy(msg);
break;
}
if (message.Channel == currentChannel)
msg.SetActive(true);
Wake();
}
In fact it seems like the scrollbar is permanently one message behind, despite the wake function being called after the message has been handled and added to the content view
I ended up just making a Coroutine that waits a single frame before changing the value and it solved my issue.. strange behavior
A raw image is always rectangle.. the sprite you apply to it can be any shape
then how can i make the render texture circle
by... making pixels in the shape of a circle
Either in an image editing software or in your code I guess
btw there are circular minimap tutorials out there
is there a way to make ui text always = a variable without running it in update?
you mean something like calling updateUIText(text) whenever you want to change it?
How can I make ui show up on an object? basically unity equivalent of roblox billboard gui
try canvas > render mode > world space
just set it whenever the text changes.
like how sliders have "on variable changed", but for text
you can make your own C# events and UnityEvents
oh wait, I just realized. not like slider, the opposite of slider
yeah, I'll have to dig around
a slider calls something if it changes. I was looking for something to change the text if a variable changes. a way to do it that isnt update or manually setting it when I also change the variable, which is what I'll end up doing if I can't find a way to do what I'm trying to
you want to add a listener for it, it sounds like.
maybe? I'll look into those!
never used them
neither have I tbh.
You just want a property
I will look into those as well, thanks
...ok so how do I do this? presumably with horizontal layout (or grid layout, seems to be working for me?) I want to keep all the cards within the box as I add more. Once there will be overflow I want the spacing to decrease to keep it to that constraint. There's probably a formula based on the total cards, but I can't figure it out.
horizontal layout group does allow spacing to be dynamic, grid doesnt
Hi there, how would I use a material with a shader graph for a TextMeshPro Text?
For the old Text you could give it a Material and attach a shader to it, with TextMeshPro I don't see that option
i have an image that looks like this. my intent is to put it in the UI, then put real + and - buttons on top of the image, and have those buttons work. but when i press the button on the UI and it greys out it looks like this, so I guess it goes behind it?
well you're just seeing the actual image behind the button as the button becomes transparent
why not just get rid of the fake button in the image itself
ok so i guess i wanna make it grey out without going transparent
but i guess the right way to do it is to just properly make my ticket cost window
found the formula: (boxWidth - (cardCount * cardWidth)) / (cardCount - 1);
I'm trying to make a menu GUI pop out but it's going behind other GUI elements; I can't just move it below in the hierarchy or anything like that as other objects around it pop out on hover as well
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.
like I said I can't move it in the hierarchy like the solutions are suggesting
why not? is it that when the words are hovered over or clicked, they're supposed to pop up in front?
if so why can't you move it to the bottom of the hierarchy on hover or click?
how do you do that?
event trigger
yeah but how do you move it down
transform.SetAsLastSibling(); , aaccording to what I linked said
Hello!
If you have a minute, I'd appreciate it if you took at look at my Customization UI, any feedback is appreciated!
https://www.youtube.com/watch?v=ogQLvPf5hks
This kind of question belongs in #archived-works-in-progress
canvas mode doesn't matter - just set the material on your Image or whatever you want to set it on
But can I position the ui image at particular position on screen without canvas?
UI Image requires a canvas parent
eh?
Hey , i have these spaces on the sides of the keyboard any idea why?
I am using text mesh pro
seems like an Android setting to me
thank you , is it from unity side? it's happening on 3 different phones or text mesh pro
what settings should I change? I can't find any settings related to keyboards or something
Hi all, I'm trying to implement a settings menu in my game where the user can scroll through items using the keyboard/gamepad, and have the menu move so that the selected item is always visible. As you can see in this video right now, if the user selects an item outside of the scroll rect, the scrolling simply doesn't follow. My research so far suggests that there isn't a built-in solution for this, and that I'll have to write a script (or use someone else's script) to get something like this to work. Before I get started on that, might anyone know of a faster, more plug-and-play way to do this with Unity?
I'm trying to implement some skillshot indicators and make the artwork for them. I was curious if anyone had some experience with this type of situation or had some insight. I wasn't sure if when designing the art for something like this what length I should make the image and then how to manipulate it. Like should I simply make one image for all skillshots and then simply stretch or shorten it depending on the range of different abilities? Should it be cut into two different images, one for the body/tail and one for the ending/head portion?
Can I get someone to help me create a text asset for Chinese , Japanese , Korean text support please? I had 3 most common versions at once and still only got 50% of my game to show Chinese text , I would very much appreciate it
is it possible to have 5 inch diameter circle sprite on any resolution or device
Only if the display reports accurate DPI data:
https://docs.unity3d.com/ScriptReference/Screen-dpi.html
Many devices don't report DPI information or report inaccurate information.
ok if I get the screen dpi how can I set the scale of sprite based on dpi?
How can I fix missing characters/glyphs in Chinese text?
Need to fix this so I can update with more language support
isn't just a matter of using a font with such support?
I'm using 4 as fallback assets and I'm still missing characters
As PraetorBlue said, I think that just means all of your fallback fonts still don't cover the whole range of characters you're trying to use?
I asked about this a little earlier in the chat but wanted to check again: is anyone aware of a way to accomplish scrolling behavior in a Scroll Rect like this? https://youtu.be/SaYqOcgiacE?t=133
I'd like to let the user scroll through a menu using the mouse, but if they use a keyboard/gamepad to select an item in the list, it scrolls the Scroll Rect to ensure that the item is visible.
Let's take an in depth look at the Nintendo Switch's home screen and settings.
Don't forget to ► Like ► Comment ► Subscribe for daily gaming videos!
► Follow me on Twitter: http://www.twitter.com/Arekkz
NINTENDO SWITCH SCREENSHOTS:
https://www.youtube.com/watch?v=TjmFzloa1yA
NINTENDO SWITCH ADD USERS:
https://www.youtube.com/watch?v=Tmp4FTH6Ea...
Do you have any information on what font asset(s) I should use? At this point I'm just downloading and trying them at random.. 3 of my 4 are supposedly the most commonly used fonts
Nope sorry 😦 If you have all of the text files with the text you’ll need to display there might be tools that can tell you whether or not fonts contain those glyphs
The difficulty with languages like Chinese is that there are so many glyphs, so it’s much harder to make a complete font
when i use a scroll rect it instantly bounces back to the beginning position. how can i fix this?
nevermind figured it out. forgot to enable content size fitter
hey the camera for ui overrides the post processing settings for the main camera even while the volume mask on UI layer only, any quick solution to fix that?
How to press 2 UI buttons that overlap with each other?
When I click on the part where they overlap, I want them both to execute their unityevents
what is fade duration in a button component?
put another button that execute same events on top of the part where they overlap
the duration of how colors fade when u interact with the button
How do I hide a grid programically?
Was checking out some Scroll Rect stuff today and I'm not quite understanding the elastic parameter for the movement type. In the videos I'm watching, it seems like it smoothly scrolls to either end, but mind is rubber banding back to the original location (which, id honestly expect to happen under this setting)
https://gyazo.com/9e848a8e8c60cdf1af45334627a3e36b.mp4
obviously setting it to unrestricted is not what i need either -- but is there some setting here I messed up to cause this behaviour?
Aha! I needed to use a Content Size Fitter component to set the preferred size of my window to the correct axis 👍 I have never heard of this component before.
This looks fine and normal? Am having some scaling weirdness
Alright, now any way I can set this so that when I add new items, it stays anchored at the top? Tried everything I can think of so far
oh im being silly i just wasnt pressing shift all the way down :p
Anyone know what this code's doing wrong? Been stumped on this for days.
It takes a GameObject's transform.position, which would be that of a world-space virtual cursor that follows the mouse, and tries to see if that cursor is over top a UI object that's also rendered in world-space. I've removed any code that reveals secrets about the game I'm working on, since I'm under an NDA.
public bool TryFindRedactedAt(Vector3 position, out Redacted redacted)
{
note = default;
if (MainCamera.Camera == null)
return false;
Vector3 screenSpacePosition = MainCamera.Camera.WorldToScreenPoint(position);
var eventData = new PointerEventData(EventSystem.current);
eventData.position = screenSpacePosition.DropToVector2();
var resultList = new List<RaycastResult>();
noteRaycaster.Raycast(eventData, resultList);
if (resultList.Count == 0)
return false;
foreach (RaycastResult result in resultList)
{
if (result.gameObject.TryGetComponentInParent(out Redacted prospectiveRedacted))
{
redacted = prospectiveRedacted;
return true;
}
}
return false;
}
When I click on the UI element in the world, I run this method to see what I've clicked on.
Result list keeps coming back as empty though
Unless both the cursor and the UI element are really close to the middle of the screen. Like the cursor position is in the wrong coordinate space
But I thought GraphicRaycaster expects the position to be in screen-space, and that's what the code is doing - translating the in-coming GameObject position from world to screen space
Is GraphicRaycaster suitable for world-space UI? Should I be using something else?
Why? Why not just use IPointerClickHandler
This seems to just be reimplementing built in functionality
Because our game has an object-locking system, and in this case, I do not want the UI element accepting any direct user input until the player has acquired a lock on the world object it's representing
And I also want to ensure that it supports a virtual cursor, one driven by a gamepad's joystick for example
Which means I can't necessarily rely on mouse/touch events
Idea being the virtual cursor activates the UI's "editing" mode by acquiring a lock on the world object, and then we can either use pointer events or navigation to further interact with the UI
Naturally it's hard for me to explain why I'm doing this without breaking my NDA which is...frustrating...but yes, there's a reason I'm doing it this way
I just wanna know what the code's doin' wrong
Hmmmmm....by any chance...is GraphicRaycaster aware of RectTransform scales?
One of the weird hacks I did is I set either the scale of the UI elements themselves, or the canvas they're in (I forget which) to 0.01 scale
Otherwise they render EXCESSIVELY large, taking up the entire in-game level space
The new input system has support for this
Of course
Maybe it does, but remember, there's also the object-locking thing
I'm not convinced that you shouldn't be using the normal event system stuff
I'm not sure I understand this but sounds like it could easily be handled by some small code logic
The idea is, you click on the UI element, and the game tries to acquire a lock on it for your current player number (this game is multiplayer). If you get the lock, THEN the UI becomes interactible
if (isLocked) etc
Yeah that's just code.
Yes. But I don't know what to lock if I don't know what the cursor is over top of
That's what IPointerClickHandler is for
It isn't going to work here. The UI in question doesn't have direct access to the world, and it shouldn't. So it can't acquire a lock on itself.
This must be done by an in-game level editor tool
That'd...then require the UI element to have access to the world manager, which I don't want, because I don't want UI having a dependency on the world
UI should be reusable
It can just fire an event then
To invert the dependency
Then it's completely reusable
I...just wanna raycast into the UI....
Another reason I'm doing it this way is
I only want to be able to click on this specific UI element type when the edit tool for it is active
And the best way to deal with that, without forcing the UI to be aware of the edit tool's state, is to have the edit tool do a raycast.
Im trying to make a main menu and the buttons wont click can anyone help
Im new to unity btw
please help
Can someone help me regarding world space scaling
https://stackoverflow.com/questions/75431579/convert-pixels-to-world-space-units
!learn
🧑🏫 Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/
I have a scroll view on mobile devices, and one thing that I've noticed is that when I try to scroll with my finger at a higher speed, the scroll view's velocity clamps far below the speed that I scrolled, making for a very unnatural feeling when scrolling compared to native scroll views
is there a way to fix this?
My scroll view has elastic as the type and the deceleration rate is at 0.135, which is default
Can't edit outline on textmeshpro?
Because that's the material?
I think
You have to scroll up for the instance
it was because I was using a mask with scroll rect
Fixed :)
Still struggling to get this code to work
What coordinate space does GraphicRaycaster expect for its Raycast method when the UI is in world space?
Question: i have this little menu UI that open and close when i click the setting button but i also want the menu to close when i click somewhere else outside the menu so how would i detect that ? the menu uses an animator component with a trigger
how do i make text overlap every object ?
Honestly, the easiest thing is to have a hidden button that stretches the entire screen behind the drop down that, when pressed, triggers the animation to close.
Otherwise, you have to deal with the event system and checking for what's been clicked or not, and if you're in a specific state (drop down opened)
Use a screen space canvas
Or if you want it in the world, use a separate camera to render only the text and stack it (URP) or set the depth to be higher (Built in pipeline).
chatGPT literally just gave me the whole script working lol
this is beyond amazing lol
Can someone help me with my problem?
For some reason my mouse offsets when using UI through a render texture displayed on an object. Screenshots don't pickup where my mouse is so I drew it.
At first I thought it may have something to do with the screen being curved, (I have no idea look I'm a beginner)
but I tested on a flat object and that wasn't the case. I am utterly stumped.
My ui itself is set to a camera which overlays onto a base menu camera. Then the texture renders the menu camera and the game views the render texture through another camera.
Only problem is, while the camera is projected on the tv, the ui itself is still native to the regular screen position not the one projected on the screen. How do I make it so that its clickable on a render texture without this weird offset?
i always get this info box in my content size fitter.
But how could i get rid of this?
Its in the ButtonContainer, but i need the button to grow with the Button text.
If it's working properly just ignore it
Okay 😄
It does, but i got the problem, that the vertical layout group in the ExplanationContainer just puts everything on top of each other at startup.
I fixed it with LayoutRebuilder.ForceRebuildLayoutImmediate(); but im not sure, if this is a smart way.
Someone here know how I can make a custom "hitbox" for my image. because now the half of the screen is the hitbox for the image and I only want to have the round image?
The raycast area on UI is the size of the RectTransform.. so resize that
Also, when using UI, press T to use the UI gizmo tools
Okay, but then how do I change the rect transform that its round?
you cannot
If you want the graphics raycast area to be exact to the image shape.. there is no built-in way to do that
I found a way I think, I just can rotate the image so its faced to the side so I get my angle
Yes, thank you dude 👍
I've just discovered the difficulties with working with EventSystem, in particular with trying to process the cancel event to close a menu when nothing is selected. Other than the pinned post, has anyone created a list of known pitfalls with Unity UI? I'd rather not discover more issues on my own, if it can be avoided.
Hi everyone, new to the server! How can I make it so no matter which button I'm hovering over, it stays on top? Similar to overwatch 2
UI is sorted by its position in the hierarchy, so Transform.SetAsLastSibling() should pop the UI element in front.
Omg thank you!! it worked
