Quantcast
Channel: UGUI & TextMesh Pro
Viewing all 23263 articles
Browse latest View live

Changing the color of a UI Button with scripting?

$
0
0
I'm trying to change the color of a button depending on an array. Is there any way I can dynamically change the color of a button? It should be under the image class, but it's not.

If not, can I do a similar procedure, but with sprites? In the future, I plan to change the sprite based on the array, but until then I want to just use colors for debugging. Or I could just add dumb images.

Problem solved, was easy. I just didn't think it through.

IPointerXXXHandler's not firing for only some prefabs.

$
0
0
I have a problem with the IpointerClickedHandler Interface. For a long time, it worked perfectly for me, but now, it no longer responds in any way to the cube prefabs outside of the region marked in red (see graphic below). My prefabs are relatively simple, I feel you’d agree.



It is a cube with rounded corners (imported from Blender) with a single script. I’ve cut out the parts of the script which I don’t believe are significant to this problem.

Code (CSharp):
  1.  public class SudoCube :...
IPointerXXXHandler's not firing for only some prefabs.

OnPointerExit not always firing?

$
0
0
I'm trying to make a tooltip. Currently I have a few buttons next to one another which should get highlighted in the OnPointerEnter function, and of course, stop highlighting in the OnPointerExit function.

For the most on this works fine, however, these buttons are rather close to one another, let's call them "Attack" and "Defend", if I move my mouse slowly from "Attack" to "Defend" my tooltip changes accordingly. However when I quickly move my mouse from "Attack" to "Defend" it will keep...

OnPointerExit not always firing?

Event Trigger Select does not trigger from code

$
0
0
I have a UI button and I added an Event Trigger from the inspector, with a Select option, the Select option calls a function from a script. The function gets called normally when the button is selected via navigation keys (keyboard/gamepad, whatever is assigned on Standalone Input Module to navigate) The problem lies when I try to select the button using EventSystem.current.SetSelectedGameObject() from a script in Update, I also tried Button.select() i get the same result, I...

Event Trigger Select does not trigger from code

Having trouble with scaling non canvas text

$
0
0
Hello, I have been working on a 2d top down game where enemies drop loot when destroyed. I have item labels where the item is dropped and when clicked it goes into the player's inventory. I have a camera that moves and zooms in and out. Additionally, since these drops are instantiated when an enemy is destroyed(at enemy position), I am not instantiating these onto the canvas. I want the background(sprite) to scale with the text(textmeshpro) and the text and background to scale with the...

Having trouble with scaling non canvas text

Skewed Text

$
0
0
Hello,

Any plans to support skewed text in a future update of TextMeshPro?

I've hacked in in for now by changing the vertex data in the lateupdate,
but it seems to get over ridden all the time by random updates and would like something more optimised.

Issue with unsupported text

$
0
0
Hello there,
Is there a way to check if the added text to the TextMeshProUGUI object contains any missing/unsupported characters or if any other potential fallback occurred?

I have this in-game console, where all kind of text is being added to it. After a certain text was added the TextMeshProUGUI object would not change at all whenever a new text was appended to it. And when I tried to edit a text in the inspector, I received this warning message:

The character with Unicode value...

Issue with unsupported text

Toggle and OnValueChanged with inverse dynamic value ?

$
0
0
With a toggle we can use a unityEvent to call function with dynamic parameters, like if toggle is ON then otherThing.gameObject.setActive() is also ON.
Very usefull to save script use, but can it be inversed?
I would like : if toggle is ON, then other gameObject is OFF.

Particle System in front of UI

$
0
0
Hello, please how can i Intantiate Particle System in front of UI? I have a panel in the scene and it hides them. I have read everything what i have found and tried everything, but nothing work. It is possible?

TMP_InputField always activates onSelect (unlike unity InputField which can be configured)

$
0
0
TMP_InputField.OnSelect:

Code (CSharp):
  1.         public override void OnSelect(BaseEventData eventData)
  2.         {
  3.             //Debug.Log("OnSelect()");
  4.  
  5.             base.OnSelect(eventData);
  6.             SendOnFocus();
  7.  
  8.             ActivateInputField();
  9.         }
But unity InputField.OnSelect looks like this:

Code (CSharp):
  1.         public override void OnSelect(BaseEventData eventData)
  2.         {
  3.             base.OnSelect(eventData);
  4.  
  5.             if (shouldActivateOnSelect)...
TMP_InputField always activates onSelect (unlike unity InputField which can be configured)

Image/Raw Image Material works in scene, not in game. Possible bug?

$
0
0
Maybe I'm doing something wrong, but I can easily reproduce this. Using version 5.0.1f1. I read through the latest patch notes and didn't see anything relating to this issue, maybe I'll try updating anyways.

I have a Raw Image component with no texture, and a material. This material has a Texture set on it, and displays this texture. The material is using a custom shader, but testing shows this doesn't work with the built in shaders either. Is there something specific that a UI shader...

Image/Raw Image Material works in scene, not in game. Possible bug?

SetNativeSize in OnEnable results in incorrect sizeDelta for non 100 Pixel Per Unit sprite

$
0
0
I'm using 2020.1.0f1 but I'm pretty sure this is in every version.

I have a gameObject Image with a sprite set in the editor, on play I change the sprite and call SetNativeSize so the sizeDelta will change to the new sprite dimensions.

unfortunately if the PPU of the sprite is anything other than 100 it will return the wrong sizeDelta. for example a sprite 48x48, with a PPU of 1 will get a sizeDelta of 4800x4800.

The two solutions around this is either manually setting the sizeDelta using...

SetNativeSize in OnEnable results in incorrect sizeDelta for non 100 Pixel Per Unit sprite

UI Mask is displayed INCORRECTLY with a mobile target

How to make Smileys/icons appear in front of text?

$
0
0
I work on my game by developing packages/Assemblies in separate projects, and them fusing them together, meaning to improve the re-usability of my code.
I created a package with cards (I'm doing a deckbuilder) and used a special font that contains a background to emphasize a bunch of in-text sprites. It worked wonders in the original project.

...But once I transferred the cards through an asset package, sprites started appearing BEHIND the font, completely ruining my nice effect. (the font...

How to make Smileys/icons appear in front of text?

TMPro SubMeshUI Error when changing scenes

$
0
0
My game recently updated to Unity 2019.4.28f1 and we added the latest TMPro 2.1.6 as well. What we have noticed is that we have been getting a lot of errors from SubMeshUI when leaving a scene but it's hard to reproduce and I haven't been able to reproduce it but my game gets 5000 errors a day. So it's basically when we open a scene and that scene contains a fallback character. When exiting the scene the error occurs.
In my code we also do a specific Destroy certain GameObjects that has been...

TMPro SubMeshUI Error when changing scenes

Adding Arabic to TextMeshPro

$
0
0
Hello everyone, I added Localization to my game. I added language support for multiple languages. I have a problem with Arabic texts, it needs to be written from right to left. As a result of my research, I found this free repo Github It turns the text from right to left as I want, but I used TextMeshPro a lot in my project. If I use the github repo I will have to change all my TextMeshPro objects. Is there an easier and more practical way...

Adding Arabic to TextMeshPro

TMP Input Field "No Monobehaviour Scripts"

$
0
0
I'm currently unable to use TMP Input Field, it will work fine until I start a build, and then all the input fields in my project will be unselectable.
When I view the input field script in Packages, I'm met with this error:
View attachment 1363760
I tried uninstalling and re-installing, no luck. I'm also using Unity 2022.3.18f1.
Any ideas on how to use TMP Input Field again?

Check if UI Element in screen space canvas is visible or not

$
0
0
Hi,

I'd like to know if a GameObject that is a UI Element (Button for example) in a screen space canvas is visible on screen or not.

Checking activeself is not good enough because if the element is active but has an inactive parent, it won't be visible.

I've been googling away for an hour without success. Should I check if all its parents are active ? That can be costly...

Can you kindly help ?

Thanks

Help with Automatic Navigation Setup for this menu setup...

$
0
0
This one is driving me crazy and I'm hoping someone here has some insight. Right now my end of wave shop screen instantiates the cards you see during gameplay. Each card has a "Buy Button" and a "Lock Button", they are both set to Automatic for the navigation style. The UI Canvas has a "Reroll Conversion" button in the top right, also set to Automatic. Near the bottom I have a "Reroll" button set to Automatic and a "Continue" button set to Automatic.

The buttons on the cards all work from...

Help with Automatic Navigation Setup for this menu setup...

My PNG Image is not in Source Image Tab

$
0
0
Hello everyone! I have an image object on my Panel which is a child of canvas, but I can't change it's texture as I want because I can't find my image on the source image tab. Dragging my image into scene doesn't work eighter.

View attachment 1392169

You have any idea why this is happening? Thank you
Viewing all 23263 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>