Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Pankaj-Bansal · Apr 26, 2017 at 09:07 PM · unity 5fonttextassetbinary

Load a .ttf font file as binary data

I have a .ttf font file and I want to load it as binary data. I know I can load binary data as TextAsset in Unity. But this requires the file extensions to be ".fnt" or ".bytes" (few more extensions i know). If I change the file extension, I am able to load the file as binary data in TextAsset. But I dont want to change the file type.

  1. Is there a method in Unity where I can load the .ttf file as binary data without changing the file

  2. Is there a way I can load the .ttf file as Font Asset in Unity and then get the raw font data from the Font Asset?

  3. Or some other way of loading the .ttf font as binary data?

Comment
Add comment · Show 2
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 Vanguard3000 · May 24, 2017 at 09:17 PM 0
Share

Are you able to convert those bytes into a Font object? I need to download a custom font from a server then apply it. I can download it to Application.persistentDataPath, and it is a complete file viewable in the os, but I can't load it into Unity for use as a font.

avatar image $$anonymous$$ Vanguard3000 · Feb 19, 2018 at 01:14 AM 0
Share

Did you ever resolve this?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Apr 26, 2017 at 09:10 PM

Just place the file in the Streaming Assets folder. Make sure you read the page carefully. The Streaming Assets folder works different depending on your target platform. That folder is ment for anything that should be shipped with your game but not treated as asset. On Android you have to use the WWW class to read those files as they are packed into the apk file itself.

Comment
Add comment · Show 3 · 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 Pankaj-Bansal · Apr 27, 2017 at 10:35 AM 0
Share

Ok this worked for me after some effort. But I need to know the file names in advance while creating WWW object. Is there a way to find all files in Strea$$anonymous$$gAssets folder. Like following code works on Windows but will not work in Android. Is there a alternate for this code on Android ?

DirectoryInfo dir = new DirectoryInfo(Application.strea$$anonymous$$gAssetsPath); FileInfo[] info = dir.GetFiles("*.ttf");

avatar image moumou38 Pankaj-Bansal · May 31, 2017 at 01:28 PM 1
Share

I am actually curious of your method, do you $$anonymous$$d explaining how you use a text asset to change the font somewhere in your project? I want to load a font from my strea$$anonymous$$gassets and even as bytes, I just don't know what to do with it.

avatar image $$anonymous$$ moumou38 · Feb 19, 2018 at 01:14 AM 0
Share

Did you ever resolve this?

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Changing a GUI Button's font in code 1 Answer

Can't able to import font 0 Answers

Getting pixel font to look decent 1 Answer

Unity Editor Fonts Display Error. 0 Answers

Font Render Issue Unity 5.3.4f1 on Samsung devices 1 Answer


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