microsoft / MapsSDK-Unity

This repository contains samples, documentation, and supporting scripts for Maps SDK, a Microsoft Garage project.
MIT License
648 stars 127 forks source link

Arial.ttf is no longer a valid built in font #210

Closed JMBartelt closed 6 months ago

JMBartelt commented 9 months ago

Describe the bug Getting this error repeatedly in Unity Editor 2022.3.1, "ArgumentException: Arial.ttf is no longer a valid built in font. Please use LegacyRuntime.ttf"

Stack Trace

ArgumentException: Arial.ttf is no longer a valid built in font. Please use LegacyRuntime.ttf
UnityEngine.Resources.GetBuiltinResource[T] (System.String path) (at <c2d036c16ca64e0eb93703a3b13e733a>:0)
Microsoft.Maps.Unity.MapCopyrightLayer.UpdateDefaultCopyrights (System.Object sender, System.EventArgs args) (at ./Library/PackageCache/com.microsoft.maps.unity@0.11.2/Runtime/Scripts/MapRenderer/Copyrights/MapCopyrightLayer.cs:107)
Microsoft.Maps.Unity.MapRenderer.Update () (at ./Library/PackageCache/com.microsoft.maps.unity@0.11.2/Runtime/Scripts/MapRenderer/MapRenderer.cs:295)

So it's suggesting line 107 of code in MapCopyrightLayer.cs needs to change the reference to Arial.ttf to LegacyRuntime.ttf

_font = Resources.GetBuiltinResource<Font>("Arial.ttf");

Steps to reproduce Add MapRenderer component to scene EDIT: I found that having Map Copyright Layer Font property is set to null in the scene inspector causes this issue

Environment:

kircher1 commented 9 months ago

Hello, as a workaround for versions where Arial is not present, you should be able to set the "Font" via the inspector too image

JMBartelt commented 9 months ago

Thanks, yes there is no issue as long as a font is set in the inspector. If it's null though, it's not immediately obvious that the null inspector property is causing the error.

Also, just wanted to say that this SDK rules, great work and thanks for providing it!