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
1
answer
44
views
Unity UI Builder InvalidCastException
I am making a custom UI with the UI Builder for my scriptable object that holds some data for the AI Player. It all worked fine until I added a third slider for a new value I needed; now the object ...
0
votes
1
answer
192
views
UIElement button does not work when clicked
I have a small issue with my UI. Whenever I click a button on my pause menu ui nothing happens even when I hover over the buttons. However, in my main menu scene, the UI works without any problems. ...
0
votes
1
answer
68
views
0
votes
1
answer
245
views
Canvas that should only be visible for local player is also visible for remote players
I'm using Unity NetCode for Game Objects. I have a player Prefab, inside it I have a canvas as a child of my player Prefab (I don't know if it's the best approach), which contains inventory, status, ...
0
votes
0
answers
158
views
Is it possible to prevent a graphic raycaster blocking 2D rays in different layers, from a different camera?
I have a graphic raycaster attached to a canvas, with the blocking layer set to exclude all layers except "UI":
...
0
votes
0
answers
95
views
Add a controls instruction overlay to game HUD
I was wondering how I could make an instruction panel for the users of my game in Unity.
I will add a photo to this post that shows an instruction panel.
Any explanations would be much appreciated!
0
votes
1
answer
335
views
Unity debug error “Frame not in module”
I'm creating a 2D game, and all my game layers are UI canvases. Here's the issue: during debugging, every time I click on the screen, Visual Studio stops and displays "Frame not in module," ...
0
votes
2
answers
820
views
Adding text label to sprite
I'm completely new to Unity. I'm trying to create something similar to Scrabble.
I've simply got a tile as a sprite (red arrow).Firstly, I don't understand it being so small.. I'm trying to give the ...
0
votes
1
answer
192
views
Why can't I press buttons after re-enabling the UIDocument?
I have this UI with buttons that should be clickable whenever the UIDocument is enabled, but for some reason whenever I disable and then re-enable the UIDocument (in the second code block), the ...
0
votes
0
answers
66
views
Enable socket interactor only when previous sockets are occupied
There are 3 boxes and 3 socket interactors. I only want the second socket interactor to work when there is a box in socket one and the third to work when there is a box in the first and the second ...
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 ...
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
0
answers
120
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
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
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
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
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
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 ...
0
votes
2
answers
969
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
494
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
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.
...
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 ...
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 ...
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, ...
0
votes
1
answer
1k
views
Transforming world to canvas goes wrong when camera is moving
I am attempting to draw a box around a selected target in my space game. I had this working fine using normal techniques when my canvas was set to Screen Space - Overlay. However my setup is that ship ...
0
votes
1
answer
226
views
Changing the target of a button that takes a gameobject as a parameter
I'm working on a point and click system in Unity and I have a contextual menu that appears when you right click on an object. In this menu, there's a button called "search" that moves the ...
0
votes
0
answers
270
views
Stop OnDrag callback when user's finger is stationary?
There's an section of the documentation that refers to something that may be the answer, but unfortunately, if I keep holding with my finger the draggable object, even when I'm not moving my finger, ...
0
votes
1
answer
853
views
How to use OnDrop on non-UI elements?
I'm new to Unity and coding (C#), so sorry if this is a novice question.
Is the OnDrop function only usable for UI elements? I am currently making an ARPG Card game ...
0
votes
1
answer
221
views
Player object changes position when I click the pause button [duplicate]
I have a simple mobile game where every time I touch the screen, the car changes direction.
The thing is, I need to implement a pause button, but when I click pause I need the car to stay still and ...
0
votes
0
answers
779
views
Unity UI Line Rendering (UILineRenderer) pixelated
I'm using UILineRenderer to draw curve of the map. The one thing I'm finding is that the drawing is pixelated despite adding more data points. setting the quality in game view to 4K UHD, and ...
0
votes
0
answers
1k
views
How to place object on top of ui?
I'm trying to place a 3D object on top of a UI Image
But nothing works. Can anyone give an example of how to add a 3d model on top of a UI Image in a 2d game.
The strange thing is that I have all the ...
0
votes
1
answer
1k
views
Why is button component's animation transition just working for some buttons?
I have a main menu scene in which the buttons work using button component's animation transition. I created a simple animation for them that changes their vertex color to blue when selected. The ...
0
votes
0
answers
52
views
Unity layer masks
I read from the book that 0 - 7 layers are reserved layers in Unity but when I open layers on Unity its showing me that I can use layer-03, 6 and 7 and so on. So can I say that only 5 layers are ...
0
votes
0
answers
176
views
Disable UI button does not work when calling function directly, does when calling intermediate function that Invokes disable with a delay of 0
Trying to understand the Unity UI system.
I have a panel that contains a button that should hide the panel.
When I wire the button up to the method that hides the panel, I can see in the console that ...
0
votes
0
answers
12
views
Should I use Unity Canvas for non-UI game objects? [duplicate]
I'm trying to do simple card game. I want players to drag and drop cards from hand to table, from deck etc. The simplest and cleanest solution for drag and drop I found is to use Image object on ...
0
votes
0
answers
189
views
How to go about implementing level selection map that is repeatable texture in Unity?
Basically I have an image that represents a map where you go from one level to another. I was planning for this image to repeat it selfie while you go up thru the map to new levels( something like the ...
0
votes
0
answers
193
views
Why is the back layer sometimes rendering in front?
I have a layer rendering issue, where the top layer of content will sometimes not render to screen as it appears that the bottom layer is rendering on top (even though it's behind in world space). It ...
0
votes
0
answers
80
views
Deserializing Unity Mixed mode into YAML
is there a way to deserialize .unity and ProjectSettings file in binary format down to yaml? I provide an example of one of such ...
0
votes
1
answer
356
views
On a UI element(Input field) and overlay canvas how do I find the very bottom middle pos of the UI using it's height from it's rect transform?
I'm trying to place one in our field right below another, all ui belonging to an overlay canvas. I tried doing a few different ways subtracting height from different position types including rect ...
0
votes
0
answers
98
views
Is it optimal to use UI Canvas for a 2D platformer background?
Using UI Panel component is convenient in the sense that the panel will always be stretched to the size of the screen at any resolution, unlike a sprite (in simple mode) the size of which depends on ...
0
votes
1
answer
199
views
Trigger Button with specific key only
I am having trouble understanding how to trigger a UI button with a specific joystick key only.
Currently i have a pause menu in which i have several buttons. By pressing start i set the game time ...