Under Android platform, the gltf model that loads local files will have the wrong path.
[new Uri(uri, ".")] in UriHelper.GetBaseUri(Uri uri) cannot process files in the jar:file:// path, and an error message is displayed.
It is recommended to change GetBaseUri(Uri uri) to
public static Uri GetBaseUri(Uri uri) { return GetParentUri(uri, 1); }
and
public static Uri GetParentUri(Uri uri, int level) { if (uri == null) return null; string[] segments = uri.Segments; string uriString = uri.Scheme + ":"; if (!string.IsNullOrEmpty(uri.Host)) { uriString += "//" + uri.Host; } if (segments.Length >= level) { string parentDirectory = String.Join("", segments, 0, segments.Length - level).Replace("//", "/"); uriString += parentDirectory; } return new Uri(uriString, UriKind.RelativeOrAbsolute); }
I couldn't confirm that UriHelper.GetBaseUri does not work with jar:file:// style URIs:
// This works:
Assert.AreEqual(new Uri("jar:file:///dir/sub/"), UriHelper.GetBaseUri(new Uri("jar:file:///dir/sub/file.gltf")));
Closing this now. Feel free to provide a failing test (ideally in UriHelperTest.cs) and re-open the issue.
I was able to reproduce the issue. It's the combination of double-schema (jar:file:) and a (escaped) unicode character that causes problems. Since the double-schema is used on Android only, it only surfaced there.
fixed in 6.9.0.