From 65254f2026fbdfdf943acec8efd542c62f938504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Fri, 20 Dec 2019 16:05:47 +0800 Subject: [PATCH] Fix bug when reset ImageAsset with raw data (#5933) --- cocos/core/assets/image-asset.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/core/assets/image-asset.ts b/cocos/core/assets/image-asset.ts index 1bae62bff2..623f4ce7c7 100644 --- a/cocos/core/assets/image-asset.ts +++ b/cocos/core/assets/image-asset.ts @@ -165,7 +165,7 @@ export class ImageAsset extends Asset { } if (nativeAsset !== undefined) { - this._nativeAsset = nativeAsset; + this.reset(nativeAsset); } } @@ -177,7 +177,7 @@ export class ImageAsset extends Asset { if (!(data instanceof HTMLElement)) { // this._nativeData = Object.create(data); this._nativeData = data; - this._nativeData.format = this._format; + this._format = data.format; this._onDataComplete(); } else { this._nativeData = data;