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
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 ...
2
votes
1
answer
917
views
Unity ScrollRect: Pass scrolling through to parent ScrollRect when reaching limits
I have a nested ScrollRect, or more specifically a scrollable list inside one of the items in another scrollable list. Think of it as a scrollable menu with one of the items including a scrollable ...
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 ...
1
vote
2
answers
18k
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 ...
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
466
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: ...
0
votes
1
answer
854
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 ...
1
vote
0
answers
1k
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 ...
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 ...
1
vote
0
answers
501
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 ...
0
votes
1
answer
169
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 ...
1
vote
0
answers
247
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 ...
0
votes
0
answers
780
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 ...
1
vote
2
answers
2k
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 ...
1
vote
0
answers
139
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 ...
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
356
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 ...
0
votes
1
answer
639
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
2
votes
1
answer
5k
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:
...
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
1
answer
703
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 (...
3
votes
1
answer
987
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 <...
0
votes
1
answer
778
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 ...
0
votes
1
answer
770
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 ...
0
votes
1
answer
389
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 ...
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 ...
2
votes
1
answer
288
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 ...
1
vote
2
answers
952
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. ...
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
159
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 ...
1
vote
0
answers
196
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 ...
2
votes
1
answer
14k
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?
1
vote
0
answers
40
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 ...
0
votes
1
answer
255
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 ...
0
votes
1
answer
2k
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 ...
0
votes
2
answers
8k
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 ...
1
vote
1
answer
186
views
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
1
answer
2k
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 ...
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 ...
1
vote
1
answer
3k
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 ...
0
votes
1
answer
1k
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.
0
votes
1
answer
2k
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 ...
0
votes
1
answer
116
views
How can I make a button active when all the items of my array have been displayed? (for a dialogue scene)
I've coded something in Unity using C# (see below) for a dialogue scene separate from the actual game. On the click of a button from the game, the player is taken to this dialogue scene where the ...
2
votes
1
answer
1k
views
How to make a Unity slider sit over evenly spaced points?
I'm working on a timeline UI element in Unity, that looks like this:
I generate the bottom ticks by instantiating a number of times over the length of the parent RectTransform, and offsetting them on ...
2
votes
1
answer
1k
views
Unity UI Toolkit | Select Background Image and Position of a VisualElement
I am searching now for almost an hour and I cannot figure out how correctly to select the background image and position of a visual element.
The query docu is really poor, there is literally nothing:
...