2022 Developer Survey is open! Take survey.

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 views

How to get selected value in a dropdown

I made a simple survey from a guide on YouTube. The trouble is that dropdowns are not mentioned in there, and I have totally no idea how to get the selected text value from it. I tried multiple ...
user avatar
0 votes
0 answers
19 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, ...
user avatar
0 votes
1 answer
56 views

Reference as local variable in Unity c#

In the script below, "btn" is a local variable in OnEnable() method. It's said that local variable is deallocated (lost) when leaving the countaining method. Why this one (btn) is not ? Nb: ...
user avatar
  • 43
0 votes
1 answer
23 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 ...
user avatar
0 votes
0 answers
12 views

How do I control drag speed of Unity's scroll view to make it slower than mouse drag?

I'm having an issue figuring out how to make the scroll move slower than very fast mouse drags/swipes. I've tried changing the scroll sensitivity, inertia deceleration rate, and the EventSystem's drag ...
user avatar
0 votes
1 answer
19 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 ...
user avatar
1 vote
0 answers
28 views

How can I instantiate an object at a certain position?

In my game, the player drives a car and when the car reaches the end of the road, I want a different road prefab to be spawned. I have multiple road prefabs, and want to be able to spawn one when the ...
user avatar
0 votes
0 answers
16 views

Unity/Android throttles resolution to 1080p on mobile and returns Android status bar height of 0 when system running at 1440p?

I understand we can usually get the height of the Android status bar with: ...
user avatar
  • 197
0 votes
1 answer
19 views

Menu not disappearing after input

I am having some issues with the UI and the Input system. What I am trying to do is "simply" to make a menu appear and disappear upon pressing a certain key. To do so, I created an animator ...
user avatar
  • 176
1 vote
0 answers
17 views

How to tell which letter or vertex of a letter is at a certain screen position with a Unity UI Toolkit Label or TextElement?

I am using the Unity UI Toolkit and I would like to create my own TextField class (ie. input field, similar to the one I'm typing in now to write this message) with better functions using the Label ...
user avatar
  • 197
0 votes
0 answers
37 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 ...
user avatar
0 votes
2 answers
31 views

How do I make several Image components transparent collectively as one sprite with a CanvasGroup?

I've run into a problem where using the CanvasGroup component to fade in/out several Image components under a hierarchy produces an unwanted result, where each individual sprite that overlaps with ...
user avatar
1 vote
0 answers
36 views

How to make UI animation blend smoothly from the previous state when interrupted?

I have a UI that I want to animate via PointerEnter and PointerExit, but if an event gets fired while an animation is in progress, it makes the animation jump to the start point of that animation clip ...
user avatar
0 votes
0 answers
14 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 ...
user avatar
0 votes
1 answer
42 views

Default ScriptableObject inspector duplicates on every ListView onSelectionChange

I'm creating some sort of database editor window, and one of the things I needed to do was show the default inspector for the currently selected scriptable object. It was a bit complicated to achieve ...
user avatar
0 votes
1 answer
34 views

Applying animation only to part of a text

Using the built-in text UI, is there a way to animate only a selected number of letters? What I want to do is something like the word "you" in this video and "I'd" in this one
user avatar
  • 599
2 votes
1 answer
366 views

How to create instances of a Unity UI Toolkit template from code?

I'm using Unity UI Toolkit in Unity 2021.2. Looking at the following example: ...
user avatar
  • 123
0 votes
1 answer
107 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 ...
user avatar
  • 71
0 votes
0 answers
16 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 ...
user avatar
  • 101
0 votes
0 answers
17 views

How to take mobie screenshot in Unity but have it be a printer paper resolution and not phone res, so it prints using the full paper size?

So using ScreenCapture.CaptureScreenshotAsTexture(), I then save the screenshot to my phone gallery. However when I print the image it doesn't fill the print paper because the resolution of the shot ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
0 votes
0 answers
8 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 ...
user avatar
  • 101
0 votes
1 answer
79 views

Why does assigning an empty delegate to this Unity Event Action on construction make it work? (But it is dead/broken without it?)

I am learning about Actions/Events in Unity and just built a system around them which works. However, it seems I just got lucky and I'm not sure why. Roughly, my class in a simple illustrative form (...
user avatar
  • 197
1 vote
1 answer
66 views

enabling / disabling components from editor, while avoiding "SendMessage" warning

I am creating an editor tool that requires me to enable / disable components and or gameObjects via script while in edit mode. Currently everything that has to execute in edit mode is called from <...
user avatar
0 votes
0 answers
19 views

Why is my rect transform rotating from setting position?

I was trying to track a UI canvas directly to a game object in my scene. I thought getting the screen point from the world and then setting it to the position of the rect transform would just move the ...
user avatar
  • 1
0 votes
1 answer
98 views

How to update the UI system in unity after changing a triangle in code

I am trying to write a real time Line Graph Renderer using the UI system in Unity 2019. Meaning I need to change the data on the fly and have the graph update. What i have found is that OnPopulateMesh ...
user avatar
0 votes
1 answer
63 views

Arrange UI images in half circle (180 degrees) in Unity

Im basicly looking to create this image: I have all these parts and black background as a separate image so the ideal thing would be to place them with border between them but I could also probably ...
user avatar
  • 127
0 votes
1 answer
26 views

how do place UI in code at bottom screen?

I am struggling to figure out how I can add a UI prefab on screen in code so that it appears "anchored" at the bottom center of the screen. I realize this might be a common question. I ...
user avatar
0 votes
0 answers
40 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 ...
user avatar
  • 127
0 votes
0 answers
32 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 ...
user avatar
  • 131
2 votes
1 answer
67 views

A way to test different DPI's in Unity?

Is there a way to force a Unity canvas set to "Constant Physical Size" to scale based on an arbitrary DPI value for testing purposes? It seems to only respond to the meta-data from the ...
user avatar
1 vote
2 answers
80 views

How to have unity inspector variables modify each other bidirectionally and update in real time [duplicate]

Trying to make some inspector controls that both modify the same thing but in different ways, and I want them to both update when the other is edited. Won't bore with the details but there's a reason. ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
  • 101
0 votes
1 answer
350 views

Unity UI - Multiple Selection with Multiple Toggle Group

I am developing a game with Unity 2019 LTS. And there is a menu scene in the game. Player should select a character and difficulty level in that scene. Both of them have multiple options. For example, ...
user avatar
  • 1
0 votes
0 answers
32 views

How do i prevent the next player from being called?

I got help from someone on making a turn-based button but so far I am not able to prevent the button from getting the next player when a certain bool is activated in the room. Initially, the ...
user avatar
0 votes
1 answer
29 views

How to queue a paid function to run in Unity after an IAP button purchase completes to fund it?

My app will feature tokens to fund some in app functions. If someone clicks a menu button to run a paid function and has insufficient tokens, they should be prompted with a new token purchase menu to ...
user avatar
  • 197
1 vote
0 answers
23 views

How to control from which point radial image fill starts in Unity?

This is probably basic question but can I set the point from which fill starts. I know about down, up, left, right options but I want more control with start point, for example I want my fill to start ...
user avatar
  • 127
0 votes
1 answer
624 views

How do you repeat a tile texture horizontally/vertically in a UI Image?

It seems Unity UI Image supports Image Type 'Tiled', but I'm not sure how to get the tiling to work both vertically and horizontally. Can someone help me understand?
user avatar
  • 166
1 vote
0 answers
15 views

Editing an InputField on mobile with the keypad open, it wont let me edit another field without loosing focus on the current 1st. How to by pass?

When I'm typing into a tmp input field on a mobile keypad, I can't instantly edit another input field by clicking it!? I have to click off the keypad to loose focus on the current before I can click ...
user avatar
0 votes
1 answer
43 views

How to recreate a comic book panel transition with my canvas (simple 2D background art)?

https://www.youtube.com/watch?v=Tqqf5Y8LyR8&t=23s&ab_channel=ErikLoyer So I want to achieve a transition like from the above video, specifically at 0:23 the TRACK, but there is a 3 Dimensional ...
user avatar
  • 1
0 votes
1 answer
189 views

why does my mesh render on top of UI?

I've got some UI elements and a 3D mesh imported from blender. I've tried stuff like sorting layers, so that I render my 3D mesh below a canvas UI element(side panel), for which I put my 3D mesh ...
user avatar
0 votes
2 answers
2k views

How to set a variable from the selected text of a dropdown menu in Unity?

I am trying to set a variable from the value of a DropDown menu in Unity. I wrote a script as follows, attached it to the dropdown and set it to run it in Unity under: On Value Changed (Int32). I have ...
user avatar
  • 197
1 vote
1 answer
100 views

Seeking a more elegant solution to set buttons so they can increase specific ability level and stats

...
user avatar
0 votes
1 answer
59 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 ...
user avatar
0 votes
1 answer
209 views

Unity make an Expandable Scroll List (adding elements) [duplicate]

I am trying to make a scrollable list with premade elements that you can add using a button. The problem is that the list's Content element needs to be exapanded as ...
user avatar
0 votes
0 answers
41 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 ...
user avatar
  • 301
0 votes
1 answer
183 views

Unity UI Image not rendered?

In Unity I created a Panel with 3 children (An UI Image (LogoAch), and 2 TextMeshPro components (Name, Progress)). It looks something like down below: I saved this as a prefab and I try to instantiate ...
user avatar
  • 107
0 votes
1 answer
83 views

Unity 3d when camera is closer the shadows getting clipped weirdly

When in distance the shadows are appearing correctly but when getting near to the shadows it is getting clipped in a weird way. I was not able to fix it. Any help would be appreciated.
user avatar
0 votes
0 answers
74 views

SVG Image in UI

I'm using Vector Graphics for my SVG Images, though when I try to use it as a UI image (for a button) The image doesn't look as I expect, unless I use a Sprite Renderer. But unfortunately I can't do ...
user avatar
  • 1
0 votes
2 answers
242 views

Create buttons in the editor - Unity3D

So I've seen people do stuff like ...
user avatar