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
15
votes
1 answer

Get a UnityEngine.UI.Images position in screenSpace and calculate a normalised offset (inside an overlay canvas)

The Problem at hand: Simplified Given an UnityEngine.Ui.Image How does one find the X,Y position of a normalised offset (like 0.4, 0.3 from the top left) inside that image in ScreenSpace units like 400,300 I guess I need to find the top left…
twobob
  • 354
  • 8
  • 22
9
votes
1 answer

Unity How do I Flow TextMesh Pro Text around an Image?

Unity Version: 5.6.5f1 Personal TextMesh Pro Version: 1.0.56.0b3 I have a TextMesh Pro UI Text object whose area intersects the area of a UI Image. The text is dynamic, but the image will never change. Is there a way to make the TextMesh Pro UI Text…
user9474008
6
votes
0 answers

LayoutRebuilder.ForceRebuildLayoutImmediate not rebuilding HorizontalLayoutGroup Unity

I'm working on a component where I need the correct anchored positions of children of a HorizontalLayoutGroup in the Start function. I can force the HorizontalLayoutGroup to rebuild by doing: public HorizontalLayoutGroup horizLayoutGroup; public…
Beks_Omega
  • 404
  • 1
  • 5
  • 13
5
votes
2 answers

Unity button click not firing event

I have looked at the post located here that deals with the same issue, but it neither illustrates what is wrong nor fixes my problem. I have created a Canvas prefab with a number of buttons within a panel. I am instantiating the prefab at runtime…
Darren Cook
  • 115
  • 1
  • 2
  • 12
4
votes
2 answers

How do I change the source image of a Unity image component?

I can't figure out how to change the sprite used for the source image. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements; public class SceneButton : MonoBehaviour { public Sprite…
Jaedon KLB
  • 67
  • 1
  • 1
  • 6
4
votes
0 answers

Object-To-Clip for Unity Canvas Image Shader

The TL;DR When applying a shader to a UI.Image object in a Unity3D canvas, UNITY_MATRIX_MVP appears to be relative to the Canvas renderer, and not the Image object itself being drawn. Is there a way to compute clip-space coordinates of a point in…
Johannes
  • 6,232
  • 9
  • 43
  • 59
3
votes
5 answers

Issue with errors in Unity on launch

I am having an issue in Unity where every time I launch the editor it asks me to enter in safe mode because there are a lot of errors and when I press ignore it launches and I can see in the console a lot of errors with the UI and I found out that I…
3
votes
2 answers

How to make one toggle turn off when the other turns on in unity

I am making a 2d game in unity. I am using the UI toggle methods and wish to make one of those turn off when the other one is turned on. The method I have tried is doing the following code below (InfiniteMode and CampaignMode are the names of the…
Catty01
  • 147
  • 2
  • 9
3
votes
3 answers

Draw bounding rectangle (screen space) around a game object with a renderer (world space) (Unity)

I have a game object that lives in world space in my scene. I would like to get the coordinates of the corners of the bounding rectangle for this game object's renderer in screen space because I have UI elements that want to be positioned around…
emsha
  • 73
  • 1
  • 6
3
votes
6 answers

(Unity + 2D) Change UI Button position issue

The last few days I've been stuck with a headache of a problem in Unity. Okay, I won't go into details with my game, but I've made a super-simple example which represents my issue. I have a 2D scene these components: When the scene loads, and I tap…
theloneswiftman
  • 188
  • 1
  • 4
  • 17
3
votes
2 answers

Custom Shaped Buttons Unity UI

Hi I am trying to create custom buttons on unity (trapeziums). I successfully created the visible area on Photoshop and imported it as Sprite 2D UI as per the following image: The issue arises, when I'm trying to select one of the buttons in game,…
David Vella
  • 73
  • 2
  • 7
3
votes
1 answer

How can Raycast interact with Unity's Canvas UI elements?

I created a Raycast that shoots from an object(not main camera) and I want it to hit UI elements. Example below. Example UI outlined in orange, big grey plane is a test object, red head is placed upon user's head and green is DrawRay of my raycast…
Denis Kulikov
  • 71
  • 1
  • 6
2
votes
1 answer

2D sprite problem when setting up an instant messaging UI

I'm new to Unity and to game development in general. I would like to make a text-based game. I'm looking to reproduce the behavior of an instant messenger like messenger or whatapp. I made the choice to use the Unity UI system for the pre-made…
2
votes
2 answers

How can I get text value of TMPro Text without markup tags in Unity?

I am trying to get text value in TMPro Text component without markup tags but haven't found any solutions. Say, Hello world is the value in TMPro Text, and I just want Hello world in c# script. Bear in mind that tag and…
Masa
  • 362
  • 2
  • 14
2
votes
2 answers

Need Logic for hiding/ unhiding GameObjects (Collection of terrains) using Toggles in Unity

I'm trying to hide/unhide A GameObject (Named "Ecosystem") comprising several children terrains using a Toggle switch for Unity. My bad, I tried setting Object as Active/ Inactive but to no avail. Please provide me with a feasible solution. The pic…
1
2 3
14 15