0
votes
1answer
14 views

How can I access my button from another scene

Recently I have been making a game with a level menu, where you start at. Once you have completed that level (which is another scene) it will take you back to the main menu and allow you to use the ...
0
votes
1answer
52 views

Make Dropdown adhere size of its contents

When Dropdown is placed inside a panel with ContentSizeFitter/LayoutGroup with preferred size set, it appears to take just 10x10 units, no matter what the contents are. How can I make Dropdown's ...
0
votes
0answers
16 views

How to change Scene in Unity for SteamVR using UI buttons?

I want to make an VR application in SteamVR using unity in which we have some UI buttons which on clicking using some VR trigger give a new scene. Currently have this script to change the scene but ...
2
votes
1answer
98 views

Constraining camera bounds within bounds based on Unity UI object dimensions

I have a perspective camera which has bounds which I wish to constrain within larger bounds. All the bounds are calculated in world space. The code for containing the camera within the constraining ...
0
votes
1answer
25 views

RectTransform Button Start shaking with Vector3.MoveTowards()

I have a RectTransform Button that i want to make it move to a de-terminated vector3. To move the button i use this code (it is inside Update()) int i = -1; foreach (RectTransform ...
0
votes
1answer
38 views

Unity accordion UI

I downloaded the accordion from the unity forums and I'm trying to add a button to it. issue is with the vertical layout group. when any UI element is added the layout will automatically go vertical ...
-1
votes
0answers
35 views

how to make a cube to change color by clicking a button in unity? [duplicate]

i used this below code to change the color of a cube if i pressed a button. but its not working.i have added this code to cube and in button i have attached this script and function. if i pressed the ...
1
vote
1answer
20 views

If (button.interactable) condition doesn't work - why?

I have a Typewriter script attached to the text, which is a child of a button. I want this script to run only if the button is interactable. I made a public variable to store the button and used ...
-2
votes
1answer
105 views

C# syntax for “This button is interactable”?

What should be the C# syntax for the condition if (This Button is interactable)? I have a script attached to the button, Which has to run only if the button is interactable. Thank you in advance!
-1
votes
1answer
57 views

how to fix pushing and popping error?

when i write a code with begin and end area ,i get this error, though i did it right,am quite sure that EndArea() is executed in the algorithmic flow of the code,and not escaped ,how to fix that?? ...
2
votes
1answer
308 views

How do I set the exact local position of a RectTransform?

I have a game object that creates a keyboard in side of my world canvas. I am working out the offset positions for each key, and appear to be doing that correctly. However, when I set the positions in ...
-3
votes
1answer
55 views

How do I make a high score in Unity?

I want to make a GUI box displaying a high score, but I have no idea how to do it. How do I make a high score in Unity? Here is what I have done so far: using UnityEngine; public class Highscore : ...
0
votes
1answer
56 views

Causing Update loop with Coroutine Unity

Total Noob Alert! < 7 days with C# and Unity My Win Game screen becomes SetActive and my Player is SetActive false when you are standing in a trigger and crouch. That all works fine except you ...
1
vote
1answer
120 views

How to create UI with multiple panels for multiple resolutions

I am trying to create scene that has multiple panels, but only one is visible. When user clicks on appropriate button a transition is happening: camera moves to the right revealing panel on the right ...
0
votes
3answers
53 views

Unity - Easier way to resize group of buttons to the same size

I have a canvas with buttons, with a script attached to each button. This script creates an array for buttons and resizes every button to the same size as the longest one in that array (the button ...
0
votes
1answer
51 views

How to only allow one space in an InputField?

I've been messing with this for a while now and I can't get this to work 100%. I'm using an InputField for players to enter a character name, and I want to allow a first and last name. Here's how I've ...
0
votes
0answers
39 views

Game Object will NOT stretch across entire content area

I'm loading prefabs into a content area using a content size fitter and vertical layout group. I've tried multiple things to get the loaded prefabs to stretch across the entire content size (including ...
0
votes
0answers
25 views

How to set the layer texture2d image in unity

I am working on onscreen arrow indicator. I have placed some sphere on the screen and attached the code below to each gameobject. And also I have a canvas,which consist of a panel. public Texture2D ...
0
votes
0answers
75 views

Unity 5: How to handle stacks of “windows”

I'm having a hard time coming up with a clean and simple way of implementing a window manager of sorts. I have placed some limitations below: Windows can never move and its positions are fixed at ...
1
vote
1answer
164 views

Applying a getButtonDown & getButtonUp on a GUI button for touch input

I have a GUI interface with a button for the character's attack, however I want to implement a defense button where the user can hold the button down to block incoming attacks, when the user stops ...
1
vote
1answer
202 views

2D Driving Game with Unity

I'm trying to make a 2D car driving game in Unity and I'm having problems with my code. I am able to move forward,backward,turn left/right using arrow key from my present code using UnityEngine; ...
1
vote
1answer
191 views

Cannot click UI button in Unity

I am working on Unity 5.4. I have an Event System, my UI has a parent canvas, Canvas has the graphic raycaster. I am not able to understand why this is not working. I have attached an image of the ...
1
vote
0answers
46 views

How to get what button was clicked on?

Other contexts in which this was done I'm sure have been answered for this kind of problem before. But this has thus far been a 2 week long impasse of wittling down all the other suggestions I've seen ...
0
votes
1answer
474 views

Limit a scrollbar's OnValueChanged to full step intervals only

So I have done some research on the matter but I can't find anything. I created a UI scrollbar and asigned 10 steps to it.Then I noticed that the values of the scrollbar does not change in reference ...
0
votes
1answer
164 views

Keeping a UI element inside the screen at all times

I have this UI element that follows an arrow around the screen. The problem is that sometimes, due to the parenting, the element goes outside the screen. I need a way for it to "hit the walls of the ...
1
vote
2answers
138 views

GetComponentsInChildren<GUIText>().text - does not contain a definition

My Slider GameObject has a GUIText child. I am writing a C# script that should change the text component in the GUIText, but instead of this I am getting: error CS1061: Type UnityEngine.GUIText[]' ...
1
vote
2answers
989 views

How can I get UI element over which pointer is in Unity3D?

I can detect if mouse is hovering any UI element by EventSystem.current.IsPointerOverGameObject(). But how do I know which GameObjest it is exactly? I have tried: if (EventSystem.current....
1
vote
1answer
95 views

UI 5: Slider Pressed

I am using the UI slider from Unity 5 and would like to display a text every time the handle knob is touched/pressed. My understanding is that my script should extend some Event System interface. ...
0
votes
1answer
667 views

Creating a list of buttons dynamically in code

I have a list of contacts. I need to create a scrollable list of buttons that are created dynamically so I can add each contact name as the button text. How would I do this all in code? My biggest ...
-3
votes
1answer
47 views

How to assign GUIText from heirarchy into prefab object?

I want to assign GUIText from heirarchy into prefab using that C# code: private Text HighScoreText; void Start(){ HighScoreText = GameObject.Find("HighScore").GetComponent(); } But ...
3
votes
1answer
109 views

Dragging text element into Text variable unity 4.6

So I was trying to make a UI element to keep score in a unity (4.6) project and I'm having trouble assigning the 'Text' element to the Text variable. So I have the text element with the script ...
1
vote
3answers
4k views

UNITY : I want to make my UI text fade in after 5 seconds

I know this question has been asked and asked but none of the topics i visited gave me an answer. I'm making a game programmed in c# where you control a boat and i want my UI to appear smoothly by ...
0
votes
1answer
133 views

How can I use web browser controls for non-browser game GUI? [duplicate]

I'm looking for a way to get a modern browser's level of customization and rendering quality in my c# monogame to avoid using roundabout/limited/buggy GUI toolkits and to get better fonts without ...
0
votes
1answer
95 views

How do I lerp text color over time?

On my quest to understand Unity in a zero to hero sort of manner, I've run into a new problem I can't seem to really solve. From computer science I know that updating GUI on the same thread as ...
4
votes
2answers
194 views

Grid of buttons in Unity - button bounds are stretching beyond their visuals, capturing clicks meant for other buttons

I am using unity UI for the first time and trying to create a level selection menu just like Angry Birds. I had successfully created the dynamic level selection menu. It was all good in the ...
0
votes
1answer
189 views

Access buttons individually made by a for loop (old Unity GUI, Unity Editor script)

I've got a problem and I am struggling with this for a couple of days now. I am making an Editor script and I want to access buttons individually when created by a for loop. There is a public class ...
1
vote
1answer
65 views

How can I once run For Loop in void OnGUI?

I want once run GUI on screen same Initialization a number. I try say my think In easiest way then please payattention to this code: using UnityEngine; using System.Collections; public class ...
1
vote
2answers
324 views

Continous repeatable object/image moving horizontally unity3d

I want to move objects on the screen horizontally. And the user has to pop the object by touching it. When user touch it, it gets destroyed and new object comes randomly. For experimenting, I used ...
1
vote
1answer
104 views

Send Messages in Update Function Button UI Unity 5

I've been working on a project where i need to fulfill the following behaviors: 1) when clicking anywhere in the screen the character should do something 2) there are some buttons so except when you ...
1
vote
1answer
440 views

Making a Fall Trigger Game Over

I have been struggling with this fairly basic issue: To make a game over menu appear upon death. I am making a 3D game in Unity, where you, the player, must control a sphere with the basic controls: ...
1
vote
1answer
229 views

Apply Pixel Perfect by script in Unity?

How can I apply Pixel Perfect by script in Unity? All I could find on the web is this which does help at all..
1
vote
1answer
397 views

Creating a Slide-Up Menu

How can I create a menu that slides up while "un-fading" as illustrated in this video? As you can see in the video, the menu also falls down a bit in the end which gives it a realistic feel. I ...
3
votes
1answer
152 views

Function, that is searching for nearest enemy Transform only works sporadically. What am I doing wrong?

so I am trying to implement a "Zelda"- or "Dark Souls"-like z-targeting system. You'll see in the code, that the function compiles a list of every enemy in the current scene. I'm still in the ...
1
vote
1answer
2k views

Unity 5 C# - onClick.AddListener in a foreach loop using lambda expressions

I'm trying to dynamically create Unity 5 UI buttons that each set a global variable decision_id to a different value when clicked. The problem I'm having with this implementation is that they all ...
1
vote
2answers
13k views

How to detect mouse over for UI image in Unity 5?

I have an image that I have setup to move around and zoom in and out from. The trouble is the zoom can be done from anywhere in the scene, but I only want it to zoom when the mouse is hovering over ...
1
vote
1answer
385 views

How do I know what button was clicked? (Unity)

I have a prefabbed button (UI.Button) which I'm instantiating ten times: public void LayoutButtons() { GameObject newCanvas = Instantiate (canvas) as GameObject; for (int i = 0; i < 10; ...
1
vote
3answers
4k views

Why does a UI button that is child to a canvas not appear in game view?

I am trying to place a button onto a canvas background using C# script. I want the button specific to the canvas (i.e., if I move the camera to look at another canvas, I do not want the button ...
0
votes
1answer
550 views

Can't see instantiated UI element

I'm trying to create a level editor for a 2D game and I wanted to instantiate radio buttons, the backgrounds and numbers of which are determined by the tilesheet I load. I'm sure I'm doing something ...
0
votes
1answer
81 views

My GUI stopped working?

Okay I bought this asset online so I would like not to show the whole script. The problem is this asset stopped working when I updated from unity 5.0 to 5.1.2. The script is for a controller GUI ...
1
vote
2answers
117 views

How do I refer to the object that called a function?

I have a large number of buttons instantiated from a prefab using a loop, as follows: public void LayoutButtons() { GameObject newCanvas = Instantiate (canvas) as GameObject; for (...