Skip to main content
3 votes

Thin lines appear differently even though they are the same height

The issue, as other folks have pointed out, is that Unity is doing ~the best it can with the information it has. Because the reference size of your UI and the actual size of the screen are different,...
Mhin Ra's user avatar
  • 31
2 votes

unity onTriggerEnter does not work

You have to name the method void OnTriggerEnter with a capital O. Not void onTriggerEnter. ...
Philipp's user avatar
  • 120k
2 votes

"Button is not an attribute class" error when integrating Steam achievements

When you put a word in square brackets before a type, variable, or method declaration, that's called an Attribute. Attributes are special classes that annotate the declaration with metadata and can be ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

is it possible to render world space canvas over other objects in unity?

I would solve this by using a "camera stack". Two cameras in the same position and with the same settings, but their "culling masks" set to different Layers to control what objects ...
Philipp's user avatar
  • 120k
2 votes

Clicking UI button calls event twice

This thread may help you. Here's a summary: You may have your left-click set to 'submit' in input settings and it is both calling a submit and select event on your single-click of the toggle-button. ...
Steane's user avatar
  • 21
1 vote

How would I make minimap of racing track where dot follows track progress in Unity?

You can combine lines and circles into a path. Then when given a length you can find which segment the length falls on. ...
ratchet freak's user avatar
1 vote
Accepted

How to remove loading delay when loading from Appdata? Or to load everything at start?

Edit: Your LoadImageSprite() function does not make sense to me. It looks like you download the image from the internet, and then check if it's cached on the device....
Kevin's user avatar
  • 6,484
1 vote

Unity LookAt says reference not set but it is

Single-click on the error message in the Unity Editor console, and the Editor will select the GameObject that the script is attached to in the Hierarchy panel. This way, you'll know what object has ...
Kevin's user avatar
  • 6,484
1 vote
Accepted

How to manage UI sound effects?

AUDIO MANAGER The best solution in my opinion would be to have an AudioManager in your scene. You can give it an AudioSource and and some sort of 'AudioManager' script. The script can just contain a ...
Pow's user avatar
  • 404
1 vote
Accepted

How to get value of transitionDuration in C# for Unity UI Toolkit

By chance, I discovered that I am able to get the value of transitionDuration using this code: ...
Mfa Xyz's user avatar
  • 11
1 vote

Unity UI Buttons not working (not clickable)

To confirm which button the system thinks is available do this: Run the game. Find your EventSystem in the hierarchy and expand it. Move your mouse/pointer over each button and look for pointerEnter ...
Chris Masterton's user avatar
1 vote
Accepted

How can I instantiate a prefab in a canvas and have it positioned relative to its parent?

The correct solution is to use Instantiate as follows: ...
tatmanblue's user avatar
1 vote
Accepted

How to alternate child placement to the left and right in a vertical stack?

Okay, my solution is to create a parent object and set these elements as children. Then, I anchor one child element to the right and the other to the left. This fixed my problem, but I'm not sure if ...
fatdrogen's user avatar
  • 238
1 vote
Accepted

When switching between two scenes: MissingReferenceException: The object of type '...' has been destroyed but you are still trying to access it

It all comes down to the static. It makes the life both easier and harder. Since onMyEvent is static, there is only one of it. That means, even if you destroy the scene and reload it, you get the same ...
Zibelas's user avatar
  • 4,393
1 vote

3rd Button on UI Seems to not Register the onClick.AddListener()

I found it. When I call the method GenerateNewTerrain(), is start by destroying all the game objects in the world unless they have a certain tag. ...
Tim W Glass's user avatar
1 vote

How to make TextMeshProUGUI truncate the left part (beginning) of a line?

I would recommend using this method instead, which is for measuring a string without setting it: Vector2 TMP_Text.GetPreferredValues(...) https://docs.unity3d.com/Packages/[email protected]/...
James's user avatar
  • 111
1 vote

How to call a function in response to a Button's OnSelect event?

On latest 2021+ unity versions this can be achieved easier on the editor by adding a component on the button gameobject called Event trigger, from there you can choose the event you want to trigger. ...
Kepol's user avatar
  • 193
1 vote

OnPointerDown / OnPointerUp aren't working in world-space canvases

For anyone still having this in 2023: There is likely some component that's already consuming the OnPointerDown() event before it reaches your script. Check if there are other components in the ...
Kari's user avatar
  • 209
1 vote

C# syntax for "This button is interactable"?

Checking button.interactable checks only if the button itself is interactable, completely ignoring the possible existence of Canvas Groups. The correct check should ...
Parchandri's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible