Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Arial.ttf is no longer a valid built in font Error

Discussion in 'Editor & General Support' started by jbartelt, Nov 30, 2023.

  1. jbartelt

    jbartelt

    Joined:
    Aug 22, 2018
    Posts:
    13
    I'm getting this error that is preventing my project from compiling:

    ArgumentException: Arial.ttf is no longer a valid built in font. Please use LegacyRuntime.ttf

    The culprit is a line of code in the MapsSDK which read-only package from Microsoft that I need and don't think I can modify.

    Code (CSharp):
    1. _font = Resources.GetBuiltinResource<Font>("Arial.ttf");
    I'm getting hardly any hits on google for this issue so I'm really confused as to why I'm getting this error.

    Other details
    Unity 2022.3.1
    Targeting Android (Oculus Quest VR)

    Any help would be very appreciated!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,067
    Oooh, it's open source...

    Generally, just clone the repo, make the modification to your own repo, reconnect your project to use YOUR repo.

    For extra credit open source contributor points, learn how to submit a pull request back to the original repo. If you show your work and add links to the docs in the commit showing why you picked that LegacyInternal as the replacement, your code might get taken in. See the CONTRIBUTIONS.md file.

    Even if it is not then you can always down-merge future changes into your own copy of the repo.
     
  3. jbartelt

    jbartelt

    Joined:
    Aug 22, 2018
    Posts:
    13
    @Kurt-Dekker Thanks, I was considering submitting a PR about it, but it seems like nobody else in the world is having this issue, which makes me wonder if its my environment, I also wasn't getting this error for several hours with the MapsSDK already imported to my project, it just started happening after my first build attempt.

    Curious though, I already made a fork and changed that code, but simply cloning the repo and pasting everything into my project still is broken because there are dependencies missing, which are in the scoped registry I used to import it originally.

    Thoughts?

    Thanks for the help.
     
  4. jbartelt

    jbartelt

    Joined:
    Aug 22, 2018
    Posts:
    13
    For my specific scenario, I discovered that the script with the problematic line of code referencing Arial.ttf had a public variable for the font that was set to null in the inspector, simply giving it a font ensured that the script wouldn't call the code that tries to use Arial.ttf as a fallback.

    I left a bug report for the package maintainers in case they decide to fix it.
     
    Kurt-Dekker likes this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,067
    WOW, I love it when a plan comes together. Nice.