Questions tagged [unity3d-gui]

Questions related to the new UI system in Unity 4.6 and newer or the old GUI class.

Useful links:

134 questions
34
votes
14 answers

How to scroll to a specific element in ScrollRect with Unity UI?

I built a registration form for a mobile game using Unity 5.1. To do that, I use Unity UI components: ScrollRect + Autolayout (Vertical layout) + Text (labels) + Input Field. This part works fine. But, when keyboard is opened, the selected field is…
Florent Morin
  • 842
  • 1
  • 10
  • 13
22
votes
5 answers

How to access RectTransform's left, right, top, bottom positions via code?

I have a UI Canvas with render mode world space set. For all UI elements that belong to this canvas, I am seeing 'left', 'right', 'top' and 'bottom' variables in the RectTransform component in the editor. Any ways to access these variables via code?…
Sanath Bharadwaj
  • 733
  • 1
  • 8
  • 21
19
votes
3 answers

Get text from Input field in Unity3D with C#

I'm trying to get a text inside an inputField in Unity3D with C#. I've placed an inputField in my editor, renamed and tagged in: Username_field. My question is: How i can get the text inside the InputField Username_field in a C# script?
Mirko Brombin
  • 1,002
  • 3
  • 12
  • 34
15
votes
4 answers

Unity3D Slider onValueChanged sending only 0 (or other defined value)

I'm trying to attach an onValueChanged event to my GUI Slider, but for some reason it gives me a mandatory option to put a value in (it's the fourth box in the "On Value Change (Single)" section). Then it only sends the forementioned value, not the…
Filip Vondrášek
  • 1,208
  • 1
  • 13
  • 26
12
votes
2 answers

Extending Unity UI components with custom Inspector

Is it possible to extend the new unity ui components like for example the transform component? Because nothing happens when i try to extend the button, instead of the transform component using UnityEditor; using…
Eknoes
  • 349
  • 4
  • 6
  • 17
9
votes
3 answers

Unity UI - Interacting with worldspace UI when cursor is locked

I'm trying to interact with world space UI using a first person controller when Cursor.lockState is set to CursorLockMode.Locked. world space UI and a character But when cursor is locked, cursor position is set to (-1, -1), which is told from the…
Tan Li
  • 91
  • 1
  • 6
9
votes
1 answer

Unity Canvas does not fill screen

I have a 2D game set to 1080p pixel size (so each unit equals 1 pixel) and I have added a canvas to my scene. However the canvas fills only about 1/8th of the screen and is also not central either. All the canvas size and position settings are…
coolblue2000
  • 3,796
  • 10
  • 41
  • 62
7
votes
7 answers

Fade out Unity UI text

When I run the following code on my UI text Color color = text.color; color.a -= 1.0f; text.color = color; The alpha value of the text is immediately set to 0. How can I simply fade out the text.
Isaac Adni
  • 831
  • 4
  • 14
  • 29
6
votes
2 answers

4.6 New UI How to change Button Image?

Everything I search is based on the old UI. I've tried the following button.image = Resource.Load("..."); button.GetComponent() = Resources.Load("...."); button.GetComponent
Mastro
  • 1,477
  • 2
  • 22
  • 52
5
votes
2 answers

Unity3d progress bar

I am developing a game using unity3D and I need help making a progress time bar such that on collecting particular items time is added and thus the game continues.
A.Njuguna
  • 81
  • 1
  • 1
  • 5
5
votes
1 answer

How to get Text from UI.InputField?

I want to retrieve the text from a UI InputField but I'm not sure how.
kdubey007
  • 310
  • 3
  • 4
  • 9
4
votes
1 answer

How to (remove/make invisible/change color) border for input field in unity?

How I can remove border for input field? Or can i make it invisible, change color? I have not found the answer to this question in Google. I tried to change the border color in the Inspector, but it did not. Help me, please.
Roma Sypko
  • 53
  • 1
  • 5
4
votes
1 answer

Managing complex prefab hierarchies in Unity3D

I asked this question in a few places, and still haven't figured it out completely yet, so maybe some smart people here will have an idea how to approach that. What's the best way of maintaining a deep nested hierarchy of prefabs in a project? Say,…
4
votes
2 answers

Same GUI multiple scenes in Unity game - prefab of Canvas?

My problem is how to share same GUI in multiple scenes. For example: I have Inventory GUI on Farm scene and I need this GUI on other scenes like Castle, Dungeon etc. It's good idea to make prefab of Canvas? Or design again the GUI? What about mixing…
Dave
  • 171
  • 2
  • 11
4
votes
1 answer

Collisions between UI elements in Unity

I am able to detect collision between UI components and a gameobject if my canvas is rendered in the world space. Here, I am trying to find collision between two UI elements (say UI buttons) when the canvas render mode is screen space overlay. I…
Sunil Nair
  • 383
  • 2
  • 5
  • 15
1
2 3
8 9