#📲┃ui-ux
1 messages · Page 27 of 1
That would indicate they are not anchored correctly
You should use the deivce simulator in unity to try different resolutions in editor
anyone know how to stop post processing affecting the UI ?
put it on a different layer, probably
hey guys good morning/evening/Afternoon.. I have a scroll menu where the white blocks will be like information .. but the scroll only works when my mouse is above the white part.. when its in between where there are black spaces doesnt work any ideas?
good morning!
having some issues with my scrollbar & Scroll Rect, namely that I am unable to interact with the scrollbar despite the scrollbar having interactable checked off, I can provide any info needed on why, Ive been trying to get it to work for ages h
nvm, figured it out! forgot to assign a graphic raycaster lol
@scarlet ether looks like ur following the exact same tutorial as this guy and came across the exact same problem
Trying to decide on how to implement this. Am I overthinking it? Yes.
Would having a UI's current 'screen/layout' or 'popups' event assignments and stuff stored in ScriptableObjects make sense?
I am not quite yet wanting to make the game's UI fully modular and populated via XML or JSON, I'm just trying to find a way to store an instantiated UI prefab's children's UnityEvent assignments.
Maybe, but at the end I tried to find other tutorials.. I am using one that doesnt use an image with a mask.. and use 2d rectangle mask and worked fine but my prob is that when my moiuse is in the gaps (dark areas) and not inside the white squares the scroll doesnt work. maybe adding another image with 1 transparence on the BG will work.. will try that
Hi guys.. I have an UI Text. Even if I play around with anchors or use Best fit. when I increase or decrease the game window everything scales and adapts to the window size, but not the text, the text remains with its original size. Even playing around with Best Fit and setting a minimum and maximum size.. any ideas?
I need a way of doing loading a font at runtime and to store it into a font object for usage.
The font "wont be installed on the system" in the normal sense or in the a way Unity could recognize.
Cant find much online but people using TextMeshPro and I'm new to Unity and unfamiliar with that.
I am using Unity 2017.2.0p2 and .NET Framework 4.6 and IL2CPP and I cant really change any of that.
Found this bit of code: ```cs
var font = Font.CreateDynamicFontFromOSFont("NAME", size); // NOT TOO SURE WHAT SIZE IS FOR
string[] fontPaths = Font.GetPathsToOSFonts();
Font osFont = new Font(fontPaths[124]);
TMP_FontAsset fontAsset = TMP_FontAsset.CreateFontAsset(osFont);
but my version of Unity doesn't to have `CreateDynamicFontFromOSFont` or `GetPathsToOSFonts`
as they were added in 2018.3 and 2022.3 respectively
I am building for PS4/FreeBSD Unix, read a file from lets say...
`/preinst/common/font/SST-Regular.otf` or even
`C:\Users\User\Desktop\SST-Regular.otf`
but could also probably be tested with any other platform, as I don't think it would really matter?
I wanna do this as I wanna open source my project and don't wanna include any SONY property like
fonts, assets, SDKs, examples, etc etc, and the needed fonts are located on the system and would be best.
I only use the official SDK for building and the plugins (SPRX) are built with a open source SDK.
my goal is to do something like ```cs
Font currentFont, runtimeFont;
void Start() {
/* logic to set runtimeFont in runtime */
// runtimeFont = ?????
switch (languageID) {
default: currentFont = runtimeFont break;
}
}```
If you need ANY more info lmk and any help is greatly appreciated, thank you ahead of time!
you're gonna have to show your ui's hierarchy and components so we can help
Hello,
I develop a 2D game and I want to do an inventory UI like in Zelda Ocarina of Time
I want to have the feeling to be in a "box" when I open the inventory and can navigate it like in the game. The animation in this video
https://www.youtube.com/watch?v=Ul2ipeV5npQ
So, is it possible to create a 3D canvas on a 2D game even if I have also a 2D classic canvas ?
Place cursor on the item you want.
Press Z or R to move away from inventory.
Move back into the inventory screen (recommend using Z or R)
If coming from map screen tap up left and a C button right before the screen finishes scrolling.
If coming from equipment screen tap up right and a C button right before the screen finishes scrolling.
The topm...
why can't I select my function in the On Clic () list in the button?
the function is public
C# doesn't have "global" functions so it's not clear what you're talking about
oh I mean public
sorry
Show your code and a screenshot of you trying to assign the function
Did you drag the correct object into the slot, for example?
Your function has a parameter
On click requires no parameters for a dynamic call
Or for you to assign a parameter statically
but it worked in another script
Can you show the second thing I asked to see?
You dragged the wrong thing
You dragged in the script itself
You need to drag in an object with the script attached to it
is that not supposed to happen?
No
oh
thankks
thank you very much!!!
Hey, on the following image, a Vertical Layout Group is used on the blue button to control the text height. Is it possible to make the height match the text's pixels?
I believe with the Content Size Fitter component
then set Height to Preferred Size
@tawdry ferry
It's already driven by the parent
then I don't understand the question
either the Vertical Layout Group controls the height, or the text object controls it
The goal is is to remove the empty space, as drawn with the black lines in the image, making the text's height the same as the distance between its highest and lowest pixels
In order to achieve this, you have to copy the existing TMP_Font Asset and modify its properties. A new font font asset can be generated from the imported font, and this way it will use another Material, which is not required, since there is no need to change it.
The descent line has to be set to 0, and ascent line to match the cap line
not posssible????
Sure, I can try but not sure how that helps.
hiya! what component do I need to add to a button in a vertical layout group for it to get the padding attributes?
Vertical Layout Group has the Padding property
that seems like it controls the padding on the element it's on. so if I have VLG2 inside of VLG1, using padding attribute on VLG2 moves VLG2 independently, not its children. or maybe I'm whack.
is there a way of offsetting the position of an element inside a VLG?
I hope that explains it, it's late and I don't wanna upload a video 😦
Since Layout Group fully locks the position of its children, it doesn't seem possible to change the position for separate children. The only solution would be to have the Layout Group's child as an empty GameObject with the content inside of it, whose position can be freely adjusted
That makes sense
not sure how that helps? then we may be able to see what you did wrong instead of random guesses 😄
i can make a random guess though, maybe the text is the 3d version not the ui version?
Hey guys. Trying to make some UI art for the first time.
This is it rendering on the game window, is it some settings off or do i is it a design flaw, too tight strokes maybe?
The close button is very pixelated and the little rectangle strokes too
Basically everything that isnt a perfect rectangle gets pixelated
Are you using Pixel Perfect?
Anyone know how to fix the jittering of the text? I am using rich tags on the textmeshpro text boxes to increase the size of the newest character as its typed
Rather than typing it out like this - you should put the whole text in at once and then modify the "maxVisibileCharacters" property
That way it will do the layout properly - and only once.
Thank you. I will give it a try
that is still jittering the text up and down.
It's jittering because changing the font size changes the line height. Set the line height manually so that it won't react to the font size
This is my script right now. Where should i implement the line height?
Does anyone know how to use unity with dear imgui? I followed the youtube tutorials but I kept getting errors.
Put <line-height=15px> at the start of the line (adjust the pixel amount)
Probably with something like this https://github.com/realgamessoftware/dear-imgui-unity
its not working
What a vague and terrible problem
Can anyone explain why there are no changes in inspector when I'm stretching the text? How do I change same thing with inspector?
you're modifying the margins of the text
not the RectTransform
yeah, I've just found out it was under "Extra Settings" button
But I don't quite understand what is the difference between this margin
and this one
Reaching out here as this little nugget has me stumped now.
Got a simple registration screen which has multiple TextMeshPro InputFields. However, when you try and move from field to field, the mobile keyboard is constantly closed (as if the close keyboard event happens AFTER the open keyboard event for the next field.)
Tried several techniques now to override the "lost focus" behaviour of the input field when another field is selected (obviously want to retain the behaviour if the user clicks anywhere else).
But this is beyond frustrating now. Anyone got any ideas?
OK, found one workaround but it looks really janky, by having a coroutine on a delay to open the keyboard when a field is selected.
Hopefully there is a better way?
the sprites that got turned on there side didnt get their offsets corrected, but the ones that just got fliped upside down did
is it a sprite issue or a coding issue?
yes, the canvas is pixel perfect
What's the best approach for creating a UI that will be binded with the player data, for example gold and gems? The same values could be displayed in different places, such as shop menu, or upgrade cost menu.
I feel like there's multiple approaches but I don't know which one is the best for scalability.
Should I architect the UI as a component based system, like UIPlayerGold.cs and UIPlayerGems.cs, and those will subscribe to an event like Player.OnDataChanged += UpdateUI, that would goldText.text = Player.gold.toString()?
I think UI Toolkit has data binding built in, but I'm using UGUI. I hope someone can give me a proper example to build off from.
The observer pattern is the typical approach, yeah
How can I make an UI visible and interactable both in vr and on the screen? I used just one worldspace canvas for it, and just made it float in front of active camera, but the problem is that I can't even make worldspace canvas to be interactable just on screen (I haven't tried to make it interactable for vr yet), I have 0.001 scale on that canvas, and It's actually clickable only if I set the scale to 1, and if I set the scale to something in the middle, like 0.5 or 0.1, then the smaller the value, the stranger inputs work, I mean like there is something like offset
UPD: Turns out it's happening when headset connected, strange
Why does the UI Navigation go always crazy on startup of the game?
They instandly start looping / spinning their current selection, until I press a ArrowKey or click with the Mouse in the Background.
It looks bad and will of course confuse the player.
It is caused by the UI Navigation but I need it still because I want to let the player go around in the menu with his Gamepad, without switching to the Keyboard.
- How can I get rid of this looped flipping behavior of the Navigation?
Do you have a gamepad or something plugged into your computer?
The problem is likely some errant input device sending a down signal
Yes and No.
It makes no difference, no matter if I have plugged it in or if I have unplugged it.
It always behave the same.
Perhaps there is another device.
If you're using the new input system, try using the input debugger
If the old system, log Input.GetAxis vertical
Can we automatically make an image contain a text and fit with the content without a layout group in unity2022?
always could
I have a 2d station at the end of my game where I want to merge a before taken foto with an overlay and over the overlay i want to show how long the player needed.
The combination of the foto and the overlay works fine. The problem is to get the textmeshpro over it.
Build up.
My parent is a canvas element with screen space overlay.
I have a gameobject with a camera and two sprite renderer to combine the image and the overlay.
My question is now how can I add the text over it.
I tried already to play with sorting layers but that doesnt seem to work
Screen space overlay will always draw on top of everything
If you want a sprite to show over it you need to either put that sprite in an Image component on another overlay UI element, or switch to screen space - camera
OK this seems to solved it.
But the weird thing is, I have a Keyboard, I have a Mouse and I have a ROG CHAKRAM X connected.
But the ROG CHAKRAM X is my mouse....?
Some of those devices act like... Keyboards, mice, and extras
Well i get that but the questions is then why is the textmeshpro no drawing over the sprite renderers. Although I changed the sorting layers accordingly :/
Because it's a UI element
And you're using an overlay UI
Overlay draws over EVERYTHING
take a look at this
https://github.com/brunomikoski/TMP-Text-Juicer
Is there a good way to make a particle system behave like a UI element, allowing it to be layered above or below other UI elements (visually) and be maskable (scrollview) as well?
I've been looking for such a solution for long time.
Why is the UI on the scene high quality but on the game it's so pixelated
I tried everything from changing pointer filter to max size 16384. The only thing that seemed to fix the issue is scaling the UI bigger relative to the camera's current size, but I dont want the card to cover the entire camera's view
Nvm fixed it by disabling low resolution in free aspect
If you look closely at your screenshot your game view was zoomed in 2.8x that's why
its UI 2d versio.. hehe.. but I am not sure what should I show u for your better understanding_ I just created a UI 2d text, and that is it..
i got a new pc and got my unity projects on it but when i try to open a unity project i find out that the ui is in a wrong place, half of it is out of the screen and it's so big without changing anything, do anyone have a solution for this because there is much ui and i can't do it again from scratch
is it still broken? you have to show screenshots (or code if you have any related to this) so we can see how you set that thing up, otherwise nobody can help you
Can someone guide me to how to access the gallery thru unity, lets say i want to make a profile system or logo so that player can choose an image from their device,
if u can guide me to a tutorial or if it is somewhere in unity manual,
thanks
What do I have to change in my setting, that the 2 balls keep the position as shown in the video, but also change size proportionally when I scale them with the rect tool?
No code. Just UI 2D text. Nothing more. But all good it seems hard to fix that, I am focusing in everything else in the game this is the minor issue.. in the future I check that.. thank you
does anyone know how i can make a 3d button like this in unity (using blender as the concept idea)
ive tried just replacing 3d objects as my buttons but it still dosent work
nvm
Does anyone know why this occurs? The child UI elements of each card is overlapping the other cards. Sorting order for all of them are 0. Setting sibling index doesn't fix the issue.
UI draw order is based on hierarchy order
Lower in the hierarchy==drawn on top
Yes but this does not occur with image sprites. I mistakenly used sprite renderer for my sprites instead of image component
https://puu.sh/KfqKk/ef501fbb4b.png
I have tried to work a bit with UI. I have made this little box that says "This door is locked.", and I've tried to remove it from the game view. I tried to delete it in the scene view, but it still shows up in the game view. How do I get rid of it?
Sure, it doesn't show up when I start the game, but I feel like I'm doing something wrong and it would be a struggle to work with UI if I can't get remove them from game view?
Restart Unity
I'm creating a Twitch Chat Reader which has support for emotes. Players would download emotes, it would be packed into a single texture atlas, and then a TMP Sprite Asset sheet would be generated taking in the atlas and be used for a Text object. So far Ive got everything to work except for assigning the atlas to the TMP Asset. I am able to create sprite characters and glyphs with each emote on runtime and I can assign them to the asset but I am getting a Type Mismatch when assigning the texture2D atlas to the sprite atlas variable. I've tried changing up the property settings when initializing the Texture2D and tried casting it as a regular Texture when assigning it but nothing seems to work at all
In horizontal layout group, is there a way to add individual top margin to a specific element?
For example, I use a horizontal layout group for message bubble and player profile icon. I'd like to make the player profile icon have an extra margin at the top to make it align nicer with the message bubble. (Slightly move down the player profile icon.)
I have two text mesh pro elements. changing the font colour of one always changes the other as well, I've never worked out what resource they're sharing that causes this. how do I fix it?
ah, finally found material presets
Hi. I have some scenes with canvases loaded additively in my project. Is it possible to change the layering of the scenes programatically so that at a specific point one can go behind the other. Like this... https://youtu.be/zza73OWyuJk&t=129
Thanks in advance.
Just use the 'Sort Order' field on the Canvas components
Thanks for that. Will try now and let you know how it goes.
Works great! Still have a few bugs to sort out (relating to my system not the sorting order) but otherwise is perfect. Thank you!
Use layout elements
Bizarre issue where buttons broke and basically slapping the Canvas fixed it... anyone else?
- opened project
- buttons didn't work - wouldn't even highlight if mouse cursor was over them
- eventually disabled old Canvas, created new Canvas, ran game with new Canvas
- disabled new Canvas, re-enabled old Canvas
- button in the old Canvas now works
This happened in two different scenes. A brand-new Canvas works fine.
I'm a bit concerned if I have to potentially disable/re-enable anything that's acting weird?
It's because you didn't have an event system in the scene
when you create a canvas from the editor menus, it creates the event system for you automatically, so that's what happened when you recreated it.
This is a very common mistake people make.
Can you show an example setup? Layout Element seems to only control sizing, and using Ignore Layout would break the layout. Did you mean I have to use extra sizing on the profile icon to make it appear more down, is there no way to set offsets/margins for the position rather than sizing?
To add extra padding you can add an empty object to the layout with a LayoutElement
It's only a Horizontal Layout and I need profile icon to be more vertically down, not horizontally. I think the best solution is create a new Vertical Layout object and make the profile image a child, then I can set the Top padding in the VLG to make the image move down.
Does this seem like a good solution?
When you are adding elements to a vertical layout group i wonder how to have it automatically resize to fit all the elements. the size is important because it decides on the ScrollRect handle settings. and i need to dynamically change this list at runtime.
edit: Content Size Fitter with vertical set to min preferred, and setting spacing in the vertical layout group to 10 made it work perfectly.
I thought I had it working before, but since I can't be certain that may well have been the problem. Thanks!
hi guys, why Alignment option in TextMeshPro doesn't align my text? Whenever i change it nothing happens
Does the text have enough space to move? Does it have only one line?
- yes 2. yes
Show a screenshot with the object selected and the inspector visible
Title text style overrides the alignment for some reason
How do you enable pillarboxing for games? I want my game to be able to maximize to full screen with black bars kind of like this
But right now it's this due to the settings i have
Is this a setting somewhere?
I do not want it to be responsive because its an interactive animation and it must be in this 9:16 aspect ratio to work properly
You can either programmatically set the camera viewport or you can use black UI images
I don't think there's a setting for it
On Unity's Vector Graphics page https://docs.unity3d.com/Packages/com.unity.vectorgraphics@2.0/manual/index.html,
in the Known Limitations section, it says:
Per-pixel masking is not supported (SVG 1.1 section 14.4)
I am trying to use an svg as the background image of a button within a scrollview that has a rectmask2d.
The image only either fully shows or fully doesn't show. If I instead use a png, the mask works correctly.
Is this an example of the not-supported feature, and does this mean I should just... not use vector graphics for this purpose?
attached image shows the text being masked properly within the rectmask2d, while the svg does not.
I'm trying to do a quick list of what expected content is missing from my game. I'm using the resource locator to check if a path exists in addressables. It's coming back with the first half of the content NOT existing, even though it does. I put in a 3 second delay which should be heaps, and the content seems to be loaded and available well before that anyway. can anyone see if I've done anything obvious wrong?
private IEnumerator CheckWords()
{
yield return new WaitForSeconds(3.0f);
yield return CheckForMissingSlowWords(StoryLoader.PersistentData.Config().PrimaryLanguage, PrimaryWords);
yield return CheckForMissingSlowWords(StoryLoader.PersistentData.Config().SecondaryLanguage, SecondaryWords);
}
private IEnumerator CheckForMissingSlowWords(PandB.Types.Language Language, PandB.Types.StoryPage Page)
{
if (Page.Words == null || Page.Words.Count == 0) yield break;
foreach (PandB.Types.StoryWord Word in Page.Words)
{
string assetPath = "Assets/PoppyAndBuddy/" + "Stories/" + Story.StoryName + "/Audio/" + Story.StoryName + "_" + Language.ToString() + "_" + Word.MatchWord + ".wav";
if (!AddressableResourceExists(assetPath))
{
Debug.LogWarning($"SlowWords: missing {assetPath}");
}
}
yield return null;
}
public bool AddressableResourceExists(object key)
{
IEnumerable<string> locs = Addressables.ResourceLocators.OfType<ResourceLocationMap>()
.SelectMany(locationMap =>
locationMap.Locations.Keys.Select(key => key.ToString())
);
if (locs.Count() > 0) return true;
return false;
}```
weirdly this was working earlier with minimal differences
Hi guys, how do I make text scale vertically (Appears like the only solution is a content size fitter) inside a vertical layout group that also uses a content size fitter to scale vertically?
Having 2 content size fitter stacked seems to mess things up, looks like a matter of the outer one updating before the inner one, but I can't confirm that.
I need it for tooltips, basically when you hover your mouse over an item, a tooltip will show with the title, and a description with varied length
My theory was correct, and I ended up fixing it by whenever I set the text, I'll call descriptionSizeFitter.SetLayoutVertical(); right after, thus avoiding the race condition
This can be executed when the content size fitters are disabled too, which could be a slight performance buff in some cases
how can i turn this image into repeating "tiles" so that i can change the Y offset and it would look like its spinning
depends how you're rendering it
im using UI
sry im not sure what u mean
so it's a UI Image component
yes
The easiest way is https://docs.unity3d.com/ScriptReference/Material.SetTextureOffset.html
the shader will need to also support tiling
not sure if the default ui shader does
but basically - make a material with the ui shader, and set the texture offset in your code
i see, i will try this out ty
how do i do this? i tried everything, i cant find a ui shader that does this
you might have to make one
easy enough with shader graph
all you need to do is uv = uv % 1 (but in a graph)
ill try to figure it out, have never used this before tho
I have a canvas with a prefab child with some ui info panel, I have one permanently for debug purposes when I start the game, but generally I instantiate it as info box over moving gameobjects with indicator.screenPoint = mainCamera.WorldToScreenPoint(target.transform.position); and RectTransformUtility.ScreenPointToLocalPointInRectangle(containerRect, indicator.screenPoint, null, out localPoint);
this generally works perfectly.
But I was playing with filters and volume settings and tried switching my canvas from screen space - overlay to screen space - camera: and it breaks. With the canvas set to overlay camera the "static" prefab still works and is displayed and filtered, but the ones I position with my code aren't visible and in the scene view I can see they're not even oriented towards the camera like the first one?
With screen space camera you can just directly do indicator.screenPoint = target.transform.position
I don't see how this can possibly work, the working ui elements have coordinates within my canvas scaler 800x600 resolution. While my targets have 3d scene coordinates. it's a test scene, so yes, randomly the x,y are within the -400, 400 and -300, 300 range but this seems very accidental.
But something weird happens with the screenPoint = transform.position assignment: the actual recttransform coordinates I end up are (2700, -8000, -6000) more or less, for position that was (15, 80, 31) in worldspace. Plus when I just assign the position my indicator's recttransform ends up with a rotation?
is it working and you're asking for an explanation or?
no, it's not working.
But something weird happens with the screenPoint = transform.position assignment: the actual recttransform coordinates I end up are (2700, -8000, -6000) more or less
Yeah because the numbers you see in the inspector for the REctTransform are in canvas space not world space, and also local to the parent
Hiya!
I need to make some images multiple of 4, otherwise they don’t get compressed. I changed the pixel width and height to be multiples of four, but when I bring it into unity it changes the pixels, making it no longer multiples of 4.
What’s going on here and how do I get around it? Any help is greatly appreciated, thank you : )
check the import settings
sorry to be clueless but how do I do that 😅
Oh! Found it, thank you!
@mortal robin ah it was my ScreenPointToLocalPointInRectangle(containerRect, indicator.screenPoint, null, out localPoint); I pulled this out of the docs for my original overlay: and the docs say for overlay you pass null for the camera, so for the canvas set to "Screen Space - Camera" I need to pass the camera as the param. ( I also need to manually zero out the z param, and reset the rotation, but it works!)
How do I use an input field? No matter what I type Im not getting a value as a return, Iget blank as a return
I can clearly see the blank line here which is probably the source of why im getting a blank line no matter what user inputs, but WHY is that line blank? why isnt it just passing the value forward like the method says?
you added the function from the static parameters list
you need to add it from the dynamic parameters list
ah at the top
(check the dropdown to pick a function)
I just found that myself as well, the top one not the bottom one 🫠
Thanks Praetor 👍
as usual the detective looks for the killer only to find out the killer was the detective all along
Ive got a ton of cruft all over my text mesh pro text and I cant seem to find out why, is there a document for common debugging of TMP text looking like crusty garbage?
The only thing ive been able to determine is if any kind of Antialiasing is on, the text looks like ass
Additionally if the UI camera is set to Overlay, it looks like ass, but NOT when its set to Base, so that likely means something is going wrong in the overlay proccess involving scaling? But I cant find anything related to scaling occuring
So far the only value that seems to improve the look of the TMP text is the Render Scale of the URP quality asset
which is just rendering the entire scene larger and then downscaling
surely there is a less resource intensive way to get good looking text out of the box
How are you changing the size?
Font size in the TMP asset, not scaling it
I see, idk then
very clear crustification as it gets smaller
im zoomed in viewport scale 3x here
the M is barely readable because its like its glowing white or something
maybe something in here is wrong?
Nope randomly scrubbing all the values has no effect on the text 🤔
love when features have tons of parameters that all do nothing
honestly it didnt USED to look this shit
so maybe I need to roll back
because something went wrong that completely @#%@^ the look of all my text at some point
I guess ill try that, rolling back many versions to see if the text improves
rolling back shows it did used to look good and crisp
now to go through every version until I find out when/what went wrong that killed it
im positive it was some setting related to antialiasing
@mortal robin i think i did this correctly but its just fully dark red outside of shader graph for some reason
did you make a UI shader?
Or a regular one
in the graph settings - make sure it's set as a canvas material
hmm that explains it lol
show your code?
its just this ```csharp
public Renderer Renderer;
void Start()
{
Renderer = GetComponent<Renderer>();
}
// Update is called once per frame
void Update()
{
Debug.Log("OffsetY Value: " + Renderer.material.GetFloat("OffsetY"));
Renderer.material.SetFloat("OffsetY", Time.time);
}
and which object did you attach it to
also i used SetTextureOffset at first before using custom float OffsetY
both dont work
as you can see, it clearly works outside of the game
yeah this should work...
to be clear the object the thing is rendering on is the cube right?
yes
doesn't look like you assigned your renderer here?
oh it's assigned in Start
ye
Wait I see the problem
I forgot
the thing you would use in the code would be the Reference name here
so _OffsetY
@mortal robin I got progress in case you someday see someone else with the same problem.
The problem appears to be my canvas itself is set to Screen Space - Camera (crusted over broken text)
and it needs to be Screen Space - Overlay
except im 99% sure there was some plot critical reason why I had to set it to SS Camera
which im sure ill rediscover shortly tomorrow when I start to use it as Screen Space - Overlay
Can anybody tell me how to enable the mesh outlines for individual characters in a textmeshpro ui text object?
this is what i want to see:
but this is the thing im stuck on:
Proably you wanted to draw some world space object over the canvas
I gave up and I just load them and report missing ones to the console. it's only a check I'm doing while I gather up all of the audio files and import them anyway to see what's missing.
oh, and I meant to ask this in #📦┃addressables 😠
why the particals are not showing on raw image
Do they show up in the camera preview for your render camera?
yes they are showing in camera and rendereTexture but not on RawImage
i have marked it
took me multiple days to make something this simple
someone know why theres a purple background? the image i use doesnt have that
also i had to add my material on a 3D object since my shader cant support UI for some reason
How would I put this rock sprite behind that Darkbrown UI
As they don't have order in layer
It did work when I played tho
I just don't understand in what order it works
Just gonna link my question I posted in #archived-code-general just in case that's not the best place to ask.
#archived-code-general message
any tips on creating curved canvas?
Depending on what effect you want, you can project UI to render texture and pass events or turn 3d space elements into UI through selectable interfaces.
still need help on this StoneUI prefabs are children of StonePlacer, however stone placer isn't a canvas its just a gameobject, and none of those stuff have ordersinlayer
hmm 🤔
i just started a new project and added a text from textmeshpro, does anyone know why its kinda pixelated around the edges?
You need to look at canvas settings, it uses SDF so it can be set as sharp as you wanted to be with pixel per unit settings. Could be elements too small with zoomed in game view slider if it's default PPU.
Uuuuuuuuugh, Pure catharsis.
I finally defeated the Pixel Perfect UI demon, and I figured out why all the UI demons were appearing and making my pixel art distorted and fucked up.
So, the gist of it is this, the ONLY way I could render pixelated UI before was to render it to a low resolution camera, capture the output of that camera as an image, and display that image to another, high resolution camera.
This works great, except for a major problem. The modes.
-
In Screen Space Mode, the UI displays correctly, but at the cost of being unaffected by All Post Processing. The UI is not pixel perfect, but full resolution, and the UI is not color-crushed, but off-palette. Unusable.
-
In Camera Space Mode, the UI displays correctly, and is affected by post processing, and is pixel perfect at the correct resolution, and color graded correctly, BUT, Raycasts do NOT work correctly, because the UI camera is at a small resolution, while the actual game camera is at a large one, resulting in the mouse being unable to click UI correctly. It will instead click UI close to the bottom left of the screen, because the raycast "Thinks" the screen is smaller than it is.
Setting Camera Space, and rendering it to the Full Resolution camera fixes this, but makes the UI non-pixel-perfect.
- In World Space Mode, the UI is rendered physically inside the world. It is affected by post-processing, color grading, and pixelization, but at the cost of it being imperfectly rendered, due to it having to actually render to the camera as if the camera was recording something in the world itself, leading to floating point errors and other major issues.
The solution, such as it is, is that option number 2 is the only workable one. By adding a resolution-fixer to my post-processing stack, I can render the UI to Camera Space, then use post processing to make it Pixel Perfect by rounding the UV Coordinates, instead of relying on a render texture to do so.
I hope this helps some of you.
No idea where to ask this but I have a camera with a target render texture for rendering a ui render texture image to add some filter. But whenever my CPU peaks, the render texture just freezes? Does anyone have any idea why this is
Hello. trying to create simple tutorial text that shows up for X amount of seconds, disables, then shows another, but it's not working (no console errors). Using TextMeshPro. Any ideas?
Oop, it was because I was disabling the gameobject instead of the textmeshpro in the inspector
Im trying to make a health bar but whenever I put my fill into the slide it becomes way bigger(vertically) then the healthbar, can someone please help
i found a fix
God, please help me. I've been three hours trying to get a scroll rect to actually work. Right now my scrollbar always resets the size value to 0.5 doesnt matter what i do, and i cant get my handle to go the full sliding area for some reason. The content has a content size fitter component, i've tried changing pivots, making a prefab, changing the prefab, resetting the component, opening and closing the editor... i really dont know why it does this
Can anyone help?
Don't try to move sliders directly through code, they are controlled by the component. Instead set the variable that indicates its position percentage.
there is no code controlling the slider
Are you adding content dynamically through code?
no
You should illustrate the question then to show exactly what's happening
i'll even do a video
Scroll handle resizes based on the amount of content, it's controlled by the component.
If you want to ignore that behavior you'll have to improvise https://discussions.unity.com/t/scrollbar-fixed-handle-size/706166
Ok, then how would i keep its aspect ratio and have it scroll the whole list?
Isnt possible?
Id probably have to use a 9 rect for the handler wont i? @azure flame
how can i create a box to like select this with arrow keys / dpad like i drew? im using a grid layout.
There are solutions in the thread
Thank you
can you explain how you added the resolution fixer to post processing?
Okay, so, if you like, I can dig up the shader I used, but the GIST of it is this:
-preface: This is a Fullscreen Shadergraph Shader which is used for a Unity Post-Processing Effect in URP
- Take your blitsource input, and for its UV, put in a screenspace UV
- Take that UV, and multiply its value by a Vector2, your Resolution that you want to fix it to.
- Using Round, round the result to an integer.
- Divide this by the same Resolution value.
Test this by starting with a VERY low resolution, I use 10x10, which lets me see if it worked correctly. If it did, you should see the UV image has become Pixelated.
Note, this is only guarenteed to work with multiples of your input resolution. I use 640x480, but my game renders at any 4x3 ratio that is a multiple of that (In this case, 1280 by 960)
It MIGHT work for whatever, but if you want guarenteed results, make sure you're downsampling by something divisible by your final resolution. I.E, if you use 1920x1080 as your game's resolution, use 960x540 for your pixelated downscaling shader.
Does that explain it, or should I take some time to boot up my project and try to get you the stuff involved? I can try to make a basic shadergraph and package it for you, if you like, but it might take a while, since I've got a bunch of other stuff I handle on a day to day.
i'm completely new to shaders so I'll try to figure it out but if you find the time to send it over that would be amazing. I'm trying to achieve an effect similar to the game Core Keeper where every single element is on a pixel grid. Does this shader just solve the issue of screen space camera mode messing with mouse position/raycasts? Right now, when i use screen space camera the pixel grid is still misaligned causing weird artifacts when using upscaling. Do you know why that is? It works completely fine ingame with gameobjects, etc.
is there an easy way of getting TMP_Inputfield.text, without the rich text tags? Or is that something I'm gonna have to code?
nvm i forgot I can just regex it
any suggestions how to fix the text being rendered odd when using pixel perfect camera? It is on a world space canvas. As as an example, the two g's are being rendered slightly different when trying to allign to the pixel grid. Sometimes parts of characters are 2px wide when they should be 1px, etc. I believe this has something to do with the font but not sure how to fix it? Thanks
This is a nightmare to fix, so I'll direct you to a video that I used to fix mine:
The steps, in order:
-
Use a Pixel-Perfect Font.
-
Use Raster Hinted for the font.
-
When creating the font, make ABSOLUTELY sure you set the Sampling Point Size and Custom Size to the EXACT font-size your font is intended to be used at. I.E, if it's an 11 Pixel Font, set Sampling Point Size to 11.
-
Set the Font's Atlas Texture to Point Filtering.
-
Set the Font to the correct size.
-
Use Pixel Perfect Canvas mode.
This all SHOULD lead to a pixel perfect font, but I might have missed some steps. The video goes into better detail than me.
In this video I'll show you exactly how I made my own custom pixel perfect fonts using Unity's Text Mesh Pro component. If you have any issues implementing this in your projects feel free to drop me a comment or message me in my discord and I'll gladly help you out! Thanks for watching!
Online PNG to TTF tool: https://yal.cc/r/20/pixelfont/
Dis...
I followed the video but it's still not working, perhaps its because im using a world space canvas that doesnt have a pixel perfect options?
Yeah, World Space fucks all pixel perfect options. You need to use Camera or Screenspace.
how could I achieve those item labels seen in the picture with camera?
seems like it would be a headache to keep them in the correct place
camera completely fucks it, it all renders in the middle and is super super tiny
not sure why
OH i got it working with world space, my scales were messed on the parent object
now to tackle the UI haha
nevermind, in build it still looks bad for some reason :(
:(
i believe its an issue with 1440p
hey guys, does anyone know what's happening with this font? at small scaled it looks "blurry" almost?
I turned up the padding a bunch in the generation and now its a good bit better... but will this ruin preformance/create a significant preformance drop for people?
how did you fix the UI elements flickering when using upscale on ppc and screen space camera on the canvas?
im thinking about going down the route of whenever the transform.position is changed to round it to the nearest pixel, but that seems tedious
atleast for the ui
There's an option called "Pixel Perfect Camera" on the Canvas, which you need to use, and it needs to be set to Camera Space, AND the UI elements in question need to be ticked correctly, so for 9-sliced boxes, that means setting the pixel units correctly, and for normal sprites, it means setting the sizes correctly.
I'm not sure what is going wrong with your specific case, there's a LOT that can go wrong with it.
I believe I got the world space canvas working mostly correctly, however on 1440p things are still wonky, not sure why. Now i'm trying to also have my UI menu (seperate of the game world) obey a pixel grid but using camera space makes any movement super flickery (things are snapping to sub pixels, distortion,etc) when using upscaling
also the raycast thing is another issue that you mentioned, still unsure how to fix that
so a fix would to just override and transform change to snap to pixel instead to fake the effect
yeah a lot is going wrong, haha
Yeah, you CANNOT fix the raycast if your UI is assigned to a camera at a lower resolution than the main camera. UI HAS to display to the highest resolution camera, unfortunately, either by using the main camera in worldspace mode, or using the main camera in Camera Space mode
Use Gifcam to make a gif of what's going wrong, and post it.
the items in the inventory are super distorted and when any movement occurs there is "flickering" as the pixels arent snapping all together
here are my settings
there are subcanvases that are all 1920x1080 and inherit from main
Go into one of your images and let me see what it's set to.
Try clicking uhh
I think it's called "Set Native Size"
Likewise, for the box sprites, you need to set their pixel units to something like... I think 0.16?
Okay, tell you what
give me like
a hot second
Do you have time to watch me stream?
I can meet you in a DM call and show you my project and help you out
yeah that would be helpful if its no problem
here is what i use for most of my ui
is the pixels per unit multiplier the issue?
should it be 0.16 or 1/16?
Yeah, I've got my own project open, so I can show you how I set mine up, if you want to get in a call with me so I can share my screen
Need some advice understanding how to implement something
I currently have it so the player could move through a menu options using the arrow keys
How could I have it so the scroll view moves to show where player is currently selecting an item inside of it?
increase the size of the selected nub and/ or change the colour
No I'm not talking about showing what the player is currently selecting
I'm asking how to move the scrollview to shows what the player currently selecting
Like if there was a 4th slider not shown and the player moves to it using the arrow keys how to do I have the scrollview move to show it?
Oh, I missed that.
Check if the selected thing is visible somehow, and if not move the scroll view manually
Heyo, while boxing out the UI, i'm wanting to make some gradient background panels that are a bit cleaner than using a soft circle that hangs off the edge
Would it be bad to make a 1px thin gradient image and tile that to make gradient borders?
I dont see any built in ways to do a simple gradient effect
Why are there boxes around the text
It seems to be when its out of camera view??
anyways how do I get rid of it
oh wait i fixed it
,_,
random clicking ftw
when i change my canvas to worlds space in unity 2D everything dissapears and i cant do anything to make it reapper without change it to screen overlay
Most likely you simply didn't place the canvas in view of the camera
world space objects have to be in view of the camera to be visible
I've got a TMP_InputField and it doesn't want to be focused on.
I searched around and found that
inputField.Select();
inputField.ActivateInputField();
should focus it, but nothing happens.
I've made one from Unity's dropdown menu without fiddling with any of the settings, yet the same thing happens.
I also know for sure that these commands are being run on the input field itself - but nothing is happening with it.
I fixed it by just adding an EventSystem because it didn't exist. I must've removed it. Damn.
Anyways, new question. This one is more fun:
I've got an image attached to a TMP_Text element.
The material is an Unlit HDR color shader, with nothing else. In the scene view - looking at the UI it looks good. In the game view it for some reason becomes a different color and completely hides the text. Any ideas?
This happens regardless of the material I choose. It's the same shade of red.
The image is behind the text and does therefore not occlude it too.
My guess is that the format for a material on an Image UI element should somehow be different than a normal material?
I can't find anything relating to this though...
Does this happen regardless of the shader you're using?
Also I'd recommend having the image as a separate child object, which will help you avoid issues like the image covering up the text
yeah, that is my setup
I tried with different shaders.
I did a normal material shader (unlit)
also a sprite shader
same result
I found that the image blocks the text
something is making the image render on top of the text
this is expected behaviour. Child objects get rendered on top of parent objects, you need to make the image to be the parent object instead
aha, I see
also try using a UI shader rather than a HDRP one
that might help with the weird color in game view thing
URP. Either way I did make a sprite shader.
that's a UI shader no?
the shader currently attached is a sprite shader.
did you make the shader yourself or did you select it from the premade shader dropdown
this works properly for me, I just tested it
huh...
actually no, the alpha is broken in this
but the color seems to work fine
question: in the image component, do you have a color set
do you have anything beyond white in here
yea
try to change it to canvas instead?
that's graph settings in graph inspector
can you show me your options then? I'm on unity 6
huh
is this how it looks like still?
how do you achieve the glow around it?
maybe the problem's somewhere in there
made a new scene, seems to work there I think...
I made a MainTex for it too, just too see if it needed some dependency
okay color has been randomly fixed
lmao, that does happen sometimes
now it's only forcing it to stay behind the text.
The thing is, I want it to match the text. Is the only way to write a script for this?
does making the image the parent not work?
wdym match the text?
you can make the text match the image, and modify the image to modify the text
wait lemme see. I've got some stuff that needs the text to be on top I think
yeah, the scaling is based on the size of the text
I can't have an image as the parent of the text, as the scaling is hierarchical
I'll make a script that matches the scaling of the text while not being a child. I think that'll work.
that's unnecessary I think
why don't you make one prefab, and then parent both the image and the text to it
and make them fill the entire thing
and just change that empty parent when you want to change both
I think you might be doing something weird can you explain why you're doing what you're doing, this doesn't make sense at all to me
yeah both things work actually.
hahah, I was gonna make it spawn in a background object for a piece of text when it's created. Then the background object just shadows the text, while staying behind it.
Your solution is also good, I might do that instead. I need to rewrite some stuff for it to work - but it might be more effective in the long run.
though I'm not sure if your solution works in this specific case, as I need the text to scale the parent object.
In my experience, not writing weird scripts like that is usually preferred lmao
I still don't see why the image can't just be the parent, but hey if you have a solution then it's good xd
why don't you scale the parent object then, and let the text scale up to it?
because of this. It's scaling with the text. Some text is longer, some is shorter.
there's really only workaround-solutions to this :P
I need the object to be scaled to whatever the text is, so yeah I could scale the parent-object to the scale of the text-object, and that's almost the same as the wacky background script.
just scaling a different object :D
ohhhh I get what you're doing!
but you're not scaling it horisontally here
ahh, text is multi-line?
sometimes yeah
depending on what resolution you're on the text might wrap around. This makes the size bigger...
I'm still thinking, but yea I think what I'd do is set content size fitter on the text, then indeed just make the preferred width and height (in layout element) of the parent element to be what the text is
I remember doing exactly that in another project
legitimately almost made me write a tool to make this less of a pain in the ass
didn't end up doing it sadly
if you do this you might end up with an issue
that if you change the size of the child through code, it doesn't actually update the alignment on the layout group
let me check how I solved this
there's a way to force a repaint
relayout I mean
_layoutGroup.CalculateLayoutInputHorizontal();
_layoutGroup.SetLayoutHorizontal();
in my case it was horisontal in your it'd be vertical
ah no, you have control child size enabled
nevermind
that's how I did it in my project, and I just changed the child size from code
i try to explain this as detail as i can
i ran into a problem now
element 1 element 2
element 2 if u delete 1 element 3
element 3 -> element 4
element 4 element 5
element 5```
this is normally what ur view will be if u do that to a UI with many rows
is there anyway to lock the UI arrangement?
like making the UI look like this in view
element 1
element 2 if u delete 1 element 2
element 3 -> element 3
element 4 element 4
element 5 element 5```
supress the auto arranging ability
Hey guys I was trying to build my UI and wanted to have the head animated next to the health and mana bar. I used image to build and then was gonna use a sprite render and try to sync states with the head (So if a character is stunned downed etc it would show next to health bar too). When I switched from image to sprite render it no longer shows up in game screen.
Yo! I'm having some trouble with layout groups and its really stumping me. Whenever i add something to Preview Toolbar's horizontal layout group, the group changes size and even pushes other layout groups around. I have NO idea what could be causing this, since theres absolutely no padding on any of the layout groups. does anyone know what's going on?
please ping me if someone responds!!
"child force expand height" is checked in the toolbar. and it sounds like that is exactly what is happening, dont you think?
from my knowledge, that should expand the children (the white squares) to the height of the toolbar
but that shouldn't change the toolbar's height itself
maybe try disabling it and see what happens? if it doesn't fix it then you can try the other checkboxes
you cant have sprite renderers on the ui, you probably have to use a render texture. or have the sprite parented to the camera with special sorting so it doesnt get covered up by anything, then its the same as if it was on the ui.
the 2nd option sounds better, i cant think of any problems that solution might have rn
no combination of checkboxes is fixing it :')
I figured out how to fix it (i put the layout group in its own gamepbject thats a child of the toolbar), but i’m still having trouble getting it to where i want. Here’s a diagram of my idea; is this even possible?
hey i have the following Problem:
i created the ui as u see in picture 1 but on the camera the assets i inserted arent shown.
What did i do wrong? thx for any help
Make sure you're actually using UI elements.
For example Image instead of SpriteRenderer
ah so drag and drop doesnt work i have to create a UI Objekt like an Image first and then select the Asset as Source Image right?
I put a new button inside the handle. When I click the button and pull the horizontal joystick, the handle does not return to the center. When I do not click the button and pull it, the handle returns to the center point. I want the handle to return to the center when I press the button.
hello,
what exactly is the name of this icon style? as far as I know it is “grunge” but there are very few images under the name “grunge”.
Might the keywords "chalk" or "chalkboard" help? That's what they remind me of.
look alike but i think these are has more scarier theme
I think it has a name of its own because its an art style that appears in so many games.
Hi. I have a very simple problem but cannit find any solution yet.
I just want to Flash/change color of a textmeshpro UI text that have a vertical Gradient on it.
Anybody know how to do it?
I mean fade to another color/gradient.
is there a way to get sliced/tiled to be pixel perfect?
like only scale to pixel perfect amounts?
also, how can i fix this jitter?
I tried switching to TMPro from legacy text, but outline on font looks really bad compared to Legacy text, is there any way to fix it?
anyone know?
why is my UI not perfect even with pixel perfect on???
Check the sprite sheet, you might be a pixel off in framing it. Also, try setting Native Size for the sprite, it might be slightly off.
Does the sprite "boil" when you move it around?
I.E, does the sprite warp or does it stay exactly the same when you move it from left to right?
Unrelated, but I can't believe nobody talks about how RectMask2D doesn't break UI batching.
you can see that his pixels are not all the same size, it means the issue is that the object is not at a pixel perfect position @earnest wharf
what kind of UI element should I be using for a selection list? where selecting one element deselects all others?
Is there a way I can mask this UI progress bar taking into account the cutout on the graphic beneath?
Hey I have 2 designs for an inventory but I dont know which looks better waht do yall think?
Either a Dropdown or a ToggleGroup
Depends entirely on the desired look and feel of the game and what everything else looks like
dumb question maybe, but is there a way to make a TMP RectTransform somehow auto-size down to a managable size relative to its parents mesh? i am so tired of having to resize them down from being way too huge
show an example of the problem you're having.. can't say I've ever found the TMP rect to be too big
@low pike Does this 100% of the time for me, always has.. before/after adding a TMP as child of the cube. (via right click -> 3d object -> Text - TextMeshPro
Oh, you mean 3d TMP, not UI (this is a UI channel.. subtle difference).
I've rarely used the mesh version, not aware of a way to auto scale it
oh my bad
Assuming Unity doesn't have a built-in way.. maybe make a prefab of a scaled TMP object
and use that
I'd unpack the prefab after adding it to the scene each time
yeah, honestly i should, just keep putting it off. it's just crazy to me they have TMP in the 3D menu yet it has no ability to come close to sizing itself in a convenient way
just change the font size
relative to the mesh of a parent. but maybe that's somehow difficult to do hence why its not implemented
Font size alone doesnt help, the width and height of the TMP Rect is also way too large
does the rect even do anything?
relative to the mesh of a parent... is still dependent on what the dev wants. You may want it tiny so 'next text' fits nicely along the bottom of the cube, I may want N to be the size of a cube face
I don't think it does
You cannot remove the Rect
oh wait i guess if you want the text to be cut off and go to the next line earlier?
Don't even know why it has a RectTransform for the 3d one
I know right?
maybe this
Makes sense for dynamic text that'll change during gameplay, so you don't have to add /n everywhere
Yeah I'm just saying make the dang rect smaller Unity lol. As it is now, it's so big that resizing is always clunky
guess that doesnt really illustrate well without scale context but yeah
you might be able to change the default text mesh pro settings so it spawns it in with a tiny rect and font size https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/manual/Settings.html
Oh nice, thanks that looks promising
Yup that does the trick
Just press R and drag the middle cube to resize all 3 axis at the same time?
Does a content size fitter work on it? 🤔
Hey guys on photoshop my image look like this .. without the white border.. on uniuty it has a white border.. any ideas?
Tried all options possible and cant fix. Also image in photoshop is darker
im having issues making ui for the first time, the edges of my boxes are very jagged inside unity. does anyone know how i can fix this?
thats pretty much how things look in the editor, make a build and see if it looks fine there
alright thanks
is it possible to get a UI to have this look in a 2d URP?
I want to give the UI a "3d perspective look", however, the game is 2d.
Make a separate 3D camera and use it to render the UI in world space
OK so no need to choose a 3d unity at project start?
It's only for initial settings.
hey everyone! i just opened up a new project and when i inserted a tmp text and set its color to match an assets color, it displayed a lighter one than what i set. i checked its settings and the rgb code was correct. i didnt really change any global settings or anything and this is a fresh install of unity. could somebody help me out? thank you very much!
Your text element or font asset itself could have additional tint applied.
the default font, liberationsans has this same effect too
thank you very much! it is fixed now
hello hello
I want to ask if there is a way to stop my menus form stacking from one other, I kinda want the previous one to disable whenever I like another pop menu
When I export to Itch.io, the video players in my scene disappear...
this is the itch page
all those video players masked out by the png disappear
It's really hard to tell what we're looking at in these screenshots
how can i make the jeans object height match the cells?
i need the yellow line to be always the same as the red line
height wise
at the moment i have to scale it manually to match it
is there a way to do it automatically
does anyone kknow how i can make smooth buttons like the phot on the right, when i attempt it on unity the sides are blurry, i just want to make rounded buttons
you are using very low quality resolution images, go to the package manager and install 2D Sprite package from unity registry, then on your buttons image component set the sprite to the 9-sliced sprite, now you can set the image type to sliced and modify the pixels per unit multi to get the rounding amount you want.
hi thankss for the help, btw i installed 2d sprite, but i can't see the 9-sliced sprite
you see that "eye icon on the top left of the window", click that once and then it will show.
Sorry for late reply.
Does anyone know what Unity Hub is using for it's UI framework?
It's an Electron app. Probably just custom CSS.
Ohhh thanksss!
hi! besides the placeholder UI, do you think the rest of the things match with the game graphics? the portal in the middle and the bottom bar
Hey guys I moved an UI Image, but the anchor points never follows it.. is there a way to move the UI Image and the anchor points follow it? Like here?
You need to clarify how you are moving it, is it with code or you just dragging it.
and provide more information in general, what's the desired effect?
Just moving it.. You can see I drag the UI Image but the 4 anchor points stay there and dont move together.
How do I make it so that this smaller square scales whenever the parent square scales
when I scale it to be bigger this happens
When I scale it to be smaller this happens
Still didn't say what you want to achieve. UI driven by anchors, when you drag something you are creating relative offset. Take a look at the tutorial https://learn.unity.com/tutorial/manage-screen-size-and-anchors?uv=6&projectId=61b9fc0fedbc2a24a5bbc5a2#
You can spend a ton of time making your UI look perfect on your screen, but what happens if someone opens your application on a screen with a different size or a different shape? In this tutorial, you’ll learn how to consider the screen’s aspect ratio and use Canvas Anchors to make sure your UI elements stay where you want them to. By the end o...
Inside object must be parented under it and anchors should cover entire parent object in dynamic mode (stretch anchors).
If you want it to sit in a specific place proportionally, set child anchors accordingly
oh my god fog sight
You're the best
I can't tell you how long this issue has been affecting my app
I'm nearly 3 months into development and I've just been doing work arounds to make almost fixes that have been limiting what I can really do
I was literally on my way to fiverr to pay somebody to tutor me on this lol
Unity Learn has plenty of tutorials on UI for free
I've linked one there #📲┃ui-ux message
Where di d you link it?
Honestly I'm probably like 50% of the way there with my app at this point but I really gotta say I'm super grateful
Sometimes you also have to take time and experiment with system you are working with. Manual can also explain a lot about UI
I've sat and messed with it for hours, and even read documentation
But I just couldn't figure this thing out
I've done a lot with the UI tools at this point with good success with it, but this just escaped me
I can't tell you how long I worked on this, 1000x thanks
Thank you.. will check it out.. What do you mean? My video and my description didnt explain it well? I dragged an object UI IMAGE . You can see in the video the 4 anchor points stayed same position and just the Image moved, and not the anchors together. I am not sure what can I explain more.
You are showing barely minimal information there. Not even an inspector window, so I can only guess you are moving it around in absolute mode.
I just imagine that there is noway to achieve what I want based on the link your provided and all the research I have done. Thank you for the help tho.
Also anchor points are.. anchors, they are there to provide base orientation. If you want to reset anchors click on stretch mode
I want them to follow the image I moved on the video above and not stay in the same position they were
So I dont need to reposition them again.. and they will just follow the image I am dragging
I imagine its not possible to do it I guess
Actually, I have one more question @azure flame
How would you do this anchor adjustment for objects in a layout group like this
wait, nevermind maybe
Yeah nevermind
Thanks fogsight
I don't have time to actually change my main app tonight but I'm confident I can solve one of the biggest long standing issues I've been dealing with. Again, thanks a ton man
Yea, I don't know why it's not a built-in thing, seems to have utility. There's an example of setting anchors with code here, it creates editor tool script. https://discussions.unity.com/t/how-to-snap-ui-element-anchor-relative-to-image-sprite/230111/4
It looks like parent component controls it. I think anchors there will already be sitting on the cell itself so it will resize proportionally. You might be able to nest another object inside and change its anchors if you want to tweak it.
This might be useful to you, Dylan, as well
This is super useful, thanks for tagging me
Thank you.. should be amazing to be a built in feature
Where should I place that script?
Do I need to download something?
I think this one required Editor folder, folder itself can be anywhere.
Just a folder with name Editor?
yes
Doesn't seem to require Editor even, works as is perfectly.
it looks like it is using visual scripting package, you need it for that
So in package manager? I tried to find there and couldnt find it
install package by name com.unity.visualscripting
Cant find it even on the website to download it.. did u find it there?
Also its saying that is already installed by default.
From Unity Editor version 2021.1 onward, Visual Scripting is installed by default as a package.
So I should have it but when I go to the edit and project settings its not there the options.. hmmm
It seems used only to enable getting RectTransform from context object which otherwise doesn't have it.
your package manager looks dif than mine
Mine doesnt hav eit
doesnt exist anywhere and also cant find to download.. 😟
everywhere that I see seems that I should hav eit already but for some reason its not there
Ok I used ChatGPT and now its working without the visual studio @azure flame Thank you
@scarlet ether Change these lines and remove Visual scripting.
var rt = (RectTransform)command.context;
var rtParent = (command.context as RectTransform).parent.GetComponent<RectTransform>();```
Already did, used chatgpt and it fixed for me.
context is already RectTransform it was unnecessary to get component out of it
that worked for me
You dont know how much this will save my life I have been suffering so much hahahah
THANK YOU !!!!!!!
I should look it over later to see what else I can optimize there.
That is how chatgpt arranged for me: https://paste.ofcode.org/mMdhDqQbUbJqcn2h4WX296
Now this will save me hours
I have been suffering
hahahaha
Best would be creating a hotkey for that if possible
than would be GOD
language model didn't fix other mediocre choices in that code
You should not use things it generates as is
I tried to make in a way to use a hotkey.. it shows the hotkey ther but doesnt work
I selected just the object in the hierarchy
Even tho clicking on the component it doesnt work.
its blue as it is selected
Anyways its amazing already I have like 1000 images on my game and I had to do all manually so far.. I wish I had asked that before.
How to make the text overlay the object?
Any repository of hot UIUX tips someone could recommend?
Is it billboarded?
hey guys why my text mesh pro looks like this and never shows the text?
Does anyone knows a way to stop the menus to stop stacking on one another cuz mine stacks which covers the previously open rather than disappearing
Why would/should the other menu disappear?
Oh I need the other menus to return to being hidden once you click another menu
like menu 1 is open then you click menu 5 without closing menu 1 menu 5 covers menu 1 instead of menu 1 closing
its not so obvious but I don't wanna risk getting found out later this is my only problem left sigh~
also if you open menu 5 without closing it and wanna see menu 1 you won't be able to see it cuz by some reason menu 5 covers the entire thing so menu 1-4 is covers by menu 5 unless you close it
How are the menus made (UI toolkit, the old UI system)? Can't you just make some sort of activeMenu variable in your menu manager and do something like this (pseudocode):
activeMenu.active = false
newMenu.active = true
activeMenu = newMenu
Nothing will happen automatically, you must make sure the open menu is closed when you open a new one
thanks anyway I didn't use it but the advice is welcomed took a lot of time though, anyway thanks man
I'm not sure what channel this question belongs in but I am having an issue where my UI Images don't seem to be centered, no matter what I do...
If you look at the images I have attached, you will notice that the smaller image that is just a copy of the larger one with darker color doesn't fill the larger one completely straight. The surrounding "frame" is somewhat thicker on the right side.
If I try to move the smaller darker image to the right, I get to 0,3 and there is not difference to 0,0 whatsoever, as you can see in the images. It is still skewed in the exact same way. Then once it gets to 0,4 it flips over and is more skewed towards the other side. So no matter how I position the image, it's always skewed towards one side.
I've also tried inverting the image by setting X-scale to -1 instead of 1 just to confirm that it's not the image itself that is crooked but that didn't change anything at all. As you can see in the final image, I also tried with a basic stock image of a circle and the exact same problem persists.
I have tried several different ways of anchoring the image and I've tried using a layout group to position the child in the middle center but the images never seem to be entirely centered on each other.
What could be the cause of this?
Never mind, I seem to have fixed it by just enabling "Use Sprite Mesh" on the Image-component... "Preserve Aspect" doesn't seem to affect anything but this sprite mesh did solve it entirely...
What do you mean?
IMO, that yellow bar should be in the left corner as currently it looks awkward
Hey there, anyone know why my custom cursor is 4x bigger than the default one?
what's the resolution of the image?
I tried 64x64 and 32x32 both same result. If use mode ForceSoftware, it fixes the size, but it gets laggy moving the cursor
Ok, when I change the cursor size on windows, it affects the cursor on unity, but in unity is always bigger than on windows
I have a Content Size Fitter on an Image, and a Content Size Fitter on a Text that is a child of it.
The image is a frame and so I need the Image height to be the height of the Text + some padding. How do I get that padding to work? RIght now it's forcing the Image to have the same height as the Text, so the text is overlapping the frame's edges
Found the solution. The frame image also needs a vertical layout group with the padding
Is it possible to force unity to build the game in a certain aspect ratio?
I want to build the game in 16:9, but it keeps becoming 16:10 in the final build.
Attached are my settings -- is there anywhere else I need to change things?
Thank you!
Nvm -- I had to delete my build instead of replacing it -- it looks like that ended up fixing it!
What is this? A new UI framework?
https://docs.unity3d.com/Packages/com.unity.dt.app-ui@0.3/manual/index.html
It seems to be built on top of UI Toolkit
Ui for people who like react
Actually move it into the canvas. (the big rect to the right)
how do I hide the backside of text/images? I have these on a canvas that exists in world space, but I dont want them visible from behind
I have a horizontal layout group that doesnt controll the childs size. When I instancite elements into that it doesnt want to update, I have tried forcing with forcerebuild and tried disable and enable but it doesnt really work. Anyone faced anything similar?
I have a solution now with a ienumerator that has a while loop with force update while the entire animation plays and then a action that stops it when animation is done, doesnt feel very elegant but it kind of works
Why does Unity's Editor keep turning on Normal and Tangent shaders for my canvases even when I manually turn them off? For that matter, if it knows they don't work for Screen Space Overlay, why does the Inspector even turn them on in the first place?
How would I do that?
Select your Canvas and press F
so you understand where it actually is
Nevermind I got it thanks for the help 👍
Are there any plans to control font size on Editor for Linux and Mac?
HI folks... I have a vertical scrollview. I want to know how to make content children adaptive to screen resolutions. Thanks in advance 🙂
They are used by TextMeshPro
I am adding localization, the chinese font gets squares around it when viewed from further away (in game too)
Anyone know how to fix this?
Usually this issue happens when you have an incorrect ratio of Sampling Point Size to Padding. Try keeping that around 10%.
(also it takes 5 seconds to google why your textmeshpro has squares around it)
Unfortunately I have a trained dog in my house which is ready to tear my legs apart if I google a question about textmeshpro. Thank you.
hello, im using TextMeshPro buttons and they just won't click or activate
hover styles don't do anything either
i believe with this current config it should work.
nothing at ALL clicks or does anything even with linked actions
Hi, Is anyone having a problem with TexmeshPro Input in Unity 6? When I type text, my screen changes to look like an ipad screen, causing the layout to break.
your background is currently on top of everything. so that's what you're clicking on
(the Background gameobject)
because for the ui, the hierarchy order decides whats on top of eachother
What does "look like an iPad screen"mean
The interface is narrowed. If in version 2022, the virtual keyboard only displays over the app interface, in Unity 6, when the virtual keyboard appears, the main interface will be narrowed.
I think it has problem in: unity 6 new input system UI input module
I tried removing the background it didn’t work still
then something else is blocking your buttons?
I’m not sure if world objects can do that
There’s only buttons
do I have to set the Z level?
no, maybe try deleting the eventsystem and making a new one?
done, nothing happened
do your canvases have a graphics raycaster component
yes
-# properties are same on each canvas
thats not a graphics raycaster component
oops
wrong image
i placed the whole everything UI related onto the top of the hierarchy and that fixed it
as in, on top of everything in the explorer
so there was some other ui objects covering it up
no, because i moved everything UI related to the top
anything UI is under that UIManager object
maybe you accidentally created some other ui objects somewhere else
Probably using a shader for a different render pipeline
I have urp installed, should I create a maintex texture2D manually?
also I created it Shader Graph > URP > Unlit Shader Graph
hi I had a question related to the UI system so I have an puzzle system wheres its an Image that will have rotating ring that you gotta rotate to make the image such as the first image.
and I want to group them so I can scale them and scale them down but the problem it does this :
when I resize it or scale it up
thats the structure so far and their pivot.
is there something I am doing wrong? how would I make that the sprite resize with its parent uniformly?
Hey, I want to scale these bars down vertically and move the icons to the left so I can get rid of the text, but I don't know how I would do that since my background is black, I don't think changing the icon's colors would look very nice, does anyone have an idea of how I might do this?
you can try layering an image underneath the UI and select the color for that image to render the text of the color of your choice
so the issue was instead of sscalling it up and down I was changing the bound using this :
Hi guys, question. .When I have a button and I set a color to change when the button is highlighted.. It works.. but if I click on the button the highlighting stops to work.. any tips?
yes - pay attention to and learn how this works: https://docs.unity3d.com/Packages/com.unity.ugui@3.0/manual/script-SelectableTransition.html
Thank u
That is just the same as it informs inside unity.. didnt help. Thank you anyways 😄 I will just leave as it is.
What is the best solution for UI currently ?
- Old canvas way
- UI Toolkit ?
A lot of new Unity tutorials didnt use UI Toolkit and i think some things are missing on it
Do i need to use canvas and Switch to UI Toolkit when its ready ?
Unity UI, it isn't "OLD", its the production ready way at the moment
for game play/realtime UI
UI Toolkit is better for In Editor UI
Than GUI
So for ingame ui, you recommend to use canvas instead of UITK ?
Yes.
any idea why my item ui prefab changes rect values when i parent it via code
i want the values (left/top/right/bottom) to remain 0. but when parented they changes to this
It's best to spawn it with the version of Instantiate that takes only a parent transform
Instantiate(prefab, parent)
That works best
Instead of parenting it after
oh ty, didnt know u could do that
but do u know why it adds this offset? how do i fix this
What I said will fix it generally, but it's hard to say without seeing your code etc
nvm that fixed it somehow ty again
Hey, how do you properly sort VFX particles against the UI canvas system?
I'm trying to understand the "correct" setup. its a 2d mobile game. I want to have my VFX render above the board, but below any menus that would open. I want to make sure the VFX image/camera rescales to the overlay if the dimensions were to change.
I've tried multiple cameras but that appears to be expensive. The issue is also what camera settings to use, so that it keeps proportion with the screenspace overlay canvas's dimensions. It says overlay auto scales so that's a problem that could cause scale parallax (ex. vfx camera scale is out of sync with overlay, and therefore creates parallax)
Maybe the question is "how do you make a camera scale to the screen space overlay's dimensions dynamically" while being performant? Ideally without an update loop, since it would just scale once on Start/Awake to the mobile phone dimensions
Any suggestions on approach?
Why does my UI not show up if I have a camera with a target texture. All the UI is on a canvas and it only shows up if I manually click it on and off while in game.. Really strange
Hi guys.. if I scale the size of the game window.. everything scales as it should.. and stays in place. but the UI text always maintain the same size.. any ideas how to fix that?
Unity 6 made a new canvas, why does all elements look like this but fine in game view?
derp sorry was in wireframe view
Can somebody with localization experience please help me with this?
Hi everyone, 🙂
I'm at a stage in the development of my game when I'm considering what UI solution to use.
I cannot find recent state-of-art of UI in Unity so I'll recap them there trying to get anyone's attention to enlighten me on the experience you had with any of these solutions!
Built-in solutions
- UGUI
We all know how to use it, legacy UI system, game-object based, production-proven, etc. I enjoyed using it but there are many aspects that I feel bad about using it nowadays. The usage of prefabs for templates is a mess when interfaces start getting complex. Updating colors/themes/variables through several of them is not convenient either. In addition to that, and unfortunately (or not), its deprecation has already started with the introduction of UI Toolkit, which claims proposing better performance, architecture, and support, so I don't feel like starting a fresh project using a soon outdated system right now. - UI Toolkit
Announced as the replacement to previous UGUI, I was excited starting using it to convert my Figma template into the engine. Once used to the very basic layout logic from the web, using UI Toolkit is game-changing for quick iteration, it doesn't bloat scene hierarchy, styling and behavior are truly isolated from structural definition. However, my disappointment came sooner than I expected. I searched for basic shadow effects which I consider inevitable when designing interfaces and I couldn't find any support about it as to my great surprise they are not implemented. So, my concerns are about its limited features, including missing blur, shadows (most annoying one) or custom shaders, which sadly make interfaces look pretty much visually poor.
Third-party solutions
- NovaUI
I've read through NovaUI page and consider it as a potentially strong candidate for replacement of previous built-ins solutions suffering from being either inadequate/soon-unsupported or too-early/incomplete. NovaUI is still game-object based (as UGUI) and provides a wide range of features. Its free version is very permissive as it only misses Burst optimization compared to paid version (which is only 55€ where I live). I'm wondering "why not" but lacks of any thoughtful feedback. - Rive
I've watched a talk from the CEO of this solution and found it very neat. It provides a totally external desktop client to use the same way you would do with After Effects/Illustrator. Then, your project can be imported to Unity and rendered onto a Unity render texture. It looks very promising, powerful and performance-friendly. On August 13, they removed the limit on files for the free tier. I'm not aware of missing game-changing features in free-tier except audio and custom fonts (there is Google Fonts accessible though, might do the job if you don't need very specific fonts). This solution is subscription-based and pretty expensive if you're not a solo dev (32$/seat/month)... - ReactUnity
Open-source, runs a React renderer within Unity. It is lacking great documentation and might have a performance overhead, but still a plausible alternative if needed. Colossal Order used a similar approach for Cities Skylines 2 (according to their latest talk at Unite). I'm not sure if it really worked for them though.
It might be better I open a discussion for this kind of topic 😄
So, what solution did you chose for your project
None yet, reading stuff since the last 3 days haha
Like me 😂
hello
someone have any idea why all text in my game randomly changed on green?
I was just changing some cursor settings
its setted to white
any code changes
uhhh
I just found it
idk how
i sware i dont changed that
Hi, I have the problem that, while importing a .png as a sprite (2d and UI) my icon gets scaled in a way it looks really bad while even windows explorer (Icon above) displays the image correct. How can i fix that?
its because its way too big. 800x800
looks like it should be a small button
yes in this case definitively, but I have the same problem with all of my icons (all of them are 800x800), some of them are used in cases where it is required to display them bigger. Is there a way to configure the sprite properly, so the scaling works fine (like it does in windows explorer)?
Well, I just scaled it down, looks way better now. Thanks!
Hey everyone, quick question. I want to change the size of my text field to accomodate for the text box portrait ONLY when the portrait is active. Is there a way to do this with the UI content fitters, layout groups, and such?
Anyone?
In a local coop/couch roguelike where players have to choose between 3 upgrades on each levelup, how do you incorporate that for 4 players?
I was thinking of partitioning the screen into 4 quadrants, one for each player and showing the 3 upgrades for each player in their quadrant, but it might be too small. How would you design it?
A little UI that pops up above the player's head is one option
or you pause the whole game and let the one player choose a thing
Currently they all level together. So would this entail that each player would choose their upgrade one after each other?
Sure that's one option
Might not be very efficient
might be annoying
if they all level together, pausing the game and splitting into quadrants makes sense to me
Anyone have ideas on how I could achieve this sort of blur effect?
Hi! I was implementing a minimap into my game and I've got it working well. I want to make it so that instead of the icons abuptly cutting off at the edges of the minimap it instead slowly fades way. I was wondering how I could achieve this effect?
wondering if there's a way to make a slider that slides on an arc instead of linearly?
after some searching it looks like there's no hard and fast way to do that with unity ui components, just have to manually set the position
Looks more like rotation than setting a position
Thank you but that doesnt help.. this is not related to my issue.
Trying for some weeks here but it seems nobody know how to fix that and I cant find it online 😦
Are you using UGUI or UI Toolkit?
Why do the red tridents start to glitch like this, if I increase the spawning count of this prefab?
And this is the Inspector perspective of tis Sprite:
This "glitch" is only visible through the camera.
The Scene View doesn't have this issue what let me guess that its maybe a Graphic Quality setting, that is blocking those full sprites, if there are to many at the same time...
But what graphic setting exactly, in case if I am not wrong?...
what happens if you use bilinear filtering instead of point filtering
Point (no finter) is useful for Pixelart sprites, otherwise you see the difference...
yeah but that's super zoomed in
how does it look when you're zoomed out
those part in the yellow circle would look a bit more like balls instead triangles.
But anyway, I guess I found the issue.
And it was a combination of the default 16:9 Landscape resolution and the "pixels per unit" scale of the sprite.
Thank you anyway.
How do I change the current active locale via c#?
Has anyone faced any issues with UI freezing the editor when upgrading from 2022 to unity6? Even when editing a prefab of a canvas with elements inside, the editor just hangs. Checked all logs and theyre empty. I noticed its mostly from Grid/Horizontal group layouts..
Not sure if this would be best to ask in here or #🏃┃animation
For buttons if have the transition set to animation, how to do you have it so the timing is the same as if it was set to color tint?
The default for animation transition seems slightly slower
Is the best way to do that to just adjust the animation speed in the animator?
Nvm I see
Just needed to adjust the transition times
Try to create a custom shader for your button in the canvas and follow the tutorial:
https://www.youtube.com/watch?v=rSYXieJadIA
Im pretty sure the same code can works for your use case
50% off new release discounts on the Asset Store: https://prf.hn/l/dlR3glw
- It's a tradition by now, I have to find every way possible to make blur in Unity. This time it's in HDRP used as a UI background and I'm using the custom pass feature with a very simple shader made in shadergraph that I discovered by accident.
- Made in Unity Editor 20...
Hi! I was implementing a minimap into my game and I've got it working well. I want to make it so that instead of the icons abuptly cutting off at the edges of the minimap it instead slowly fades way. I was wondering how I could achieve this effect?
Getting an error with localization functionality. If you have experience with Localization, please check it out.
I hate unity built in localization holy shit
This is the buggiest stupidest feature I ever worked with
Hey mates, I was wondering how people archive this kind of UI, with clean borders and not pixelated, is this vector art? If not, is it just images with high resolution? If so, how big?
https://store.steampowered.com/app/2612360/StreamWare/
Help, I can't set a UI image's source even though I did set the image asset as a sprite.
Did something change with Unity 6 ?
!ask
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696
nothing changed with Unity 6
Is there any easy way to fix this? It happens on rotated assets.
(Note: This isn't zoomed in. Any UI Asset that is slightly rotated, no mater the size, has this.)
Large scale screenshot in an example scene with just a camera and a white box asset for example. (1920x1080) AA enabled in URP and on Camera.
antialiasing
there is definitely no AA in this screenshot.
As mentioned in second post. AA is enabled.
I stumbled on a thread in the Unreal, but. If I tack on a transparent border, or a black border, around the sprite. It fixes it.
Which kind of AA
There are several options in URP: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@15.0/manual/anti-aliasing.html
idk - antialiasing should fix this issue and that's the limit of my knowledge
I agree with that statement.
If you toss a white box onto a canvas, and rotate it 5 degrees, you should see the same effect.
Is this an overlay UI?
If it's overlay then the settings on the camera aren't going to help
That would be it.
Cheers.
Simple fix will to be just have a Canvas Camera with its order set to highest I assume.
Thanks again. Looks so much nicer now. This has been driving me nuts for months and I just assumed it was a weird Unity bug originally.
What would be the most efficient way of making a bar like this ? (similar to sekiro's posture bar)
If I simply use a mask and scale it, the filling of the bar would just get squashed along with the mask until there are no corners visible.
I am so fucking done with the official localizaiton system
Can anybody recommend a better one, maybe from the asset store, which I could use?
Theres an official localization system? Must be new since the last time I used it.
In the past, I kinda just ended up writing my own based on a system I used back in like.. Unity 4?
Basically it just grabbed a Excel/Google Docs spread sheet and just grabbed the locatization from there. So when developing I'd have placeholder text, with a script that said "Go grab KEY_MAINMENU_STARTRUN from Spreadsheet in current selected language." then ran my own Database for images that would need to be translated (Which wasn't a lot TBF.)
But looking briefly at the offical locatization, it seems good. What is your problem with it?
What does "ghost objects" mean?
You need to give us some context as to what you're talking about
What does:
although in my components i cant add the ghosts
mean?
I want you to send any and all informtation that would make me understand what your issue is
You said you can't do something
why
what is stopping you?
On which iobject?
Is this an object in the scene?
Is this a prefab?
ok and the ghost objects?
What components are on them?
Ok so
they don't have the "Ghosts" component on them
that's why it's not working
Btw "Ghosts" is a very weird name for a component
in almost all cases, a component's name should be singular
because it represents a single instance of a thing
See how it says "None (Ghosts)"? It needs an object with the Ghosts component on it
because you made your field with the type Ghosts
show me
you named your script incorrectly
The name of the file needs to match the name of the class
public class Ghosts needs to be in a file called Ghosts.cs
you named your file "NewMonoBehaviourScript.cs"
according to this screenshot, it is not
otherwise this would say "Ghosts (Script)"
The file name is wrong
as I mentioned
or rather
the class name is wrong
one of those two
I think actually the class name is wrong
Make sure you saved it
Also make sure you don't have any compile errors in your console window
That's more likely the problem
this is not the unity console window
show the unity console window
you almost certainly have a duplicate script
(probably the one named "NewMonoBehaviourScript")
np
Hey guys, just wondering because this was in every unity version (now on Unity 6) i tested the case:
I can deselect the additional shader channels, the next time i click on the gameobject it's again like that, incluse warning. Am i alone with it? It's just a bit annoying.
TextMeshPro turns them on (and uses them)
At least, that's my understanding
Cheers, good to know 🙂
As i searched i only found that: https://discussions.unity.com/t/the-textmesh-always-make-the-canvas-has-some-additional-shader-channel/698507
Is anyway in Unity to create shadows for UI like in Figma or something?
UI TEXT
Never tested it: https://assetstore.unity.com/packages/tools/gui/true-shadow-ui-soft-shadow-and-glow-205220
oo okey i will test it
Would anyone know how to add a UI transparent gradient effect? I'm making a minimap that has icons for rooms/entities, no borders and no background. The set up I have right now makes it so that the rooms and icons are cut off at sharp edges due to the mask and using a square image as the mask. I was wondering, how would I make it so that the room icons and contents of the minimap becomes transparent as they reach the borders of the minimap? Should this be done through scripting or is there an easier way to achieve this through the unity editor.
Hello. I have a slight problem. I have this setup in my UI:
Page Indicationwith only Rect Transform, that has 2 children:Selected Page Indicatorthat has only Rect Transform and Image componentsUnselected Page Indicatorsthat has Rect Transform, Horizontal Layout Group and Content Size Fitter set to min size (for both axis). It also has 4 children that all have Rect Transforms and Image components.
I wantPage Indicationobject to be same size as children, like with content size fitter min size, but when I set it to min size or preferred size, it becomes 0. What should I change?
P.S.Selected Page Indicatorshould be on top ofUnselected Page Indicatorsobject
Thank you for advice
Is it possible to create curved HUD elements in Unity?
of course
you can import any shaped sprites you want
you can also use the vector graphics package to import svgs
You can also use postprocessing on your UI
Or write custom shaders to do whatever you'd like
thought about making something similar to the dragonball sparking zero HUD, seems curved, but not sure how it's done haha
Screenshot?
It seems as if it is bit curved, having bit of a 3D look
Could be lots of things.
Just well designed art
Postprocessing
Possibly a custom shader or two for the bars filling with the curved shape
unity 2022.3.30f1 why does my textmesh pro offset down a bit when i run the scene? other game objects dont offset only the text
Hey everyone, looking for feedback on some UI choices for my fire emblem style game. I would appreciate it if you could fill out the survey, thanks!
Either fading texture or custom shader, texture would be easier
Having some headache with nested layout groups. Seems to just eat away at the space when i enable flexible height/width.
Seems like making the parent layout element to flexible high/width, priority = 0 seems to work though.
Photoshop
Usually, it's done with a premade texture. It doesn't even have to be tall, so even 512x1 could do the job. Or wider one, if you don't need high quality.
It's just a gradient. Make the image white, set the alpha to 0 on either end and export as a png
This might seem simple or I'm having a brain fart, but per each character I add the Panel just decides to "add" a small margin on each side of the text?
Though in the inspector there's no margin whatsoever. I'm using textmeshpro, anyone have a clue what's up with this?
when i increase outline thickness of text mesh pro. grid starts to appear. what am i doing wrong? the font assset was created using Text Mesh Pro Font Asset Creator. render mode: SDFAA, sampling point size: auto sizing. padding: 5. packing method: fast
I'm trying to switch from hearts to a health bar in my game that can be upgraded, but I'm having problems with the "current health" bar never reaching the end of the "max health" bar when the player is at full health after the player upgrades their max health. First screenshot is unupgraded max health, second is upgraded 1 tier, third is upgraded 2 tiers, and fourth is upgraded 3 tiers. The player is at full health in all of them. HealthBarTotal is max health. The health bar script too long to send along with the rest of this message so I'll send it in a separate one.
Healthbar script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Healthbar : MonoBehaviour
{
public static Healthbar Instance;
[SerializeField] private health playerHealth;
[SerializeField] private Image TotalHealthBar;
[SerializeField] private Image CurrentHealthBar;
private float initialMaxWidth;
private void Start()
{
Instance = this;
initialMaxWidth = TotalHealthBar.rectTransform.sizeDelta.x;
UpdateMaxHealthUI();
}
private void Update()
{
UpdateCurrentHealthUI();
UpdateHealthBar();
}
public void UpdateMaxHealthUI()
{
if (playerHealth != null)
{
float newWidth = initialMaxWidth * (playerHealth.maxHealth / playerHealth.startingMaxHealth);
TotalHealthBar.rectTransform.sizeDelta = new Vector2(newWidth, TotalHealthBar.rectTransform.sizeDelta.y);
}
}
public void UpdateCurrentHealthUI()
{
if (playerHealth != null)
{
float healthPercentage = playerHealth.currentHealth / playerHealth.maxHealth;
CurrentHealthBar.rectTransform.sizeDelta = new Vector2(
TotalHealthBar.rectTransform.sizeDelta.x * healthPercentage,
CurrentHealthBar.rectTransform.sizeDelta.y
);
}
}
void UpdateHealthBar()
{
float healthRatio = playerHealth.currentHealth / playerHealth.maxHealth;
float totalBarWidth = TotalHealthBar.rectTransform.rect.width;
CurrentHealthBar.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, totalBarWidth);
//CurrentHealthBar.rectTransform.anchoredPosition = TotalHealthBar.rectTransform.anchoredPosition;
}
}
i like how 3 people have been asking for help in here today, none of which have gotten any help -_-
It looks like t in your font has a spacing issue on the left. You can edit it on the asset for the letter I think. Or swap the font.
I've actually tried it with other letters and it does the same, as well as a different font.
Don't use scale to position things. Use anchors and element size. Scale is useful for animation. If all of your items at full health retain proper scale then you can easily set bar percentage reducing scale for the filling element (then scale becomes percentage 0-1f). Just make sure it is anchored on the left side.
Maybe textmeshpro itself? Because the other font i used was its default font, and legacy text doesn't do what textmeshpro is doing, but I still need textmeshpro for some effects I gotta do on the text later on