Bug during modification of text fields

Hi there!

I’ve been messing around with my text fields a little bit and encountered a strange bug:

Whenever I change a color or (un)check an option (e.g. Underlay) on my current selected TextField, it applies to all text fields in the scene (even the buttons’ text fields). I’ve tried unselecting und selecting the different objects multiple times and even restartet Unity, but I always get the same behaviour. No prefabs involved. Has anyone else encountered this bug? I’m kind of lost here…

Currently running Unity 2020.3.24f1

Edit: Also I get the following error in my console (dont’ know if it is related):

PropertiesGUI() is being called recursively. If you want to render the default gui for shader properties then call PropertiesDefaultGUI() instead
UnityEditor.EditorGUI:ColorField (UnityEngine.Rect,UnityEngine.GUIContent,UnityEngine.Color,bool,bool,bool)

Ok, so I figured this is apparently a feature, not a bug:

It seems, that when you modify the sections “Face”, “Outline”, “Underline”, etc. on a text field, you do not actually modify the specific text field, but the font asset the selected text field is using. Since all my text fields shared the same font asset, all the changes I made to one text field were automatically applied to all text fields in the scene (and all the other scenes as well).

Therefore the solution to have different “effects” for button and title text fields was to simply create und assign multiple font assets for each set of effects.

Is that correct?

1 Like

Hi Sorokan,

What you described sounds correct to me. :slight_smile:

If you use meshes (e.g. for sprites or 3D meshes) in your game, the equivalent to the “font asset” would be a material with a shader. The “font asset” also uses a shader. For reasons of performance and for simplicity, objects that look the same usually share the same material. If you want diffent “looks”, you usually need different materials.

So, yes, the behaviour in your case is not a bug, it’s just the concept that has been used for decades. And your solution is how you are supposed solve the problem you encountered. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms