Questions tagged [unity-ui]
Unity UI is a UI toolkit for developing user interfaces for games and applications in Unity. It is a GameObject-based system that uses Components and the Game View to arrange, position, and style user interfaces.
222 questions
0
votes
0
answers
170
views
How to prevent transparent world UI elements from hiding post processing?
I have transparent world ui elements in my game like so:
What I've been noticing is that post processing through transparent elements is nonexistent, even though other parts of the scene work with ...
-1
votes
1
answer
318
views
unity onTriggerEnter does not work
so in here there is a box to which i have attaches this script and ATTACH1 is a socket interactor here i want is when the box which i have attaches attaches to that socket interactor the text which is ...
0
votes
0
answers
27
views
Input while using Input System and Unity UI [duplicate]
I'm using Input System and Unity UI and the problem I have is a single event (i.e. mouse press) is being sent to both systems. Here are a few interactions to demonstrate the problem.
Clicking on a UI ...
0
votes
1
answer
134
views
"Button is not an attribute class" error when integrating Steam achievements
I am writing the code for my button, but it's giving me errors like this:
Assets\Scripts\SteamIntegration.cs (60, 6): 'Button' is not an attribute class
Where did I make a mistake in this code?
<...
0
votes
0
answers
119
views
How to adjust resolution to display only in portrait mode for both phones and tablet devices?
I am facing an issue where I'm able to adjust the resolution for different phones like Android and iOS but not for tablet devices.
Is there any way to set it, for all kinds of devices, to display only ...
0
votes
0
answers
44
views
How to update other players after adding a character to the text UI
Hello I'm new to multiplayer development and I'm using photon pun 2 in Unity engine C# language. How can I update other players every-time I add another character to my text UI. The characters that ...
0
votes
1
answer
148
views
How to alternate child placement to the left and right in a vertical stack?
Is it possible to arrange alternate children separately in a vertical layout group?
I want to arrange the child elements so that one is aligned to the left, the next one is aligned to the right, and ...
1
vote
2
answers
3k
views
Interacting with World Space UI
Been struggling with this one for a while. I've found a few other posts across Stack Exchange and the Unity forums that seem to have the same problem, but their solutions don't work for me (at least ...
0
votes
1
answer
675
views
When switching between two scenes: MissingReferenceException: The object of type '...' has been destroyed but you are still trying to access it
I recreated the problem in a new project to check and test the problem, but I don't understand it.
Two scenes:
First scene
A GameObject with this script that simply jumps to the second scene.
...
0
votes
1
answer
535
views
Why doesn't RectTransform.GetWorldCorners() employ any camera?
Typically, conversion methods from world to screen coordinates and vice versa use a camera to perform these calculations, so I'm wondering how does GetWorldCorners ...
0
votes
1
answer
67
views
3rd Button on UI Seems to not Register the onClick.AddListener()
I have a UIManager meant to control the UI. The UI manager is attached to an empty game object.
The Canvas has three panels, ...
0
votes
2
answers
284
views
how can I make dropdown elements unselectable, but can visible?
this is basic dropdown Ui object
I want to make it ,if I click dropdown, show every elements but
can only select top element others not.
like this image, because I made tutorial.
how can I restrict ...
0
votes
1
answer
636
views
How to hide UI elements in Unity?
I'd like to ask a case when developing a game using Unity.
There are many UI elements in the game.
These UI elements normally disappear from scenes when the purpose is achieved.
However, the ...
0
votes
0
answers
142
views
OnPointer events trigger when entering transform, not on custom collider
I want to create a custom UI, specifically an action wheel which offers different actions depending on where or what was clicked. To do that, I create circle segments (slices). I also create a custom <...
0
votes
1
answer
310
views
How to create custom UI element from Hierarchy Menu in Unity?
I have a custom UI element and I would like to instantiate it from Hierarchy like you do with any other UI element (button, text etc.). I know how to do this so it is instantiated in the scene but how ...
0
votes
1
answer
1k
views
Is it possible to detect if the cursor is over a GameObject with a specific tag?
I've tried quite a few things, but none of them have worked reliably. Here is what I'm currently using:
...
0
votes
1
answer
697
views
Particle system objects in UI disappears/appears on screen unless I change the sorting rank
This happens to all particle systems. I tried:
Changing the rendering mode to camera, setting culling mask to UI, particle system layer set to UI
Adding a canvas child, and attaching a particle ...
0
votes
0
answers
98
views
Is it possible to add light/fire effects to the sprite used in the UI (Using Unity 2021.3.25f1
Essentially I want to light all orange areas
Tried changing the render mode on the canvas and rearranging the Image object in the canvas - nothing worked.
0
votes
0
answers
184
views
Unity WebGL Game's Canvas UI scale changes with windows scale
So this is the setting that is affecting my game. My game is a webgl build from unity running in chrome, hosted on itch.io.
At 100% windows scaling setting, the UI elements have expected size,...
0
votes
1
answer
457
views
In Unity editor, how to import package from github?
In the latest Unity editor 2021.3.25f1 LTS, I'm trying to directly import the following package from github:
https://github.com/yasirkula/UnityNativeFilePicker/releases/tag/v1.3.0
But when I import ...
0
votes
1
answer
135
views
Show an image as Tooltip in a Unity 3D
I got the following question:
How to show an image as Tooltip in a Unity3D?
The image should only be visible if the user hovers over the 3d object.
Thanks in advance,
hidayah
0
votes
1
answer
147
views
TextMeshPro Page Mode Issue (Readable Books In game)
I'm trying to implement readable books into my game. Much like Morrowind and Skyrim. I have a system that sort of works, but it appears as though there is a bug that is duplicating some page data, and ...
0
votes
0
answers
212
views
Change textures dynamically on 3D animating object in runtime
I have the following situation, where in I need to animate textures on 3D animating plane in runtime.
There are 5 panels in the unity scene and two buttons, each button, when clicked triggers one ...
0
votes
1
answer
85
views
How do I create a button with a font by code?
I have written a code that would create background image as a button and then show a letter on that button. This should become a virtual keyboard.
I am experiencing weird drawing that looks like this:
...
2
votes
1
answer
2k
views
How to make a sprite fill the image?
I created a custom UI Button:
However, when I use the sprite as the image for a button it doesn't fill out the whole "Collision" area:
This is an example of how I want it to fill the "...
0
votes
1
answer
2k
views
UI Toolkit not firing button clicked event
I'm using the new UI Toolkit and new Input System together, and I've setup everything correctly the Input Actions has separate input for UI, the Input System UI Input Module is setup correctly, the ...
1
vote
4
answers
2k
views
How to make TextMeshProUGUI truncate the left part (beginning) of a line?
I'm trying to display file names including their directory. When the file path gets too long for the text box, I want to align it right, because the filename is more important than the directory.
I ...
0
votes
2
answers
968
views
Unity UI button not working
I'm creating a game in unity and I can't get the UI buttons to work. Here is what I tried:
Added a graphics raycaster to the canvas
Added an events system with an Input System UI Input Manager
...
0
votes
1
answer
2k
views
Scroll UI Image
Currently, I am scrolling a UI RawImage using the following:
...
1
vote
2
answers
243
views
UI Scaling issues only with QHD and 4k UHD
I have a card game, where I'd like to be able to zoom in on a card if it's right clicked. I coded to make sure that if the zoomed card would go over a screen boundary, instead we would anchor it such ...
0
votes
1
answer
1k
views
How to smoothly transition between two images in a image component?
I have a state machine responsible for transitioning between different images, corresponding to player actions. I want to make the image a part of UI, but my main question is how do I transition ...
0
votes
1
answer
74
views
How to implement "Auto Generate Animation" and "Visualize" buttons in custom Button inspector?
I extended the Button class with my own variables. I also had to create an Editor script since Unity manually draws the Button's fields into the Inspector. I just need to know what the functions that ...
0
votes
1
answer
493
views
Assign clickable function to UI Button Unity
So I'm trying to change the function of a button by a clickable method in Unity. I'm using a GetComponent to access the button component of the game object and then ...
0
votes
0
answers
89
views
Lag when filling overlaid images
I'm having an issue where my UI lags if I try to fill an image that is placed in front of another image. Here is the effect I am trying to achieve:
As you can see I have an image in the background (...
0
votes
1
answer
1k
views
UI not scaling properly
I'm trying to create an endless runner type game where once the player dies, a popup opens letting the user know that the player can be saved by watching an ad. This is how the popup looks in the game ...
1
vote
1
answer
1k
views
Is it possible to keep a prefab of a UI element with UI Toolkit?
I'm digging into Unity's new UI Toolkit, and so far I like it a lot; but there are a few things bugging me about it.
I have a dynamic list in my UI which keeps track of way point paths, and it changes ...
0
votes
1
answer
272
views
Unity button highlight not working properly after spawn
I am instantiating a UI button. After it spawns if I hover on the button it highlights properly.
The problem is if I spawn the button and the mouse position is already on top of the instantiated ...
0
votes
1
answer
439
views
Updating UI Graphic vertex positions through code
I'm trying to update the positions of vertices in my project.
I'd been using Unity's built in Line Renderer previously which worked fine, but had some problems when points got too close to each other.
...
3
votes
1
answer
1k
views
Screen split in different regions, each with a different scene
I am a complete beginner in Unity and, after having search for a while, I am still not sure if it is actually possible to achieve what I would like to do.
My goal is to have a game where the screen is ...
2
votes
2
answers
1k
views
Should I destroy dynamically created Image.sprite?
Image sprite is created programmatically
_image.sprite = Sprite.Create(texture, ...);
Should I destroy it before replacing with a new one?
P.S.
My question comes ...
0
votes
1
answer
143
views
Remove default menu controls
I have a vertical layout group filled with UI buttons used as menus in my game. They work well for mousing over and clicking, and I am in the process of adding keyboard controls.
The issue I have is ...
1
vote
1
answer
350
views
Canvas scaler does not work when the UI is Instantiated at runtime
My canvas scaler does not work when the UI is instantiated dynamically.
It does work well in iPhone 6.5 inch simulator:
The problem is when I use 5.5 inch or smaller simulator:
It does not follow ...
0
votes
0
answers
657
views
AudioSource.isPlaying is not working in Unity WebGL Build
I am passing a clip to play on the audio source. Next, I wait for the audio to finish to invoke the next action.
But the waiting loop never ends. Once the audio clip ends, the time I read from ...
0
votes
1
answer
348
views
How to show orientation on an image minimap in Unity
Initial Question:
I'm trying to create a minimap for my game in Unity. It consists of a 2D image sprite within a mask. I've got the rotation and the movement within the mask down, but the only problem ...
16
votes
1
answer
6k
views
Blank 2.2 KB sized PNG costs 2.1 MB in Unity? What does this represent? What to do?
I am starting to work on optimization for my app. I need to understand the information Unity displays about file sizes. For example, just to prove a point, here is a 2.2 KB completely blank PNG which ...
0
votes
0
answers
65
views
Make player object freeze / become non-interactive when text pops up
I have a Dialogue system that shows up when a scene starts or a player touches an object. I am wondering if is it possible to make the player freeze/not interactable when dialogue pops up. I don't ...
1
vote
0
answers
617
views
How to distinguish pointer up inside button vs drag-out
I am making a unity mobile game, I have a simple scene and a canvas with a few buttons and these buttons have scripts that detect if the button was pressed and released. Here is the code for doing ...
0
votes
2
answers
146
views
Canvas element active by default even though it's set to inactive in the script
The pause menu is getting shown by default when I click the play button, even though the GameIsPaused boolean is set to false. I don't know if it's the fault of how ...
0
votes
1
answer
143
views
Getting text dimensions with TextGenerator.GetPreferredHeight/Width not working
I am using Unity 2021.3.3f1 and trying to make a pop up with a sprite as a background, where the size of this sprite adjusts to the size necessary to fit the text.
From what I understand, ...
11
votes
1
answer
3k
views
Non-stretching health bar?
Here's what I want:
Here's what I got:
What is this procedural image unmasking called? Popcap didn't do image-splitting (source images below), but I feel like I'm missing the obvious here.
(Source ...