Questions tagged [unity3d-ui]

For questions regarding the UI system of Unity game engine.

Use this tag for questions on how to use elements of Unity's UI system (such as scrolling panels, buttons, sliders), how to connect those dynamically to code, and how to use the reactive layout system of the UI system.

Unity has full tutorials of the UI subsystem here https://unity3d.com/learn/tutorials/topics/user-interface-ui including both video and written tutorials.

The class UnityEngine.UI can be found at these URLs https://docs.unity3d.com/ScriptReference/UI.Button.html

35 questions
30
votes
3 answers

How to calculate sizeDelta in RectTransform?

I write a custom content fitter that is required for my custom layout. So, I need to control RectTransform.sizeDelta property when anchors aren't same but I can't get that shows this value. I don't need Unity3D API reference, I read it and got a…
Denis Sologub
  • 7,277
  • 11
  • 56
  • 123
17
votes
4 answers

Unity3D UI, calculation for position dragging an item?

These days it's incredibly easy to drag UI elements in Unity: Make a few UI items. Add Component -> Event -> Event Trigger. Drop on the script below. Click to add the four obvious triggers. You're done. However. I'm totally lost in the relationship…
Fattie
  • 27,874
  • 70
  • 431
  • 719
16
votes
2 answers

Correct 'FlowLayoutGroup' in Unity3D, as per HorizontalLayoutGroup etc

Say you want ordinary flush left flow in Unity UI. Examples: In fact, to answer THIS question I already achieved flush left flow "the hard way". Set out a "vertical group of rows" in Unity autolayout, attach FattieFlow at the top level, public…
Fattie
  • 27,874
  • 70
  • 431
  • 719
13
votes
4 answers

How to make an invisible transparent button work?

Looking at some of the answers in the Unity forums and Q&A site, the answers for how to make an invisible button do not work because taking away the image affiliated with the button makes it not work. How do you get around this and keep the…
Ryan Cocuzzo
  • 3,109
  • 7
  • 35
  • 64
11
votes
3 answers

Unity3D, build PNG from Panel of a Unity.UI?

Think about any Unity.UI Canvas you might have. Imagine a typical Panel on that Canvas. Say it happens to contain some images, maybe some Text and so on. It would be very handy if you could turn that panel (only the panel) in to a screenshot: a…
Fattie
  • 27,874
  • 70
  • 431
  • 719
8
votes
2 answers

Horrors of OnPointerDown versus OnBeginDrag in Unity3D

I'm concerned over the difference between OnPointerDown versus OnBeginDrag in single-finger movement code. (In the latest Unity paradigm of using a physics raycaster: so, finally, Unity will properly ignore touch on the UI layer. So from 2015…
Fattie
  • 27,874
  • 70
  • 431
  • 719
8
votes
1 answer

Scale a PNG in Unity5? - Bountie

Surprisingly in Unity, for years the only way to simply scale an actual PNG is to use the very awesome library http://wiki.unity3d.com/index.php/TextureScale Example below How do you scale a PNG using Unity5 functions? There must be a way now with…
Fattie
  • 27,874
  • 70
  • 431
  • 719
8
votes
1 answer

Purpose of mipmaps for 2D sprites?

In current Unity, For use in Unity.UI as conventional UI .. for any "Sprite (2D and UI)", in fact it always defaults to having "Generate Mip Maps" turned ON. Every time you drop an image in, you have to turn that "off" and apply. As noted in the…
Fattie
  • 27,874
  • 70
  • 431
  • 719
7
votes
1 answer

How to make Textmesh Pro Input Field deselect on enter key?

I have an input field with some important handlers on selection and deselection. There are its settings: Nothing else was changed; I do not include these handlers because the problem is reproducible without them. Expectation When I press Enter,…
trollingchar
  • 760
  • 2
  • 6
  • 18
7
votes
3 answers

How to add text outline in unity

How can i add text outline in unity over a text UI object? I want to do it in the designer/editor view. i cant see to find any useful topic and i also cant see how to add it from the designer view. My project is 2d and i'm using the latest unity…
PetqImaQkaputka
  • 147
  • 1
  • 1
  • 7
6
votes
2 answers

Buttons in Unity, without using UI?

Is there a way in Unity to create a simple 2D button without using the UI layer. I have a game with a lot of buttons and I don't want to make the whole app in the UI. Some more controls are welcome too: switches, sliders etc. PS. I saw NGUI and I…
Maxim Lavrov
  • 326
  • 5
  • 14
4
votes
0 answers

Unity3D Vectrosity 3.0 Line between GameObject and UI item

I'm using Vectrosity to draw a line between my 3D GameObject and a UI element. However, I'm struggling to convert the RectTransform position data so I can pass it to the drawline function. I've been experimenting with getting the RectTransform…
Sean
  • 897
  • 4
  • 20
  • 42
2
votes
1 answer

Shader graph for UI works in scene tab but not in game tab

I'm trying to create a shader that would add a glow to a UI item. It works in scene tab: But in Game tab or in built project in doesn't work at all: I'm not really good at shaders so I'm not sure if I'm doing something wrong or Shader Graph…
eastwing
  • 165
  • 1
  • 10
2
votes
3 answers

Dropdown selected option is not showing in unity UI

I have dropdown of Unity UI and it has one option. Its first option is selected but i dont why its selected option is not showing.
Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186
2
votes
1 answer

Unity3D, have BOTH 3D and UI Raycaster simultaneously respond to touch?

These days in Unity you very easily detect touch on objects using a raycaster... public class DragThreeDee:MonoBehaviour,IPointerDownHandler IPointerUpHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { public…
Fattie
  • 27,874
  • 70
  • 431
  • 719
1
2 3