This repository was archived by the owner on Sep 7, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
com.unity.uiwidgets/Runtime/engine Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,21 @@ public static class UIWidgetsAndroidConfiguration{
1717
1818 internal delegate string UnpackFileCallback ( string file ) ;
1919
20+ internal static bool FileExists ( string file )
21+ {
22+ var path = "jar:file://" + Application . dataPath + "!/assets/" + file ;
23+ using ( var unpackerWWW = UnityWebRequest . Get ( path ) ) {
24+ unpackerWWW . SendWebRequest ( ) ;
25+ while ( ! unpackerWWW . isDone ) {
26+ } // This will block in the webplayer.
27+
28+ if ( unpackerWWW . isNetworkError || unpackerWWW . isHttpError ) {
29+ return false ;
30+ }
31+ }
32+ return true ;
33+ }
34+
2035 [ MonoPInvokeCallback ( typeof ( UnpackFileCallback ) ) ]
2136 internal static string unpackFile ( string file ) {
2237 var dir = Application . temporaryCachePath + "/" ;
Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ public object fontsToObject() {
7676 if ( setting . Value . fonts [ j ] . asset . Length > 0 ) {
7777 var assetPath = setting . Value . fonts [ j ] . asset ;
7878 var assetAbsolutePath = Path . Combine ( Application . streamingAssetsPath , assetPath ) ;
79+ #if ! UNITY_EDITOR && UNITY_ANDROID
80+ if ( ! AndroidPlatformUtil . FileExists ( assetPath ) ) {
81+ #else
7982 if ( ! File . Exists ( assetAbsolutePath ) ) {
83+ #endif
8084 Debug . LogError ( $ "The font asset (family: \" { setting . Key } \" , path: \" { assetPath } \" ) is not found") ;
8185 }
8286 else {
You can’t perform that action at this time.
0 commit comments