@@ -109,7 +109,11 @@ public async Task<Texture2D> CreateNewTextureAsync() {
109109 public void LoadIntoTexture ( Texture2D texture ) {
110110 using ( LoadIntoTextureMarker . Auto ( ) ) {
111111 var mipmapCount = CalculateMipmapCount ( true ) ;
112+ #if UNITY_2021_1_OR_NEWER
113+ texture . Reinitialize ( _width , _height , _textureFormat , _loaderSettings . generateMipmap ) ;
114+ #else
112115 texture . Resize ( _width , _height , _textureFormat , _loaderSettings . generateMipmap ) ;
116+ #endif
113117 var rawTextureView = texture . GetRawTextureData < byte > ( ) ;
114118 LoadRawTextureData ( rawTextureView ) ;
115119 ProcessRawTextureData ( rawTextureView , mipmapCount ) ;
@@ -120,7 +124,11 @@ public void LoadIntoTexture(Texture2D texture) {
120124
121125 public async Task LoadIntoTextureAsync ( Texture2D texture ) {
122126 var mipmapCount = CalculateMipmapCount ( true ) ;
127+ #if UNITY_2021_1_OR_NEWER
128+ texture . Reinitialize ( _width , _height , _textureFormat , _loaderSettings . generateMipmap ) ;
129+ #else
123130 texture . Resize ( _width , _height , _textureFormat , _loaderSettings . generateMipmap ) ;
131+ #endif
124132 var rawTextureView = texture . GetRawTextureData < byte > ( ) ;
125133 await Task . Run ( ( ) => LoadRawTextureData ( rawTextureView ) ) ;
126134 ProcessRawTextureData ( rawTextureView , mipmapCount ) ;
@@ -325,7 +333,7 @@ static void FilterMipmapRGBA32(ref FilterMipmapJob job, int outputIndex) {
325333 public NativeSlice < byte > inputMipmap ;
326334 public int2 inputDimensions ;
327335
328- [ WriteOnly , NativeDisableParallelForRestriction ]
336+ [ WriteOnly , NativeDisableContainerSafetyRestriction , NativeDisableParallelForRestriction ]
329337 public NativeSlice < byte > outputMipmap ;
330338 public int2 outputDimensions ;
331339
0 commit comments