Jump to content
  • Advertisement
Sign in to follow this  
jkuehlin

Question about default UI button in Unity (latest version)

Recommended Posts

Hello. 

I'm creating text objects on a 2D Canvas in Unity. It is possible to tell the engine to default the text color white, the font to size 20, or the alignment to center (for example)? 

Thanks :D

Share this post


Link to post
Share on other sites
Advertisement

I'm not sure if the actual defaults can be changed, but you have several options for making your own defaults:

  • You can set one text object up the way you want it, then duplicate it for all your other text.
  • You can make a prefab out of it if you intend to programmatically instantiate it.
  • You can create your own special MenuItems that set up new text objects the way you want, and use that instead of Unity's own GameObject/UI/Text menu item.  To do this, make a public static function in an Editor script (a script that's in a folder with the name 'Editor' as part of its path), and put a [MenuItem("GameObject/UI/Your Custom Text")] attribute on the function.
Edited by Nypyren

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!