Questions tagged [unity-ui]

You use this tag to ask question related to Unity3d User Interface(UI) System. The Unity UI system allows you to create user interfaces fast and intuitively.

Unity's UI system provides game developers with tools for creating professional user interfaces, fast, intuitively and efficiently. With Unity UI, you can build simple screens for games—splash screens, level selection screens, or even high-score screens etc.

219 questions
0
votes
0 answers

How to find when Array Index is out of range?

I below code : public async void GenerateCollectionData() { DataClassArray = new DataClass[bookCatogaryObject.Data.Rows.Count]; for (int i = 0; i < bookCatogaryObject.Data.Rows.Count; i++) { …
Omkar P
  • 29
  • 5
0
votes
1 answer

How to add custom class as a component to gameobject in unity?

So I have a prefab which is Instantiated in run time, to that prefab I create and add another game object with components Image as a child. Now here how can I add a custom class data as component to the newly created child of prefab?
Omkar P
  • 29
  • 5
0
votes
1 answer

Can't change TextMeshPro's alpha in canvas gruoup (Unity)

I've been trying to change the alpha value of an object and all of its children with a canvas group in Unity (I'm making UI animations), and every child will fade out, except for TextMeshPro objects. Why is that, and is there a way to make it…
0
votes
0 answers

Button calls the void starts a coroutine , doesnt run anyting except debug.log in Unity

I made a coroutine that makes the player jump in the game it works when I use the normal "input.getkey" way but when I click a button that calls a void which then starts the coroutine that controls the jump , but it doesn't jump at all the only code…
Mirazz_Boi
  • 13
  • 1
  • 3
0
votes
1 answer

How can I Initialize an array in class?

public class DataClass { public int[] collectionData; } [SerializeField] private DataClass[] DataClassArray; I have created above field in which class consists of an array, and the object of that class is also an array. public void…
Omkar P
  • 29
  • 5
0
votes
3 answers

Touch is not working with Unity UI Toolkit buttons

I'm having a weird issue, may be a simple fix. I've got a UI only "game" using the new UI Toolkit. It's a little kind of a drawing program. I've got a draw area in the middle with "tool buttons" on the sides. Everything works fine with Mouse, Pen,…
KeepCool
  • 497
  • 1
  • 6
  • 24
0
votes
1 answer

Toggle on instantiated objects

I have created a Toggle with Unity UI and added a script to it. So the point is, that my game instantiated a number of objects with a specific tag. I want to find them and toggle on/off their mesh renderer. I have come so far with SetActive.…
0
votes
1 answer

How to change the color.pressed of a Unity button through a script?

I want to make an inventory with different categories and if a category is selected the button for that category should no longer get a overlay if it is pressed. I've tried changing the pressed.color like this: Button btn =…
The Crazy
  • 31
  • 7
0
votes
2 answers

If I assign an Object as GameObject, I cant get the RectTransform to work. How to fix that?

I want to give my Parent GameObject Inventory spicific rec-coordinates via this line of code: Inventory.GetComponent().position = new Vector3(500f, 0f, 0f); In the editor, the object Inventory is assigned as a GameObject, so it keeps…
The Crazy
  • 31
  • 7
0
votes
1 answer

Best way to organize OnClick events for Unity buttons?

enter image description here Unity has a component called Button as part of its UI system which you can use to subscribe on-click events to it through the inspector which is incredibly useful. However, when projects get larger, I run into trouble in…
0
votes
1 answer

Unity RectTransform.GetLocalCorners(Vector3[] fourCornersArray) result not change as object;s position changing

my brothers and sisters from another mother : ) I'm trying using unity to implement a swipe menu, which is like the apps menu on a smart phone. I want to get the current corner's local location value, so I can use them as a reference to do some…
Birds
  • 21
  • 1
0
votes
2 answers

I am having trouble changing the source image of a button

So Interestingly, I already have working code to modify source images for other UI elements, but when I tried to do the same thing with buttons for an inventory bar it didn't work. When the code runs, it doesn't change the image, but doesn't give…
0
votes
1 answer

how to change the parent of an object to another slot parent in unity?

i am making a rock paper scissors game but not the classic one that everyone knows, you have 12 cards, 3 blue cards of each type(3 paper cards,3 rock cards,3 scissors cards), 2 purple cards of each type and one last card that contains paper and…
0
votes
1 answer

Unity UI instance color alpha change

In my Unity 2021.2.6f1 project, I have a ScrollRect object (carNameList) with several Image items that are added dynamically via prefab instancing. They are switched between each other by KeyPress events. The unselected item has its alpha value 0,…
0
votes
0 answers

Dynamically Sized Vertical Layout Group Elements

I am currently working to create an inventory system that contains multiple categories, each of which houses its own inventory slots. I have constructed a vertical layout group to do this, with the category headers as child gameobjects of the…