Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Umai · Dec 12, 2014 at 09:17 AM · fonts

Set default font for Text labels

How can I set default font (I have a .ttf in the Project) for all new Text elements I add to the Hierarchy? I don't want to set the font for each Text I create - this is not good at project start AND it's not good because you just can't change the font project way just like that, you have to find all Text objects in the editor and change them one by one.

(Unity 4.6)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by GrayLightGames · Apr 14, 2020 at 01:27 AM

Even older question now, but I got around this by making prefabs with the default values I want. Then you can just drop them into your scene. This can also end up helping you if you want to change the font for all your Text objects... or realize you need to resize all your 28 size text to 26 or something. You can also unpack the prefab after you deploy the object if you don't want a linkage. Doesn't require any scripting or assets.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gooby429 · Jan 25, 2021 at 02:25 PM 0
Share

A similar using presets (and this goes for basically anything):

$$anonymous$$ake the kind of text you want, click the little sliders icon at the top right of the component, just next to the options, and save the preset somewhere.

Then go into Edit > Project Settings > Preset $$anonymous$$anager, and click add default preset. Select Component, and search/select your text/T$$anonymous$$P component. Finally, assign the preset to it and viola! Everytime you create a new instance of said component it will automatically assign that preset to it

avatar image
0

Answer by HarshadK · Dec 12, 2014 at 10:08 AM

I've answered the exact similar question before on UA: Change All (new) UI Text Font?

The answer goes as below with slight modifications:

There is no straight forward way of doing it but you can write a script to do it for you which works as below.

  • Get all the child game objects of your Canvas game object. If multiple canvases are there then get child game objects of all those canvases.

  • Then traverse through all the child game objects to check to see if the game object has a Text component attached to it.

  • If there is a Text component attached you can access the font variable and set its value to the font you want.

You can also write an editor script to perform this task for you or use ExecuteInEditMode as per your convenience.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Rodiaz89 · Apr 05, 2015 at 04:54 AM

I know it's an old question but if you don't want to go through the hassle of creating a custom script you can get the asset we made that has that functionality and other helpful functions to help you save time.

check it out if you are interested: It's called Gamestrap UI https://www.assetstore.unity3d.com/en/#!/content/28599

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with fonts with ttf format 2 Answers

Is there any way to access iOS built-in fonts with different font weight/ font styles? (ex: medium/light/thin) 0 Answers

TextMeshpro material instance being created 0 Answers

Best Practices 1 Answer

Fonts and custom shaders in downloaded AssetBundle not working 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges