[engine] 修复勾选延迟加载资源时资源不会加载的问题

This commit is contained in:
SmallMain 2022-07-28 22:53:09 +08:00
parent b330bf563c
commit 27477452c5
3 changed files with 11 additions and 4 deletions

View File

@ -819,8 +819,10 @@ let Label = cc.Class({
// 根据材质更新 uniform
const isMultiMaterial = material.material.isMultiSupport();
if (isMultiMaterial) {
// 贴图在 updateRenderData 才确定下来
// if (texture) this._updateMultiTexId(material, texture);
const texture = this._frame._texture;
if (texture instanceof cc.Texture2D && !texture.loaded) {
cc.assetManager.postLoadNative(texture);
}
this._texIdDirty = true;
} else {
material.setProperty('texture', this._frame._texture);

View File

@ -261,6 +261,10 @@ var MotionStreak = cc.Class({
const isMultiMaterial = material.material.isMultiSupport();
if (isMultiMaterial) {
if (!this._texture) return;
const texture = this._texture;
if (texture instanceof cc.Texture2D && !texture.loaded) {
cc.assetManager.postLoadNative(texture);
}
this._updateMultiTexId(material, this._texture);
} else {
const textureImpl = this._texture && this._texture.getImpl();

View File

@ -486,8 +486,9 @@ var Sprite = cc.Class({
// 根据材质更新 uniform
const isMultiMaterial = material.material.isMultiSupport();
if (isMultiMaterial) {
// 在 assembler 中进行更新性能会更好,不需要每次 setSpriteFrame 都更新,并且动态图集会导致两次触发
// if (texture) this._updateMultiTexId(material, texture);
if (texture instanceof cc.Texture2D && !texture.loaded) {
cc.assetManager.postLoadNative(texture);
}
this._texIdDirty = true;
} else {
const textureImpl = texture && texture.getImpl();