You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating from Unity 2020 to 2021, on our gltf models the textures were missing. Seems to be a problem with Unity Method AssetDatabase.LoadAssetAtPath only accepting relative paths (like "Assets/xyz/model.gltf") and no full path anymore.
I fixed it temporarily by changing the method CreateTextureAsync in GLTFImage.cs:
public IEnumerator CreateTextureAsync(bool linear, Action<Texture2D> onFinish, Action<float> onProgress = null) {
if (!string.IsNullOrEmpty(path)) {
string relativePath = path.Substring(path.IndexOf("Assets")); // get relative path and then pass it below
#if UNITY_EDITOR
// Load textures from asset database if we can
Texture2D assetTexture = UnityEditor.AssetDatabase.LoadAssetAtPath(relativePath, typeof(Texture2D)) as Texture2D;
if (assetTexture != null) {
onFinish(assetTexture);
if (onProgress != null) onProgress(1f);
yield break;
}
#endif
The text was updated successfully, but these errors were encountered:
After updating from Unity 2020 to 2021, on our gltf models the textures were missing. Seems to be a problem with Unity Method AssetDatabase.LoadAssetAtPath only accepting relative paths (like "Assets/xyz/model.gltf") and no full path anymore.
I fixed it temporarily by changing the method CreateTextureAsync in GLTFImage.cs:
The text was updated successfully, but these errors were encountered: