浏览代码

fix android issue

/main
Xingwei Zhu 3 年前
当前提交
ef9be6fb
共有 2 个文件被更改,包括 19 次插入0 次删除
  1. 15
      com.unity.uiwidgets/Runtime/engine/AndroidPlatformUtil.cs
  2. 4
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs

15
com.unity.uiwidgets/Runtime/engine/AndroidPlatformUtil.cs


internal delegate string UnpackFileCallback(string file);
internal static bool FileExists(string file)
{
var path = "jar:file://" + Application.dataPath + "!/assets/" + file;
using (var unpackerWWW = UnityWebRequest.Get(path)) {
unpackerWWW.SendWebRequest();
while (!unpackerWWW.isDone) {
} // This will block in the webplayer.
if (unpackerWWW.isNetworkError || unpackerWWW.isHttpError) {
return false;
}
}
return true;
}
[MonoPInvokeCallback(typeof(UnpackFileCallback))]
internal static string unpackFile(string file) {
var dir = Application.temporaryCachePath + "/";

4
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs


if (setting.Value.fonts[j].asset.Length > 0) {
var assetPath = setting.Value.fonts[j].asset;
var assetAbsolutePath = Path.Combine(Application.streamingAssetsPath, assetPath);
#if !UNITY_EDITOR && UNITY_ANDROID
if (!AndroidPlatformUtil.FileExists(assetPath)) {
#else
#endif
Debug.LogError($"The font asset (family: \"{setting.Key}\", path: \"{assetPath}\") is not found");
}
else {

正在加载...
取消
保存