Jump to content
  • Advertisement
Sign in to follow this  
jkuehlin

Question about default UI button in Unity (latest version)

This topic is 450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!