@@ -806,9 +806,11 @@ public static async Task<Texture2D> LoadImageAtPathAsync( string imagePath, int
|
806 | 806 | maxSize = SystemInfo.maxTextureSize;
|
807 | 807 |
|
808 | 808 | #if !UNITY_EDITOR && UNITY_ANDROID
|
809 |
| -string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, TemporaryImagePath, maxSize ) ); |
| 809 | +string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread |
| 810 | +string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, temporaryImagePath, maxSize ) ); |
810 | 811 | #elif !UNITY_EDITOR && UNITY_IOS
|
811 |
| -string loadPath = await Task.Run( () => _NativeGallery_LoadImageAtPath( imagePath, TemporaryImagePath, maxSize ) ); |
| 812 | +string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread |
| 813 | +string loadPath = await Task.Run( () => _NativeGallery_LoadImageAtPath( imagePath, temporaryImagePath, maxSize ) ); |
812 | 814 | #else
|
813 | 815 | string loadPath = imagePath;
|
814 | 816 | #endif
|
@@ -941,9 +943,11 @@ public static async Task<Texture2D> GetVideoThumbnailAsync( string videoPath, in
|
941 | 943 | maxSize = SystemInfo.maxTextureSize;
|
942 | 944 |
|
943 | 945 | #if !UNITY_EDITOR && UNITY_ANDROID
|
944 |
| -string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, TemporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) ); |
| 946 | +string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread |
| 947 | +string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, temporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) ); |
945 | 948 | #elif !UNITY_EDITOR && UNITY_IOS
|
946 |
| -string thumbnailPath = await Task.Run( () => _NativeGallery_GetVideoThumbnail( videoPath, TemporaryImagePath + ".png", maxSize, captureTimeInSeconds ) ); |
| 949 | +string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread |
| 950 | +string thumbnailPath = await Task.Run( () => _NativeGallery_GetVideoThumbnail( videoPath, temporaryImagePath + ".png", maxSize, captureTimeInSeconds ) ); |
947 | 951 | #else
|
948 | 952 | string thumbnailPath = null;
|
949 | 953 | #endif
|
|
0 commit comments