#📲┃ui-ux
1 messages · Page 4 of 1
the hearts are anchored to top left and the other meter is anchored to top right
can you show their anchoring in the inspector
and also your canvas scaler in your Canvas
set your reference resolution to an actual 16:9 resolution in your Canvas Scaler
set width and height to 1920 and 1080: the UI shrank and still does the same problem
same problem
it's like the canvas is staying the same size
when I go up the resolutions the UI goes closer and closer to the bottom left corner
when I get that UI problem and I switch to the scene it looks like this
so the canvas is changing size with the resolution change, and the anchors are correct
do you think it might be a parenting issue
if the game is not playing and i change the resolutions it snaps correctly it just screws up when the game is playing
is that a Unity setting maybe?
Drag the game screen out of the tab and resize it yourself to maybe get a better idea how they are moving
it's acting the same, if I change resolutions during gameplay, meaning the resolution settings in the top left of the Game window, the UI goes wrong
if I resize and drag it around on the original resolution i set, it stays in the corners just fine
if I change resolutions in the drop menu, the ui messes up
same thing is happening when I hit full screen on my game on the web page
New dumb question! I have an object with a vertical layout group, and I'd like the children to follow one after another, with no spacing between them. However, when I hit 'Play', the objects are automatically laid out vertically with an equal amount of space between them, which means they are not laid out vertically adjacent to each other.
just play with all the settings on the vertical layout group
one of those checkboxes does it..
(you can do this while the game is running to quickly experiment)
Yeah, have been playing around with it. Can't seem to get it to... rrrrgh...
Still trying to get this to work. I must be missing something obvious, there's no way this isn't possible with the UI system... Very frustrating.
95% sure it's the "force child expand" checkbox
Yep
works when that's disabled
With it on you get this
Ah, but when I have that everything overlaps.... =/
This is so flippin' stupid. Up until today I would have said I was reliably capable of handling the UGUI. Rrrg.
Setting the Vertical Layout Group to 'Control Child Size: Height = true' means that nothing is overlapping. Really goddamn confused by this.
It's working, but I'm not especially happy. But thank you, @mortal robin .
sooooo, update on my anchoring issue, I remade the canvas (works good), remade the heart meter (works good), put when I put in my panic meter, which is a slider with scripts on it, it starts being wonky again
I put a blank slider in, still working fine
as soon as I made the hearts inactive it all broke again
i don't know if scripts are doing it or what, I'm not getting any errors
am I not using a namespace I should be or something?
I think that's it, as soon as scripts are involved it messes up the positioning for the UI elements
i don't know why
I FIGURED IT OUT
I can't believe I did this hahaha
I added a UI shake to the code
it saves the original position when the UI is created
so changing the resolution screws up where it is in that code
how do I save it's anchored position
I was using it's regular transform position instead of its Rect Transform
but it's still not working
so my situation is I need to save the Pos X and Pos Y of the Rect Transform but it doesn't seem to be doing it
I guess this is no longer a UI question
Hi, I want to create a shadow of just my outline, and not my image, so that the shadows of both don't overlap like in the picture, how do I do that?
Nevermind, had do swap my shadow and outline component around, now it works 👍
hey,
my canvas is filling the whole screen in play mode, but that its not what I aim for, Im looking for a way to limit it to a computer screen. in side the scene , how do I do that ?
you'd need to use a world space canvas
I did that but I have noticed that I need to resize every child the canvas has, so instead, I've created a gameobject and made it parent to the canvas and scalled that gameobject down and that is it, it does look as if it worked but I dont know if that is the right way to do it, is it?
Hello, my scrollview doesn't work if the canvas render mode is set to "screen space - overlay", but works if it is set to "screen space - camera". Any idea why?
No idea why it works as Camera, but where is your event system?
Here:
Hrm. I'm interested to know why it would work in one and not the other... maybe you can gleam some information when in play mode by looking at the preview pane at the bottom of the event system when hovering some stuff?
You mean this, right?
Yeah. That looks alright at a glance. I sadly have no clue, but maybe someone else will with this info
Thanks for trying to help at least 🙂
is there an easy way to make unity synchronize the EventSystem's selected object with what the mouse is hovering over? it seems intuitive to me that hovering over a button would make it the selected one, but that doesn't seem to be the case
guys will too much UI drain fps?
Another question I have. It looks normal in the editor, but wrong in the game?
Pull out the game window and resize it manually and you'll find out why
do you mean scale it to 1?
What I'm trying to say is that your elements are being modified by the aspect ratio/resolution of your game
You can usually resize your game window to get an idea how it's all being positioned.
i see, thanks
Is it possible to mask an Image under multiple Rect Masks?
is there a version of GUILayout.box that outlines the content instead of darkening its background?
how can i mask out my ui so that my character doesnt shoot if im just clicking somewhere over ui
Is there a way to make it so Unity does not automaticlly disable canvas?
I am working on a Scene switch between one of our Lvls and the main Menu.
The main menu has a video background and an canvas in front for the Buttons and overlay. When I move from one Scene to another (within the game) it disables the Canvas with all the buttons inside wwhich I do not want.
Hello. Why does the text written in Russian disappear when half of the object is behind the camera, but this does not happen with the text written in English?
Is there any way to make a UI element with a scrolling texture like this? https://gyazo.com/e31f1ad245415d2ac91d0a4682dc448c
apparantly shader graph doesn't work with UI
it does though
how do I fix this?
From what I've noticed the part that breaks it specifically is having it on sprite mode tiled. Maybe the two things I'm doing doesn't mix well together.
use tiling from fragment and not from the vertex maybe
ive got a lot of tiling and wrapping on my mobile game and it works fine
hello there, we started using the device simulator included in 2021 to adjust our different devices and resolutions and it would become handy to know by code if we are inside the device simulator or not, is this possible somehow '
?
Anchor things to the corners, not the center
Do I anchor all the objects in the canvas or just the canvas itself
You can't anchor the canvas itself, it changes with the screen
You need to anchor each UI element to where it makes sense to anchor it
If you're searching for something by the base class of the objects then it'll return everything that derives from it. If you extend from the class, usually you can reduce the amount of searches.
Hi how i cen add whole psb img's to ui? so i dont have place it from 0
can i make frame be shown at front while keeping this hierarchy?
Lower in hierarchy = drawn on top
hierarchy is not an option
Then you are stuck with this render order
Why not just make the border image live on a separate object which is a sibling of the portrait
hahahaha exactly what i did in other instance when had same problem
thanks for reminder
well just look
Anyone know how to fix TMP_Text from looking slightly pixelated/blurry in-game? I've tried many suggestions from forum posts but nothing seems to make a difference. Everything looks great in the Scene view. My game display is set to Full HD 1920x1080, I've set my Project settings to use this resolution, my Monitor uses this resolution, I'm using a World Space Camera with a width/height of 1920x1080. I've tried using the default Font settings, then upping the Font Size, and messing with the TMP Atlas settings when creating the Font, but nothing seems to make a difference.
Have you tried it with an official build? I notice it does look jaggy when scaling it the simulation, but I've not really notice the issue in the build.
Yeah, that picture is from the Build. It looks bad in both game view/build.
anyone please
The fix is still the same. Anchor to the correct corners and align them to those anchors
You don't anchor them all to the same corner.
whats the best bunch of video tutorials out there over an hour long?
I have changed canvas to screen space - camera to get a particle to work, but not my text has gone, does text stop working when its not longer on default space
Text works with all canvas types
Note that your plane distance is 100 so you probably just have other objects in front of the UI
Thank you i also notice another issue maybe not right channel but my particles are running at different times, but i have no delay set
How to show FX on UI canvas, That don't show my FX. I tried something but on other hand i see my FX but not my game...
how would i have it so the transparent parts of the ui actually act transparent and aren't black for some reason"
and by transparent i mean theres a gap between 2 images that i want to see the background from
question, and apologizes if this is in the wrong channel,but is there a button to expand all of an armature at one time?
nevermind
its alt lol
Can someone tell me why my icon dissapears when I apply horizontal layout?
I basically have a button with an icon to left
But then what would I do for the objects in the middle?
Do I anchor them to the nearest corner?
then anchor to the center..
You should be anchoring all things to the closest point that it makes sense to anchor them to
recttransforms not being the correct size of the image.. maybe
it worked thx sorry for me being so dumb I am not good at UI at all I like programming more thx a lot
UI doesn't need colliders
what colliders do you mean
like the hitbox where you can press or whatever its called
The green squares are colliders.
UI doesn't need a collider component.
They're also not alligned correctly
it doenst have a collider component
that game object doesn't, I'm sure there's more than 1 game object making up each one
All UI elements should have a scale of 1,1,1 and use the height/ width to resize
i checked and none have a collider
wait why sorry am so new to ui
because it fucks things up, and there's no need to change the scale.. the height/ width are there to change the size
one more question where would this be anchored the scroll view is supposed to fill the screen
aight but what about the coliders
if you change the scale of something, then change the scale of a parent...that child won't scale correctly
what about the colliders?
the green box that is the area u can click to toggle the button whats it called
i mena that
I can't see your hierarchy to know why those colliders are there, or what they are on. They should not be there. Find them and remove them.
Do you mean a button component?
are they colliders or area that you can click to toggle the listeners of the button
Never have this set to 'free aspect' when working with UI
You're working with mobile, why have you changed it off the device sim?
this is the hieracrhy and none of them have any colliders
Use stretch for things that are full screen
disable shopppUI and see if the green squares are still there
now there is nothing
now enable shopppUI and disable mainUI
I'm kind of expecting you to look beyond what I say and work some things out... look at the top/bottom values in the inspector. set to 0
ok
it was like that originally mainUI was disabled and there is still no green boxes
It's not going to be "change 1 thing and everything stays ok/ works" .. you have to engage ya brain and update things to work with the correct way to do something
so what's enabled when you've got those green boxes ?
put t:collider in this search box for the hierarchy
did and no buttons or any of shopUI
or any of main UI as well
its not a collider am 100% sure
i didnt just randomly add it
its just button padding
why is it off was my question
Buttons don't have green squares¯_(ツ)_/¯
mine do 😄
Change the scale to 1,1,1 and update the height/ width to the correct size
it changes the button size and messes up the aspect then only the green box extends 🤣
right.. because the parents scales aren't 1/1/1
You have to go through ALL your UI and change it to 1/1/1
i set them all to 1 but with this canvas i cant why
oh cause its scale with screen size stilll that shouldnt be a prolbem
i am so confsued
Yeah, the canvas being like that is fine
You can only change the canvas scale when it's set to world space
then i have no idea why it odenst wokr
nor do I, not got enough information
That'd be great, but won't help with this issue 😄
Do a screen recording to show me each inspector.
Select the ShopppUI -> wait 2 secs -> select bg -> wait 2 secs -> select BuyPet1 -> wait 2 secs -> carry on until the last child of BuyPet1
Need to see the hierarchy + scene view + inspector
scroll down on the inspector if there are components off screen
first part gyazo lets me record for very little
all the other buttons are just copies so i just needed to show you that one
Yep, they're not prefabs though - you should look into prefabs if you don't know about them already
the buttons, anything you have multiples of
i just ctrl c ctrl v
so you can just change things in 1 place and have it update in them all instantly
oh you mean learn about them
yeah i know and prolly shouldve done that when i look at it
doesnt matter i give up on the problem ill figure osmetin out
thanks for the help anyways
Also, press T and use the UI tools when working with UI
The RectTransform for your text is massive on the width.. I'd change that so it doesn't extend beyond the button it is on
set the padding back to 0
where
Text gets hit by raycasts too.. the RectTransform for your text goes over all the buttons... resizing it to be within it's own container will stop the possibility of the text blocking the raycasts incorrectly
can i just disable text cast raycasts?
Yes
But you should still resize the recttransform to be the correct size anyway
yep
It's good to untick 'raycast target' on anything that doesn't need to block/ be hit by the raycast
IT WORKS thank you so much bro
you took literally 1 hour of your day to help some random stranger ur a legned
🙂
Can I ask why preferred size is locked in content size fitter
I cant reduce my button any further than this width
You will see its greyed out in width above
I absolutely hate the unity gui as someone new to it
coming from Figma this feels like hell

because it's being set by a layout (Horizontal/ Vertical/ Layout element)
or content size fitter
Is there anyway to adjust it? The content size fitter is set yes but that essentially has no settings to adjusr
adjust
I set horiz to preferred size
but it seems to just create some arbtrary preferred width or size I cant change, which is 180px above
Hello, my scrollview doesn't work if the canvas render mode is set to "screen space - overlay", but works if it is set to "screen space - camera". Any idea why?
and another tip for desining UI
set your game view to some fixed reference resolution you like to design your ui for
Finally fixed it, the problem was that my panel_shop had an z of -50 and so I think that the overlay, which only enables z coordinates of 0 or above to be clicked on, if I am not mistaken, didn't react to any input
I've asked this before but is there any way to control how much something scales with scale with screen size
instead of it scaling 1/1
At larger screen sizes the ui looks toy sized
giant ui
There a way to make UI builder go from like camera to worldspace? I want to use to for health bars above enemys heads
If not is there something else I should be using that can "format" the shapes and text and things really well also?
should i use ugui or ui toolkit for a fps game
Ugui has been used for many games for a long time. UI toolkit is new. You can research it (they have a sample project) to decide if you want to use it.
hey i have a question. For my unity project I have multiple canvas's for different gui's. So i might have one for the shop, or one for a warning message. Is this good or is it bad?
multiple canvases is generally good
it's more efficient to update each smaller canvas
The LayoutElement component allows you to set various sizes for preferred/ min/ max/ etc. I don't use it often enough to know if that would have sorted your issue, but I think so. How did you sort it ?
UI Builder is for UIToolkit .. #🧰┃ui-toolkit
hi, how this animation are done, i can make it in After effects and implement in unity?
https://www.youtube.com/watch?v=SDdRZd0vh7s
I have never done it, but a quick google results in some info: unity how to import after effects
Ow thanks, will take a look into it
from this searchs its basicaly a png sequence
doe sthis look good this is my first time making a menu
nice
Is there a way to use UIDocument in the world renderer instead of needing to take over my screen?
If you have a canvas that is set to scale with screen size
is there any way to actually select certain items to not behave in this way?
For eg: I want this chat box to not look giant sized when you start getting beyond 2k
put them on a different canvas
Hey guys, any idea why my rawImage is completely transparent?
In fact none of my raw images are showing up. Sprites are fine though, any idea what this could be?
MIght have fixed for now, though no idea what going on there still
Im trying to make an element stretch to the current aspect ratio
but when I swap aspect ratio this happens:
The rects are "flipped" offscreen, rather than staying within the screen canvas
Im using canvas scaler with the correct reference resolution
I am so confused as to why the text shows in scene mode but not game mode when i play mode
Most likely it is not active or something is turning it not active like a script etc
Hopefully I can explain this... I had a player UI prefab that was a gameobject with a canvas and the actual ui as gameobject(s) within it. I wanted to create prefabs of the inner gameobject (so I can support swapping them). I am sharing the object with the canvas (acts as the parent) as the UI requires a canvas obviously. But now that I separated my inner prefabs they are not directly visible in the editor because they aren't wrapped by a canvas. Can I place a separate canvas on those inner prefabs without any grief?
In particular the issue is the camera is a property of the canvas which is why I don't want to swap the parent.
Hi is there any way I can do font conversions from a spritesheet to a TMP Font.
I know there's the option of converting it to a sprite atlas, but the current spritesheet I have consists of numbers for a score, so if I would need to increment it would be quite annoying, since I would have to convert a number like 31 to <sprite="3"> <sprite="1">
If text is entered into an inputfield, the text doesnt change to the second line if the first line is full of characters.
I also increased the size of the inputfield, but it stays the same
Also hprizontal oveflow is set to wrapping
But when I play it changes to overflow again
I have a panel, Width being 800, Height being 600. On some situations, this is too large.
I want to make this scale to the screen width, but cap it at 800x600
Is there a way to do this?
hi
should i keep doing this?
Im coming to the part of my game when i need a UI, both for menus and some user input.
Im fairly familiar with unity's UI but i find it to be messy. (Especially working with grids(?) And their children)
Whats you guys opinion on it? And is there any alternatives?
why is this white thing in background,
when i added 2 layers, one background and one foreground
It's an image ...? If it's supposed to be transparent, make sure the art is actually transparent background.
i solved it, without knowing how
Is anyone here good with custom UI and the animations/coding after art is finished?
I am seeking to find someone to help me get a custom UI
@unique forge You can post for jobs and collaborations on the forums. #📖┃code-of-conduct
hi, someone help me pls, how can i use blending mode in unity? m use 2021.3 vers
Does anyone have any good UI framework recommendations? I've been using https://github.com/yankooliveira/uiframework for awhile, but Unity gives me trouble when instantiating UI prefabs at runtime -- the alignment at runtime always looks different from the prefab even after tinkering with the anchors.
guys a question that i dont understand the answer to...so UI elements need to be under a canvas... but in my game i need the text to follow a sprite ... how do I do that ?
do I have to create a canvas under each sprite i need to make ?
Any of you fine lads know the difference between the character validation types in the TMP_InputField class? The documentation is empty and doesn't display descriptions for them.
https://docs.unity3d.com/Packages/com.unity.textmeshpro@1.3/api/TMPro.TMP_InputField.CharacterValidation.html
Is there a way I can make a button target graphic only its sprite rather than the whole Rect? I think that changed since I used the new input system, now some buttons are overlapping which is annoying.
Hello, does anyone know if there's a way to draw an arbitrary diagonal line between two points in UI toolkit or IMGUI? Either framework works but I would prefer UI Toolkit. I would prefer to draw a spline over a line if possible as well.
How can i apply multiple Rect Mask 2D on one element?
I have an image that moves along the screen. Then I have multiple Rect Mask 2D that are separated. I need that that image is visible when passing by a mask. Usually you just make the image a child of the mask object. Thanks in advance.
Hello I am using Lean Tween to animate my Ui I heard that it performs really well but whenever I run these pieces of code I run into major Performance issues
public void Open()
{
show.transform.LeanScale(new Vector3(4, 4, 4), .6f);
}
public void Close()
{
show.transform.LeanScale(Vector3.zero, .8f);
} And
Item.LeanRotateZ(-10, .4f).setEaseInBounce();
Any guides out there for making UI work properly for common ratios?
how come the zoom in the editor slows down to a crawl seemingly at random
extremely annoying
its like it sets a new focus point and not allowing to zoom past a certain point anymore
hey there can i post any Ui related questions here?
Any is a broad term, but that's the topic of this channel, yes.
when is this "selected sprite" used for a button? I had it set to a really noticeable sprite and it never changed to it.
anyone please
When the button becomes selected
I really wasn't looking for a smart ass response man
Can't manage to do this, even with layers or separate camera (UI & Player)
why isnt my ui showing up?
because you've got your eyes closed?
(No one can tell you why it's not showing without any information as to what is happening)
hey! i have some issues with my uiManager script, basically i have my manager for my gameOverMenu whichs i enable in the uiManager, once it's enabled the uiManager makes the menu play an animation
my menu has a button to reload the scene, but once i reload the scene my menu refrences is set to null, why does this happen?
here is my UiManager script : https://gdl.space/acudoqexof.cs
What should I make of this?
Every single RectTransform emits this warning when I enter play mode
No stacktrace
SendMessage cannot be called during Awake, CheckConsistency, or OnValidate (ActorHealthBarsCanvas: OnCanvasHierarchyChanged)
Ah, maybe this is caused by NaughtyAttributes
this is supposed to be centered but it's aligned at the top for some reason, how do i fix this?
is there a tutorial on how to set this up to align properly?
"how can I show a button like it is pressed, any ideas?"
I posted this on code-general, but it seems like the question is for here
Is something controlling the height of that object's transform? (H Delta or Height may be greyed out in your Transform inspector)
nope
it's specifically that font, other ones work fine
some button sprites come with a pressed version, in which case you switch to the pressed sprite on press
there's a button for that in the button component
How could I disable click and drag scrolling from the default UI Scroll View?
Oh lord, if I uncheck Vertical/horizontal before runing the game, the scroll bar appears but doesn't work, even if I check them at runtime. But if I check Vertical/Horizontal before running the game, they work toguether with drag to scroll functionality, but if I uncheck them at runtime, drag is disabled and the scroll bar works
Is this suposed to be working as intended?
Its happening again.
1: the menu looks ok in the editor.
2 the menu looks ok first time in the game.
3 when i close settings and open it again in menu, some of the elements go behind the background...
Hi all, is there any way I can put my sprite in front of the button?
And for the button, I want it to span the size of the yellow grid size, without any text. Is it possible to do that?
sprite sorting order is based on the order of the menu on the left
and for spanning the yellow grid size you just have to make it stretch to is parent
bottom right
I tried reordering it, but it kept defaulting back to this order
I tried to drag the button on top of the object sprite, then clicked "open prefab," reordered, and it still went back to this order
ah okay i got it to work somehow, but now my edited prefab is no longer blue (turned grey). how can i get it back to the blue?
gotcha, and is there any way to remove the "button" text?
basically i just want the player to be able to "click" anywhere within the yellow grid cell (which is why I thought of a button), but there doesn't need to be any text present
oops i got it! just had to change the button's image to "textmeshpro"
Hey UI experts. It looks like TMPro renders characters with the right most character on top. Is there any way to make the left most character render on top instead? pictures can be found here: https://www.reddit.com/r/Unity2D/comments/yynbpt/unity_textmeshpro_render_sorting_order_issue_can/
Nevermind for now, I think I found that I can just rotate the UI element 180deg and the rendering is how I'd like. Just need to create a backwards font and display it backwards now too
No idea if this is the right channel to ask (pls lmk if its not), but,
I want to get a TextMeshPro text (just in the world, not on a ui canvas) to, given a font size, display at the actual scale of that size as if it were being printed.
So, a 12pt font would be 0.00423 meters from the descent line to the ascent line.
Looking at the font and it's FaceInfo struct, I can get the sampling point size of a font as well as the metrics for its ascent and descent line, but have not been able to find any information as to the conversion factor between those metrics and actual world space.
Using the default LiberationSans typeface, I can see it has a default sampling point size of 86. If I place the descent line at 0, then when rendered at TMP fontSize = 86, the ascent line extends to roughly 9.6m. This sorta tracks with the fact that this distance is 96.07 in the font face info metrics... but why is it divided by 10? Where does the 10 come from?
Apologies as everything I know about typography at this point has just come from trying to solve this problem, but,
What in the world are the units on TextMeshPro font assets and how can I convert them to meters so I can use them with the rest of unity?
(it looks like maybe I need to find the "units/em" used for these metrics, but where do I find that? Looks like this might explain the weird factor of 10 from before, but no idea)
What do any of you recommend for learning how to make a good looking UI
use websites like https://flatuicolors.com/ and https://color.adobe.com/create/color-wheel
where can I find ui ux similar to this style
how can i make that button's background transparent?
Use a transparent image
png file has transparency
does anyone know of a good tutorial on layouts? i kind of understand them but not really, so i find myself just clicking buttons until it works kind of how i want it to
can i make TMP text position and size itself according to the display size, like a panel?
Look at the two links posted right above you. Also the Canvas Scaler component
Does anybody know if there is a Spinbox Component available anywhere? For the life of me I cannot find it. Seems like a very basic UI component to me that should be available somewhere.
UGUI has no built in Spinbox. it has Dropdowns
so I have this button using a USS selector "focus". So it turns "Yellow" to indicate that it has been selected but when I click the "play audio" button it takes the focus off, how can I prevent certain buttons from removing focus? (the play audio button has its focusable property set to false by default too)
https://gyazo.com/5d41ecb48cb29ce278c5de4920f7e4df
this is a circumstance where I would basically not rely on the event system's concept of "selected" which is extremely simple, and instead implement my own
How can I do this?
Done something in c#
Got it figured out I think
directionBtn.clicked += () => selectDirectionBtn(directionBtn);
private void selectDirectionBtn(Button directionBtn) {
deselectSelectedDirectionBtn();
selectedDirectionBtn = directionBtn;
directionBtn.style.borderTopWidth = 2;
directionBtn.style.borderBottomWidth = 2;
directionBtn.style.borderLeftWidth = 2;
directionBtn.style.borderRightWidth = 2;
}
private void deselectSelectedDirectionBtn() {
if (selectedDirectionBtn != null) {
selectedDirectionBtn.style.borderTopWidth = 0;
selectedDirectionBtn.style.borderBottomWidth = 0;
selectedDirectionBtn.style.borderLeftWidth = 0;
selectedDirectionBtn.style.borderRightWidth = 0;
selectedDirectionBtn = null;
}
}
why is this in a different position when the rect transforms' are the same
I am noticing that the canvas scaler for a horizontal layout group is causing craploads of memory allocation for me when I change fill amount / color of child UI images. If I turn off canvas scaler = no allocs (can change fills / colors just fine)... anyone experienced this?
please anyone
Hello, I have a question, how can I show several 3d objects on a canvas?
I'm making an inventory with 3d gems that rotate and I don't know how I can show them in my inventory. I'm using urp as pipeline.
Typical approaches are:
- Use RawImage + RenderTexture
- Use RawImage + RenderTexture + VideoPlayer
- Use a spritesheet animation and a normal Image component
Oh, and one thing, this I going to use for each 3d gem? Because appears for example 30 gems at the same time in my inventory, in this case, how is a better form?
This gems is a 3d objets with a mesh render
Hello, I think asked this question in the wrong channel cause I wasn't getting any responses. Hopefully, this is the right one.
Any help? My camera currently looks like it's positioned above my objects but the view shows it looking at the objects from below. How do I readjust the camera's position? I can only adjust the angles and zoom in or out at the moment.
where do you see a view looking at objects from below?
I see a view of it looking at the mountains/sky
which seems to match with the gizmos in scene view
Bottom right corner shows the camera looking up at the car and box object I believe
I could be wrong though but it seems like it's looking at the objects from below. Sorry for the crappy image quality.
just make sure your tool handle poosition is set to pivot and your tool handle rotation is set to local
and you'll get an accurate view of the position and orientation of your camera.
I can't really see from your image what's going on
what could be preventing my text from appearing?
UI works when my pause screen is on
You're using the mesh version when you should be using the UI component
Oh thank you
I feel like the UI version should be the default one
oh well I guess it goes against the name
Changing the tool handle position to pivot seems to have done the trick. Appreciate the help.
my player cant interact with world space canvas buttons (or anything else on the canvas), is this normal, and are there workarounds?
Hello I think asked this question in the
Make sure you have working EventSystem, which you can also use at runtime to debug pointer raycasting (extend it on the bottom in the inspector) and see what is in the way of the UI. Also see that all components are present, like a raycaster on the canvas.
You can use a new scene to test how it suppose to work then debug your current setup.
i've never used an EventSystem before, thanks for the info, ill go research about it and see if i can get one working!
Here's how event system debug window looks like https://stackoverflow.com/questions/46850003/unity-canvas-button-not-working
ok thanks a ton!
ok ive followed all the steps found in that handy link, still nothing working sadly, even when im certain im hovering over the button it still tells me that im not hovering above anything, how unusual, and ive made certain that the button is definitely a raycast target, couldn't work out how to check if anything is in the way of the ui though
Make sure canvas has graphic raycaster. That is also why I said to create one on the clean scene, because everything you need will be added by default and will work out of the box
yup, all i did to get this worldspace canvas was to press the create button thing in the menu, which creates a default canvas, and then switched it to worldspace (with a bit of rotation and resizing to get it in the right place), i dont think my setup could get much defaulter
Collider could be obscuring the raycast if you don't get anything in eventsystem
ooh perhaps, ill try those debug draw line things on a raycast and see if anything is blocking my camera's racasting
You can also add 3d or 2d raycaster depending on your objects, on the camera and it will tell you exactly which collider it is hitting in world space
ooh that sounds simpler than my strategy lol, ill try that thanks!
That's the component https://docs.unity3d.com/2022.1/Documentation/Manual/script-PhysicsRaycaster.html (these go on camera)
hmm this component appears to be quite complex, atleast i dont understand how to use it, so i think i may just use the debug line drawing things instead, cause i atleast know how to use them lol
You add it to a camera and it will capture pointer events from colliders, like if something in-front of the UI EventSystem will then tell you in debug window exactly what it hits
oh ok fascinating, ill try that thanks!
You use it generally to turn colliders into pointer interactable objects
ok fascinating
also im not quite sure how to read the event system debug thingy, is this good?
you just need the one that tells you which object pointer is hovering over
which one is that?
pointerEnter is good enough
ok, and how do i use this PointerEnter then?
At runtime you mouse over the object and look at the inspector
i already did that, that is the screenshot
The game window must be active
Pointer position tracking must be active at the very least
how do i make that active?
Make sure you've clicked on the game screen at least and see it tracking mouse position.
and see what tracking mouse position?
i really feel like im missing something obvious lol
huh, my settings look pretty much the same as far as i can tell (except im in 3d), but none of that mouse tracking is happening for me
old input manager, i really wanna use the new input manager, but only later on, for now i just wanna get a basic something working
i have a feeling im doing something catastrophically wrong lol
At the very least EventSystem will always be tracking pointer position. So if that doesn't work make sure you are using at least the old system
Player > Other Settings > Active input handling
ill check that thanks!
also do the thing with entirely clean scene, add clean components and see how they work
If that doesn't work then something project wide misconfigured
then i wouldnt have a player to even be able to test if it worked
cant find the Player thing, where is it, sorry im quite a noob...
Ctrl+Shift+B Player settings bottom left
yes
and i dont think my scene could get much defaulter, it is a simple rigidbody based player, a map that consists of a floor and some walls, and not much else
Do this step
When it does work examine your components
ill try, but am i atleast allowed my player in this clean scene?
you only need a canvas in world space with some interactive element and event system
ok, il try it and report back
ok what the hell, it works, for seemingly no reason it seems, welp that tells me that in my main scene either normal cubes or my player are breaking it somehow
ill test my player first and see if it breaks it, brb
huh, ye my player breaks everything, weird
all it is, is the keyboard axis grabbing stuff, some custom gravity, and the mouse axis stuff, dont see why this should be breaking everything
if your event system doesn't register any pointer movement, it won't be sending any UI interaction events. Something could be manually setting pointer or its event data to -1,-1 there every frame.
You can test if the scene itself has something that is doing that by turning off everything and running it with just event system
perhaps, i doubt it would come from my scripts though, unless i did it unintentionally, before this conversation i hadn't even really heard of the event system
One probable thing that is happening is that you have component somewhere deleting and creating event system constantly. When it was suppose to make just one that it was on the scene...
perhaps, but like i said it wont be something i made, cause ive pretty much never used the event system before this conversation, any components known for doing that kinda thing?
It doesn't matter where it is coming from. You narrow down where it is by turning off everything testing and gradually turning it on.
yep, it is my player, i know that much now
im just tryna work out why
i know im doing something terribly wrong, but i aint got a clue what, are there any commonly used functions known for affecting the event system perhaps?
Now that you've narrowed it down to a script, do the same for the script itself. Comment out everything and find problematic line.
i shall try, thanks so much!
wow, i got so lucky, the first line i tried was the problematic one.... ```cs
Cursor.lockState = CursorLockMode.Locked;
locked cursor can still raycast, only in the middle of the screen.
so if you are locking it you need to point it with the camera instead
im afraid im not really certain what that means, im quite a noob
Here -1,-1 is the left bottom corner of the screen though. I think it's possible to lock it and set it in the middle so you can use camera as pointer
ok that makes sense, so i just need to set the cursor position to screenwidth/2,screenheight/2 then?
yep
unless there is any unity inbuilt method, guessing im gonna have to do a bit of dll interop to set the cursor position (meaning a different function for each operating system, but i suppose i can deal with that using #define)
ooh unity does have an inbuilt method, yay, albeit with the new input system!
or you can raycast manually to the center
also a possibility, but anyway thanks so much for all the help!
For some reason my text mesh pro doesn't have any fonts
Make one then?
Ok I was hoping I wouldn't need to since I was planning to use Ariel for testing. Thanks
Ok I found out why no fonts showed up, for some reason TMP never popped up the first time set up menu that imports fonts
world space buttons are really buggy in general ive noticed, you can only click them on the very outside, no matter where the cursor is, nor whether it is locked or not, this is most unusual, are there work arounds to make them more easy to click on?
also another oddity, if you hover over a button, and then just keep your mouse still, it wont let you click on the button anymore, and the hover colour dissappears,
a simple, albeit odd solution is to randomly change the mouse position by 1 pixel each frame, back and forth, it still makes the mouse be in roughly the right position, while still allowing buttons to be interacted with, very jank though lol
Hello everyone, I have 2 canvases
They're both 1920x1080 and have UI elements suchs as buttons and such in them.
However, when clicking on the 2nd display, it also clicks at the same position but in the first canvas....
It seems like they overlap for the Event system.
Is there a solution to this issue?
Thanks in advance!
"2nd display" are there two monitors involved here? I'm confused
The 'game' tabs inside unity with 'Display 2' selected
I have 'Display 1' and 'Display 2' game tabs in the unity editor
and when clicking in the second display it also clicks the first display at the same position
As if the canvases are on top of each other
So you have two different game windows opena?
yes like this
idk could be a bug in the editor
I've never worked with such a setup
Is the idea that the final game will be multi-display?
Yes
Ok - yeah I wouldn't be surprised if there's bugs with that, it's a somewhat obscure feature
Not sure if there's a workaround
Like, two people on the same computer but clicking on different stuff at the same time, because the monitors are touch
Well, if someone knows a solution for this issue please leave a comment, thanks!
https://answers.unity.com/questions/1611750/2-cameras-2-displays-all-ui-events-seem-to-go-to-o.html
This is pretty much what I'm facing
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.
Okay. I have no idea why this happens, but I was trying to create a settings menu when I experienced this odd bug in which if I select another option in a TMPro dropdown, the menu does not close and the previous option is still selected. It only closes either when I click out of the dropdown, or select the same option twice. Any fix to this?
I'm trying to make a UI Panel which grows/shrinks to fit whatever is inside. So example if I put a 200x200 image as a child, then the Panel would be 200x200 to fit it.... I would think this would be using Content Size Fitter, but that doesn't seem to do this?
did you set it to preferred size on horizontal and vertical?
Preferred size on the child?
For example I want to have a Panel which contains a grid of images up to 3 across. I may fill the grid with any number of images. Each image will be 200x200. The parent panel would resize to fit however many images are in the grid.
what did u put as Content Size Fitter
I put the Content Size Fitter on the parent panel and tried all the different settings (unconstrained width, min, preferred etc...)
Put the parent panel is not adjusted in size
As you can see the image in this example is set to size 100 x 100, but the panel is not expanded to fit it
The first image is the heirachy. Just Canvas -> Panel -> Image
so Panel has Content Size Fitter?
Yes
try putting a vertical layout group on Image
then enable force expand on both width and height
sorry, on Panel
Hey, how can I programmatically create text? (scene doesn't have canvas)
textmesh component prob
Game that I'm modding doesn't have textmeshpro
you ain't even making a game ? bruh.. ask the game devs then because around here there is no help for modding
Modding a game will require you to do things specific to that game, no one else here will have experience with it, thus they won't know the way to do things for that game mod.
While you won't get help on how to do specific mods for that specific game.. you may find the odd person who'll have an abstract chat about modding.
If by "modding" you mean you've ripped the game and decompiled it.. then no, you won't get any help.. that's against the rules to talk about.
I just don't understand what the difference is. For example, let's say I'm making my own game. I don't have textmeshpro. How do I do that?
I know that making a game and modding a game are two different things. But as far as I know, modding doesn't change anything in my case.
If you're making your own game, you would just add TMP to the project..
Sup ! I'm using a UI panel with a RectTransform. I instantiate it on Update() and I try to access this component but it is null. Weirdly, I try to access it on ONGUI, and it is not null ! I kinda need this info on the same frame that the object is created. WOuld be weird to wait for 1 frame before setting its properties.
please show code
First image is on Update(), second is on ONGUI (all in the same frame)
Correction : It is not null after all, simply not initialized and seems to retain default values
Sorry, code :
(RectTransform)object.transform and GetComponent<RectTransform>() don't return anything different in my case,
please dont crop so much out. can't see any context to your code. See #854851968446365696 on how to post code
I want to see how it's instantiated and what component you're accessing
and where you're checking the values
pretty much the same
Hello, does anybody knows why is the button "hitbox" so big?
Like, i can click the button without even puttin my mouse on it
Use the rect tool and adjust the rect
your problem I believe is that your image has a bunch of empty space around it
You need to edit your image to remove the padding
yeah in fact you can see in the bottom right of your video
that is has a bunch of empty padding
You can also check the "Use Sprite Mesh" checkbox in the Image component
that way it uses only the sprite mesh and not the full rect
I believe you can also make the mesh "tight" in the import settings for the image
lots of options here
Hi!
I heard having everything in my game in one canvas is bad for performance, is that true? And can I put multiple canvas children inside one canvas to fix it instead of needing to have multiple different separate canvases?
I can't speak for performance as I've never encountered any issues with UI, but I only have 1 canvas and then use multiple panels that are activated/inactivated when needed, for example inventory, dialogue etc. The canvas also has a HUD panel which remains active, but there's only a few ui elements on that.
wondering if there is anyway to make a smooth scrollbar, as the default limit of 11 steps leaves the scrollbar feeling quite jerky?
another oddity, when trying to set a RectTransform's position to 0,ScrollBarThingy,0 it somehow messed up the x and z, and refuses to set them to 0
the position you see in the inspector is going to be:
- In Canvas space
- Local
.position is world space position
oh whoops, welp thanks so much for that!
Hey, I set all my UI for full HD and wanted to change it so that it's adapting to the resolution. Is there any tricks to it? Basically change everything so that all positions are at zero playing with anchors?
The tricks are:
- Pick a setting on your canvas scaler
- Layout your elements using the anchoring techniques in https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UIBasicLayout.html
Thanks 🙂
hi i am having a hard time fixing my text size and configuration, it appears very stretched and not sure how to deal with it
What happens if you try another font?
similar effect strectched
is one of the parent objects scaled weirdly up the hierarchy?
basically none of the objects in the hierarchy should be scaled manually
oh ye the dialogue box(background box) is stretched
yeah that's your problem
you shouldn't size UI elements by scaling
how wouldi go on about making it larger then?
you should size them via the rect
use the rect tool
and/or set up anchors and pivots
ah its fixed tyy
There are a number of bugs in this screenshot that I'm being infuriated by trying to fix
- The "Display Resolution" text is not vertically centered with its dropdown despite its parent HorizontalLayoutGroup alignment being set to MiddleLeft and the correct height of the container being reported
- If you look at some of the text in the main scroll view (where the dropdowns and toggles are), you'll see that the text is cut off ever-so-slightly on the left. This is DESPITE their layout being automatically calculated by vertical layout and horizontal layout groups, and their X coordinates all being set to 0 as they should be.
This is particularly noticeable with the "UI scale" text, where it almost looks like "JI scale"
- The text in the dropdowns are misaligned compared to their highlights
Does anybody know what's going on?
Hi everyone, I'm trying to successfully 9Slice images but I'm having trouble making it work, any help is appreciated
I have 9 slice set up like this atm and am trying to stretch this button... I have it set to FullRect, applied it, added a spriterenderer, set that sprite to both the spriterenderer and the actual image component, and set the image component to sliced, but it's turning out like this
Its simply ignoring the actual things I want to stretch, can anyone let me know what I'm doing wrong?
this is when I resize it
okay nvm i tried it again and it suddenly is working fine now...?
Just like this person
I find this really funny for some reason. The UI selection can move from the game's UI to a random prefab I happened to have open in Scene view
No I got it, what I forgot to do was change the Pixel Per Unit
Thank you though’
Still, don't change the scale of UI. All UI elements should have their scale at 1,1,1 and you change the width/ height to size it correctly.
Press T to swap to the UI scene tools
Thanks for the advice
Hey, I'm not understanding why the canvas scaler has to be matching width OR height, and why wouldn't be able to do both. Does it do that to respect proportions? You can use anchors to set the object to be proportional to the screen size (in both directions), why is there no options to do that with the canvas scaler?
I can't actually set one UI for all resolutions this way, if I match with width 9:16 looks wrong, if I match with height 21:9 looks wrong. Or am I supposed to set the value in script according to the aspect ratio?
you could set it to midway between the two, but the results may look kinda silly
The reason is when the screen stretches horizontal for example, you want a choice between it moving things and scaling things. Same for vertical.
It does aha, I'll try to set so it scales according to the aspect ratio, so match width if the aspect ratio is inferior to 16:9 (for example 9/16 < 16/9) and with height if superior (21/9 > 16/9), seems like the most reasonable thing to do
Tbh, I don't think there's a way to make an UI with 16:9 aspect ratio look good in 9:16 anyway, should do a custom UI entirely for that
what if i need to scale something on the ui via code though?
i'd rather use transform.localscale than start messing around with the width and height
scaling UI elements typically has bad visual results though
wait really? if i scale an UI image? does it mess it up?
It depends why you're scaling it. Doing some animation ? Fine, scale it from whatever to 1, and from 1 to whatever.
Not having a uniformed scale on all the UI will mess things up and not display correctly.
Hi there,
I'm trying to make a UI component that's basically just a rectangle that sits inside the Rect Transform's bounds, with a material attached that renders that material, UV 0,0->1,1
I imagine I need to draw a rectangle in an 'OnRenderObject' method or something but all I'm getting is a big red 'X'
There are no 'DrawSquare' routines in the 'Graphics' class where I'd expect them to be- is there a higher level library that can draw shapes directly?
If you're getting a red X then it's back to front
Just an Image component is all you need
It's a component, like I said
I see it - it takes an image and a material
What's the image for? Is it passed on to a texture slot on the material if one exists?
Thanks guys
My UI unrounded itself, at least thats what It seems like because everything is now square. How can I go about fixing this
UI (when using the Image component) is only round when it has a sprite, that is round
then to get help you'll need to show the hierarchy, inspectors, etc
So yea the issue is that the UI for some odd reason unrounded itself. This happened after I added the discord game SDK, and I dont think that would cause it
guys, i wanna ask. how to create map in unity ? not a tilemap, cause when i search in google it's always show tilemap or minimap. i want the map can be draggable and it can be zoom in out
for open world games
What the heck? Discord game SDK caused this issue, odd
for example when i want to make a button go bigger when you hover over it, i just scale it to like 1.1f. and then back to 1 when you stop hovering. that's perfectly fine right? won't affect the quality of the textures or anything?
whats the correct setup for in my case vertical layout group I cant get it to scroll normally, either its completely unrestricted, not scrollable at all or snaps back to starting point when what I want is scroll down to last element no matter the size
nvm everything works correctly when I use content size fitter on container itself instead of parent with scroll rect warning saying I shouldnt use it on container threw me off but it doesnt work any other way so idk
Yes, this is fine to do.
The problem with different scales arises when you have lots of uniformed scales and try to change children.
eg:
- parent scale 0.5, 0.285, 0.258127512
-- child scale 0.214, 0.2451, 1.24
--- child 2 scale 0.124, 0.5235, 0.5643
This kind of setup would cause problems.
why does the ui look blurry when i render it on camera compared to overlay
- Whenever i put tiled/9sliced image to my canvas (screen space - camera, scale content for target resolution), it shrinks to f#cking nanometers size for idk what reason. After enlarging it remains so small that only center is seen. How to avoid it?
On screenshot, there's a comparison of the result image and a single tile of a tilemap
- Solved. It turns out canvas size is measured in units, not in pixels, so pixels per unit setting is different from the world
i have a complex prefab for a powerup item that has moving parts and animations, and i would like to display it as part of the ui during the instructions screen so the player knows exactly what the powerup looks like. i have tried everything i could find on online forums, and nothing seems to work, it always displays behind the ui when i set it as a child of the ui object it should be placed on. is there any way to do this?
Are you trying to display non-ui elements on the UI?
yes indeedy
you'll need to either use a RenderTexture and RawImage with a separate camera to get it to be a real UI element
interesting
Or do some tricks with screen space camera or world space canvases to physically put UI behind the object
i do have a screen space camera at the moment
but i messed around with the positions and order in layer to no avail
then just set the plane distance farther than the object's distance to the camera
ok it seems that may have fixed the issue
tysm!!!!
the object appeared to move along with the canvas as i increased the canvas plane distance, but at a certain point, it displayed...
strange behavior lmao
are you in 2D?
If so try turning off 2d mode and viewing things from the side - it should become clear what's going on.
yeah i was looking at it in 3d mode
check the Selected color for your buttons
show how the button is configured
Aight
Wait
Did you mean by configured, the inspector?
@mortal robin
Looks like you're using an animator - I presume the animator is changing the colors then
I see
Thanks so much
How would I use masks to make only the white part invisible? I was trying but it just made the green part behind the middle white circle the only visible part.
so you want to mask out the green one?
I want only the green ring showing
why not have a sprite with a ring then?
So do you want the green thing to mask the white circle or just show a green ring?
I just want the green ring. I figured being able to change the proportions of the ring rather than using a pre made ring sprite would be better but idk maybe that was a bad idea
I would go with a premade ring to be honest. Fiddling around with custom masks is no fun. The standard mask from unity does not provide like inside/outside masks, it only masks the children to what the parent image is
Oh well. Thanks for the advice.
Just make it big enough to look nice and you can reuse it on multiple part sif you want
How do I fix this happening when I set TMP to Raster Hinted? This is in a separate project from my main one which had the same issue. This happens a lot and I can't find anything on how to fix it.
Anyone?
Hi - I'm looking for inspiration for a "your turn" animation. Requirements - the entire animation has to be about 1.5 sec (or less).
No one?
ui channel mad dry 
is there a way to scale panel but keep its initial aspect ratio other than through calculating size from screen width and height through code
ty
Hey, I'm overriding the sorting layer of an UI element to be above another one, but the one below still catches the raycast. Is that normal? I thought the raycast hit the layer that's on the above layer. Is there a way to sort that outside of orders in the hierarchy?
wht kind of ui element is the top one? Is it a Graphic of some kind?
I just tried with 2 images in a test
public class RaycastSortingLayerTest : MonoBehaviour, IPointerDownHandler
{
public void OnPointerDown(PointerEventData eventData)
{
Debug.Log(this);
}
}
Might be cos I'm using the new input system
Ok there's something really weird happening actually. If the image has a canvas and its sorting layer is overriden, the other image gets the raycast, even if it's below in the hierarchy
Nevermind, the object with a canvas on it doesn't even catch the raycast at all
Forgot to put a graphic raycaster on it, thought that was automatic 🤦♂️
yeh it's only automatic if you create the canvas from the GameObject menu
Any idea why deleting the text object of a button prevents the button from working?
Really confused why the text would be required for it to function
Please
As long as their is some sort of graphic (image component by default) for the graphics raycast to hit.. the text isn't required.
wrong channel, you were pointed the correct one before 🤔
oh whoops...thought I had forgot to hit send and it didn't work...I was just in the wrong channel 😄
Then why does it cease functioning when I remove it?
I dunno, you haven't given any information for us to work it out
Using my magic 8 ball says, you've done something wrong
how do I make sure different components don't overlap when I change the type of phone or even to an ipad?
how do I go about making text stay where it is, and not moving?
I got this text here, but I want it to stay there, and not move
nvm got it
Guys, i wanna ask. How can i create interactive map like this? It can be set a point, pinch zoom, and draggable.
I already search for tutorial, but internet sugest me a minimap not a map
Or world map with pins
How would I check if the player is in Landscape or Portrait mode in my game I see the auto rotation in unity but it doesn't seem to scale correctly? (Yes I do anchor everything)
anchoring, layout groups.. lots of testing. going from phone -> tablet is sometimes better to have 2 different sets of UI
Don't have anything changing the position ¯_(ツ)_/¯
Anyone
My UI behaves like I want it to, but I need to update any field in the editor for it to update and go to the right place.
Any ideas on how to get over this problem ?
Canvas.ForceUpdateCanvases(); // didnt do it
LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
did work
In TextMeshPro text objects, is there a way to use the <mark> tag behind the text it draws on?
Or a similar tag
Nevermind, I was able to find a work around. Apparently this is a feature that will eventually be added into TMP default, but that was posted by a Unity employee more than a year ago.
I downloaded some assets, is there a way to fix the blurrieness for the white outline, or is that just the asset?
hey so i have a public tmpro and i want to set a float to be the text displayed and i followed several tutorials but when i went to assign the tmpro to the component slot, it wouldn't let me do it. Any reason why not, it says Text Mesh Pro in the grey area where you assign external things btw.
any reason why this isnt working
Unlikely you're actually using a TextMeshPro
You should use TMP_Text
TextMeshPro is the world space version.
TextMeshProUGUI is the UI version
TMP_Text covers them both.
Hello, I'm making my own game and I can't figure out the UI, I get it like in the picture below, but I need it like this: (3rd picture)
- enable mipmaps on the import settings (select the sprite -> tick the mipmap flag in the inspector)
- make sure your game view isn't zoomed in
- make sure all of your UI (except the canvas itself) is at a scale of 1,1,1
So where would I put the tmp_text
when showing characters in a typewriter-like effect and using text mesh pro in the page overflow mode, how can I check check when the typewriting effect gets to the last character of a particular page?
depends how you're doing the typewriter effect
it increments a value every few frames, which is equal to the amount of characters that are visible, however it does not stop when it gets to the next page, so when I switch pages after waiting a few seconds after a page finished being typed, then the next one is already partly or fully typed in
hope that makes sense
I was more asking to see code
I guess knowing which character id is the last one in a current page would solve it
Do your Text objects span over multiple pages?
yes
I wouldn't even understand how you did that 🤔
an example of how it looks
what does it do? Scroll? How do you paginate that
here it is in motion
I just increment the page number, and the issue is I can't find a way to check what the id of the last character on a page is
so the typewriter effect just carries on regardless
no, I mean what is the id of the last character on a page, like, if there is 10 words on page 1, and 15 on page 2, then the id of the last character of page one should be 9, and page 2 it should be 24
yes
So... this struct exists... https://docs.unity3d.com/Packages/com.unity.textmeshpro@1.0/api/TMPro.TMP_PageInfo.html
Not sure how to grab it though 🤔
Oh I think you have to get the TextInfo first
and PageInfo is a property on that
so it's like myText.textInfo.pageInfo
sweet, now it does show me that needed character
will now check if it works with the typewriter like I hope it does
it seems to be working, though some numbers are off on my part, so will tinker on that for a bit
thank you for all the help!
guys I think this is the best place to ask my question
so
as you can see i have created a table... yet the tmp text isn't accessing it ... doesn't even see it... how do I change that?
Sorry, this is a better example -- How do I get these TMP Texts to appear on top of the images? I cannot find anywhere to access z-indexing for these.
UI element layering is determined by position in the hierarchy
Right they are each within their own cell in a grid layout, so I can't quite figure out how to get the text on top of the next grid child without messing up the grid sorting
changing the sorting here to Upper Right works for example but then theyre all pushed to the right
Could work.. will work.. hm
Reverse the grid order is another option right?
You can do that, right? If you change the start corner to bottom right
Probably kinda weird for your inventory code...
This looks kinda ambiguous anyway. You sure you want them to overlap?
Yeah I'm going to play around with the spacing more, I actually exaggerated it to show it more clearly in the image, I do want them slightly "popping out" I think and they were overlapping by a few pixels
I can't quite find that actually, unless you mean to play around with the child alignment
The solution is going to be to put the text inside and ignore it kek
can someone help me with this?
Quick question- is there a UI grid snapping tool in unity? or is this directly tied to the grid snap in scene view? I notice some snapping happens when two elements overlap but not with the canvas space itself. Like say i want to snap ever 2 units on a 1920x1080 is that possible?
how would i get an image in code, it seems they are not called Image?
UnityEngine.UI.Image
Your IDE should tell you this if you have it set up correctlyy
Well, you'd have using UnityEngine.UI; at the top, and then just declare Image. But yeah, having your IDE setup correctly would auto suggest/ do this for you
Hey everyone, I am looking to make a cool transition between my scenes something ismilar to the sponge bob one.
https://www.youtube.com/watch?v=I50cWpN3G7Y&ab_channel=SISIGELAP
ofcourse the theme of the game is dark etc and I will make something that suits it.
But what are your suggestions, what tools should I use?
Another Idea that I'd like is the transition "Jetpack Joyride" uses where a door closes and the reopens.
thank you!
and thank you!
Hey guys, I just started working with UI stuff in my game. For some reason every time I click something under the hierarchy of my Canvas, the Canvas borders disappears from the Scene. It makes it really hard to line stuff up. I don't see this happening in any of the tutorials I'm watching, and I dont know why this is happening! Does anyone know? I'm using Version 2021.3.15f1.
It's driving me insane
also I can't click on the Image under Canvas, I have to actually select the image in the Heirarchy before I can drag it around
Nevermind I sort of figured it out, something to do with Layouts
Hey! I am trying to make a wolfenstein style weapon wheel. Can anyone suggest a good tutorial to look at? I feel most of the inventory Tuts on Youtube is a drag and drop system etc
IPointerClickHandler is not checking the clicks correctly
seeking for help about canvas and pointerclicks on the thread
Container has vertical layout group, and other four buttons have an image component whose alpho is full 255 and its white, but I am unable to see any while background, this happens after adding vertical layout group in the container
How can I fix it?
How do you include effects in a UI?
I am about to make a screen that appears after finishing a game.
For that I want text, objects and buttons to appear after a certen event. Just making them appear would look pretty boring so I want some animations/effect for them. (Like the text should come like a twister)
2D Game
guys I tried to put a canvas on a sprite and made it worldspace render mode, and picked up the event camera.... I PUT A BUTTON INSIDE OF IT AND THE BUTTON WOULDN'T WORK.... where is my mistake please (I put a debug and it is not showing anything because probably the button isn't being pressed)
Add a GraphicsRaycaster component on it
thank you
YES THAT WAS IT .... THANK YOU
SO MUCH
I would have wasted sooooooooo long more
Hello, I'm currently using TextMeshPro to render my main menu title, with a custom _FaceTex texture, and I'm wondering how I can make the texture repeat/tile instead of stretching. The m_Scale property works and scales the texture down to X amount it's size (and tiles it together) but when displaying long characters like the lowercase letter "l" the texture gets stretched, and I want to tile it instead.
This is how the letter displays,
And this is the texture (in grayscale, TMP colors the texture)
Bumped, any help is appreciated
I haven't seen such an issue so maybe you can share some more details? Under what circumstances are you seeing it?
Have you added log statements? Attached the debugger? Are you sure it's not just a bug in your code? In what circumstances are those "sometimes"?
I think it's more likely something about your scene
and perhaps other objects blocking raycasts
Lots of games use drag functionality with no problems though
so there's probably some common element between the cases you've found
As you drag perhaps there is something blocking it during the drag
I suspect for OnEndDrag you need to have the raycast hitting the object as you release the button
so if the raycast isn't hitting as you release, then you don't get it
Recommend adding some more events like OnPointerExit to see if those are happening while you drag
Well there's a fishy thing in this example you linked:
https://stackoverflow.com/questions/41537243/c-sharp-unity-ienddraghandler-onenddrag-not-always-called
Where they seem to be disabling "blocks raycasts" on a CanvasGroup on the object being "dragged"
I really wouldn't be surprised if that somehow screws with it
Basically - to diagnose the problem we'd have to be scientific about it. Start with a very simple scene and a very simple script. Then add things until we see the problem
how do you make gui elements like handles appear when the transform parent of the object that the ui elements are supposed to show for is selected? Like how when you select the parent of a group of objects with colliders you can see them all.
SOmething like this https://www.youtube.com/watch?v=1hFF-TgEXiM&t=525s
Introduction to Handles. Handles are 3D GUI Controls in scene view which help in level creation and visual debugging.
I think you misunderstood my question
im talking about dealing with transform children that have their own ui elements to draw
like here, where the box colliders are on the children but I can see them both by selecting the parent
I wanna do that for my own handles
I have a problem with the Scroll View, respectively the horizontal scrollbar: When exiting play mode, the content of the Scroll View gets shifted to the right (by 255 pixels). The shift will be undone when I change ANY value in the Scrollbar component of the horizontal scrollbar, but when entering and leaving playmode, it will be shifted again. I've tested various settings in the Scrollbar as well as the ScrollRect components, but nothing fixes it. Anyone knows a solution for this problem?
RectTransform of the content before
RectTransform after
can panel height be increased automatically with the increase in contents
Content size fitter
When a an interactive world-space screen like in the picture, with realistic lighting, would you guys use a World-Space Canvas, or do I need to use a Camera in Screen-Space Camera mode and then add a rendertexture, in order to be able to have it emit light at the sides of the monitor, as well as add a CRT shader?
If you want extreme realism it's probably a quad with an emissive material on it.
You think it's overkill? I'm not even sure if you'd be able to notice whether or not the canvas emits light though, to be honest.
Hell, I can't even tell in he picture
the difference is whether it reacts to scene lighting
Is it possible to add a CRT or screen warping shader to a canvas in world-space though? I read some conflicting info about it
Did you play Alien Isolation? I reckon if the monitors are sort of hooded, like this, you reckon they have an excuse to not react to scene lighting? I'm not sure what kind of level of realism that is, honestly, but this level would be fine
lmao, fair enough man
I'll use a rendertexture, thanks lad
Hello everyone 🙂 I wanted to implement a button in a 3D enviroment.
Eg. Person in a room looks at around theres a computer standing with buttons on the screen.
Right now ive just seen the UI canvas Buttons and they are always in the middle of the screen of the scene -
is there already something like that that i can use in order to implement a button that can only be seen from specific angles in a 3D enviroment?
I was thinking now to create a flat capsule and use a Collider trigger to open the Link etc. But then i cant use Text Mash Pro again i think cause when i tried to put a text on the capsule it created a big canvas again and im back to having a huge 2D canvas in my 3D enviroment 😄
You have to make separate canvas and set it's mode to world space, then you can move it and transform it like a normal 3D object in world space
thank you so much 🫶😊
What are some good examples of videogame pause menu/menu ui?
Check out examples of pause menus over at GameUI database. There should be something there that inspires you.
Thanks!
need some help
it's not very obvious from this image, but there are these strange artifacts around my TMPro fonts
it shows up when antialiasing is enabled
these are my settings
mostly happens with FXAA
my ui isnt showing up
Set game view scale to 1
thats not it cuz i put a random image and thats fine
you have it zoomed in right now
i put a random image in the ui and it showed up fine but not the red one
what's the red one
show the inspector for it
is it an Image or a SpriteRenderer?
where did you put that random image
in the same place?
in the middle
Ok well
the red one is not in the middle
so it's getting cut off
like I said set scale down to 1
you are zoomed in
apparently this happens on some android devices for my game for some reason
it affects the normal weight text but not the bold text
there aren't any difference in the text materials other than the bold has 0.1 a thickness outline
anyone have any idea why this could be happening?
Is it TMP or legacy Text?
Is the scale of the RectTransform 1,1,1?
Hey!
I would love to get some advice on making a MGS style inventory. I am not to worried about populating the inventory with pictures or text. I would just like to know how to do the UI.
The thing throwing me off is the scrolling of the item and having the bottom most corner item be the one that is selected . How would I go about making an equip slot like that?
Some images for reference:
tmp and yes, 1,1,1
oh actually they do set their scale automatically depending on the orthographic size of the camera
so they do scale up and down
scale or font size
scale
scale should always be 1,1,1 for UI anyway, but TMP can mess up when it's below 1
It's been ages since I had it happen, can't remember how far below 1 it starts messing up
weird, seems like it's fine for most people
but how would i scale UI with camera size then?
so ui elements don't get super big or small
change the pixels per unit or what?
that just ends up scaling the canvas, so either way it ends up scaling, is the canvas better to scale still?
and i don't know how i would translate the zoom into pixels like that
You might want to match with width not height.. I dunno, gotta play with it
the canvas scale changing is fine, it's the elements below that should be 1,1,1
gotcha ty
what if i want both to match and force it to add black bars?
how can i make this 3d mesh always on top , it get hidden by other gameobject that have sprites in them
Looks like you've put a SpriteRenderer in your UI
UI elements should use the Image component to display sprites, not SpriteRenderer
that sprite renderer is for a parallax background
so how can i fix this without giving up on the parallax effect ?
The parallax effevt work by scrolling the sprite then duplicating it . When it duplicate it hides my 3d mesh
Parallax background should not be part of your UI
put it behind the 3d mesh
and don't make it part of your canvas
Its not
Its behind the mesh
Does anyone have experience with interacting with World Space Canvas?
I can see from your screenshot that it has a RectTransform which would only happen if you made it a child of a canvas
I'm usinga gridLayoutGroup
Is possible to make the chidren in the center?
The last square are in the left, but I want get in the center
you might have to use a horizontal layout group for each row
so a Grid layout group, with only one column, and each row made up of a horizontal layout group that is centered
What are the options for "Constraint"? As it's set to a fixed column count, that might be forcing it to the left.. try changing that
But not have a option to center it :/
What are the options? Did you try anything else? Or just see there's no 'center' and give up? 😄
and did you try 'Flexible' ....?
Nope, you'll have to do what @sterile wedge said
I have a canvas in overlay mode with the scaler set to "Constant Physical Size" and pixels per unit set to 16. I have a sprite with a pixels per unit of 16. Under the canvas, I have an Image which uses that sprite as its source image.
When I click "Set Native Size" it acts as though the reference pixels per unit on the Canvas Scaler is 12, not 16: The sprite is scaled down 75% from where it should be. I cannot figure out why this is happening. It happens in a completely new project as well.
Unity 2021.3.16f1, created from the 3D template (built-in renderer). The canvas was created in SampleScene.
Edit: This seems to be caused by Canvas.referencePixelsPerUnit being set to 12. You can manipulate this by changing "Default Sprite DPI" on the canvas scaler. If it is set to 72, then the reference pixels per unit is correctly set to 16. Why is this? 72 doesn't exist in any setting I can find...
Edit 2: 72 comes from the definition of a point; there are 72 points per inch. Shouldn't the "Default Sprite DPI" default to 72 then? Why does it default to 96, causing sprites to be scaled by 0.75?
Edit 3: In trying to solve this problem, I was going after the wrong issue. You need to set the default sprite dpi so that a pixel is scaled to the physical size that you want it at. It doesn’t need to be 72 pixels in one inch.
I’m leaving this here in case it helps someone else in the future. Sorry for the confused question!
Assets\TextMesh Pro\Examples & Extras\Scripts\Benchmark01_UGUI.cs(79,32): error CS1061: 'Text' does not contain a definition for 'font' and no accessible extension method 'font' accepting a first argument of type 'Text' could be found (are you missing a using directive or an assembly reference?) Getting this error with textmeshpro
- Upgrade TMP to the most recent version, and make sure you're installing it from the package manager, not the asset store
- Delete the TextMesh Pro folder in Assets
- Re-add the TMP essentials with
Window > TextMeshPro > Import TMP Essential Resources
How can I get ride of the Black Outline on all the cornors?
Ping me when you respond
I have made a scroll rect with layaout group and content sizer fitter everything works fine when I enough content but when I have only one or two the content is in the middle not at the top as I want.
How can I fix it
Ping me when you respond
How do i scale Ui elemenets from one side only like u can do in blender with vertices? the 4 blue dots, i cant seem to active them
don't scale them
resize them with the rect tool and/or anchors/pivots etc
That has nothing to do with ui or ux, leave @jaunty lark
That sounds pretty general, so maybe #💻┃unity-talk
If it’s just a one off simple question like that
But no, I’m not a mod
Hello, I have one World Canvas in scene into which I want to insert health bar to every enemy in scene. Health bar is created as Prefab (root is panel nad childs are hearts as image). For every enemy I am inserting this prefab health bar to created World Canvas, but panel rect transform lost link to prefab rect transform. Is there any possibility to keep this link? Thank you! 🙂
What does ux mean?
User experience
hey i need some help. the ui seems to be interfering with a box collider, when i try to click the box collider it does not register. does anybody know a fix?
nvm
Hello, everyone!
I have a question!
how to make something similar to the picture?
Is it a toggle group? or should I just put buttons with images?
How can I make UI animation faster?