@@ -361,9 +361,11 @@ public static async Task<Texture2D> LoadImageAtPathAsync( string imagePath, int
361361 maxSize = SystemInfo . maxTextureSize ;
362362
363363#if ! UNITY_EDITOR && UNITY_ANDROID
364- string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread ( ( ) => AJC . CallStatic < string > ( "LoadImageAtPath" , Context , imagePath , TemporaryImagePath , maxSize ) ) ;
364+ string temporaryImagePath = TemporaryImagePath ; // Must be accessed from main thread
365+ string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread ( ( ) => AJC . CallStatic < string > ( "LoadImageAtPath" , Context , imagePath , temporaryImagePath , maxSize ) ) ;
365366#elif ! UNITY_EDITOR && UNITY_IOS
366- string loadPath = await Task . Run ( ( ) => _NativeCamera_LoadImageAtPath ( imagePath , TemporaryImagePath , maxSize ) ) ;
367+ string temporaryImagePath = TemporaryImagePath ; // Must be accessed from main thread
368+ string loadPath = await Task . Run ( ( ) => _NativeCamera_LoadImageAtPath ( imagePath , temporaryImagePath , maxSize ) ) ;
367369#else
368370 string loadPath = imagePath ;
369371#endif
@@ -496,9 +498,11 @@ public static async Task<Texture2D> GetVideoThumbnailAsync( string videoPath, in
496498 maxSize = SystemInfo . maxTextureSize ;
497499
498500#if ! UNITY_EDITOR && UNITY_ANDROID
499- string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread ( ( ) => AJC . CallStatic < string > ( "GetVideoThumbnail" , Context , videoPath , TemporaryImagePath + ".png" , false , maxSize , captureTimeInSeconds ) ) ;
501+ string temporaryImagePath = TemporaryImagePath ; // Must be accessed from main thread
502+ string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread ( ( ) => AJC . CallStatic < string > ( "GetVideoThumbnail" , Context , videoPath , temporaryImagePath + ".png" , false , maxSize , captureTimeInSeconds ) ) ;
500503#elif ! UNITY_EDITOR && UNITY_IOS
501- string thumbnailPath = await Task . Run ( ( ) => _NativeCamera_GetVideoThumbnail ( videoPath , TemporaryImagePath + ".png" , maxSize , captureTimeInSeconds ) ) ;
504+ string temporaryImagePath = TemporaryImagePath ; // Must be accessed from main thread
505+ string thumbnailPath = await Task . Run ( ( ) => _NativeCamera_GetVideoThumbnail ( videoPath , temporaryImagePath + ".png" , maxSize , captureTimeInSeconds ) ) ;
502506#else
503507 string thumbnailPath = null ;
504508#endif
0 commit comments