@galacean/engine 0.9.10 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -6257,9 +6257,11 @@
6257
6257
  renderTexture
6258
6258
  ];
6259
6259
  for(var i = 0, n = colorTextures.length; i < n; i++){
6260
- if (colorTextures[i]._isDepthTexture) {
6260
+ var colorTexture = colorTextures[i];
6261
+ if (colorTexture._isDepthTexture) {
6261
6262
  throw "Render texture can't use depth format.";
6262
6263
  }
6264
+ colorTexture._addRefCount(1);
6263
6265
  }
6264
6266
  _this._colorTextures = colorTextures;
6265
6267
  } else {
@@ -6270,6 +6272,7 @@
6270
6272
  throw "Depth texture must use depth format.";
6271
6273
  }
6272
6274
  _this._depthTexture = depth;
6275
+ _this._depthTexture._addRefCount(1);
6273
6276
  }
6274
6277
  _this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
6275
6278
  return _this;
@@ -6299,8 +6302,14 @@
6299
6302
  /**
6300
6303
  * Destroy render target.
6301
6304
  */ _proto.destroy = function destroy() {
6305
+ var _this__depthTexture;
6302
6306
  this._platformRenderTarget.destroy();
6303
- this._colorTextures.length = 0;
6307
+ var _this = this, colorTextures = _this._colorTextures;
6308
+ for(var i = 0, n = colorTextures.length; i < n; i++){
6309
+ colorTextures[i]._addRefCount(-1);
6310
+ }
6311
+ colorTextures.length = 0;
6312
+ (_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addRefCount(-1);
6304
6313
  this._depthTexture = null;
6305
6314
  this._depth = null;
6306
6315
  };
@@ -6741,6 +6750,7 @@
6741
6750
  var fontAtlas = new FontAtlas(engine);
6742
6751
  var texture = new Texture2D(engine, 256, 256);
6743
6752
  fontAtlas.texture = texture;
6753
+ fontAtlas.isGCIgnored = texture.isGCIgnored = true;
6744
6754
  this._fontAtlases.push(fontAtlas);
6745
6755
  return fontAtlas;
6746
6756
  };
@@ -13413,6 +13423,7 @@
13413
13423
  _proto.cloneTo = function cloneTo(target) {
13414
13424
  CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
13415
13425
  Object.assign(target._macroMap, this._macroMap);
13426
+ var referCount = target._getRefCount();
13416
13427
  var propertyValueMap = this._propertyValueMap;
13417
13428
  var targetPropertyValueMap = target._propertyValueMap;
13418
13429
  var keys = Object.keys(propertyValueMap);
@@ -13424,6 +13435,7 @@
13424
13435
  targetPropertyValueMap[k] = property;
13425
13436
  } else if (_instanceof1$2(property, Texture)) {
13426
13437
  targetPropertyValueMap[k] = property;
13438
+ referCount > 0 && property._addRefCount(referCount);
13427
13439
  } else if (_instanceof1$2(property, Array) || _instanceof1$2(property, Float32Array) || _instanceof1$2(property, Int32Array)) {
13428
13440
  targetPropertyValueMap[k] = property.slice();
13429
13441
  } else {
@@ -14751,6 +14763,14 @@
14751
14763
  };
14752
14764
  /**
14753
14765
  * @internal
14766
+ */ _proto._cloneTo = function _cloneTo(target) {
14767
+ var materials = this._materials;
14768
+ for(var i = 0, n = materials.length; i < n; i++){
14769
+ target._setMaterial(i, materials[i]);
14770
+ }
14771
+ };
14772
+ /**
14773
+ * @internal
14754
14774
  */ _proto._onDestroy = function _onDestroy() {
14755
14775
  this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
14756
14776
  this.shaderData._addRefCount(-1);
@@ -14929,7 +14949,7 @@
14929
14949
  ignoreClone
14930
14950
  ], exports.Renderer.prototype, "_overrideUpdate", void 0);
14931
14951
  __decorate$1([
14932
- shallowClone
14952
+ ignoreClone
14933
14953
  ], exports.Renderer.prototype, "_materials", void 0);
14934
14954
  __decorate$1([
14935
14955
  ignoreClone
@@ -15132,18 +15152,9 @@
15132
15152
  }
15133
15153
  var _proto = SpriteMask.prototype;
15134
15154
  /**
15135
- * @override
15136
- * @inheritdoc
15137
- */ _proto._onDestroy = function _onDestroy() {
15138
- var _this__sprite;
15139
- (_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
15140
- this._sprite = null;
15141
- this._renderData = null;
15142
- Renderer.prototype._onDestroy.call(this);
15143
- };
15144
- /**
15145
15155
  * @internal
15146
15156
  */ _proto._cloneTo = function _cloneTo(target) {
15157
+ Renderer.prototype._cloneTo.call(this, target);
15147
15158
  target.sprite = this._sprite;
15148
15159
  };
15149
15160
  /**
@@ -15180,6 +15191,19 @@
15180
15191
  context.camera._renderPipeline._allSpriteMasks.add(this);
15181
15192
  this._maskElement = maskElement;
15182
15193
  };
15194
+ /**
15195
+ * @internal
15196
+ * @inheritdoc
15197
+ */ _proto._onDestroy = function _onDestroy() {
15198
+ Renderer.prototype._onDestroy.call(this);
15199
+ var sprite = this._sprite;
15200
+ if (sprite) {
15201
+ sprite._addRefCount(-1);
15202
+ sprite._updateFlagManager.removeListener(this._onSpriteChange);
15203
+ }
15204
+ this._sprite = null;
15205
+ this._renderData = null;
15206
+ };
15183
15207
  _proto._calDefaultSize = function _calDefaultSize() {
15184
15208
  var sprite = this._sprite;
15185
15209
  if (sprite) {
@@ -15298,9 +15322,13 @@
15298
15322
  set: function set(value) {
15299
15323
  var lastSprite = this._sprite;
15300
15324
  if (lastSprite !== value) {
15301
- lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
15325
+ if (lastSprite) {
15326
+ lastSprite._addRefCount(-1);
15327
+ lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
15328
+ }
15302
15329
  this._dirtyUpdateFlag |= 0x7;
15303
15330
  if (value) {
15331
+ value._addRefCount(1);
15304
15332
  value._updateFlagManager.addListener(this._onSpriteChange);
15305
15333
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
15306
15334
  } else {
@@ -15855,10 +15883,11 @@
15855
15883
  /**
15856
15884
  * @internal
15857
15885
  */ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
15858
- if (this._getRefCount() > 0) {
15859
- var lastBinding = this._vertexBufferBindings[index];
15860
- lastBinding && lastBinding._buffer._addRefCount(-1);
15861
- binding._buffer._addRefCount(1);
15886
+ var referCount = this._getRefCount();
15887
+ if (referCount > 0) {
15888
+ var _this__vertexBufferBindings_index;
15889
+ (_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addRefCount(-referCount);
15890
+ binding == null ? void 0 : binding._buffer._addRefCount(referCount);
15862
15891
  }
15863
15892
  this._vertexBufferBindings[index] = binding;
15864
15893
  this._bufferStructChanged = true;
@@ -15872,11 +15901,13 @@
15872
15901
  /**
15873
15902
  * @override
15874
15903
  */ _proto._addRefCount = function _addRefCount(value) {
15904
+ var _this__indexBufferBinding;
15875
15905
  RefObject.prototype._addRefCount.call(this, value);
15876
15906
  var vertexBufferBindings = this._vertexBufferBindings;
15877
15907
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
15878
15908
  vertexBufferBindings[i]._buffer._addRefCount(value);
15879
15909
  }
15910
+ (_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addRefCount(value);
15880
15911
  };
15881
15912
  /**
15882
15913
  * @override
@@ -15896,6 +15927,11 @@
15896
15927
  };
15897
15928
  _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
15898
15929
  var lastBinding = this._indexBufferBinding;
15930
+ var referCount = this._getRefCount();
15931
+ if (referCount > 0) {
15932
+ lastBinding == null ? void 0 : lastBinding.buffer._addRefCount(-referCount);
15933
+ binding == null ? void 0 : binding.buffer._addRefCount(referCount);
15934
+ }
15899
15935
  if (binding) {
15900
15936
  this._indexBufferBinding = binding;
15901
15937
  this._glIndexType = BufferUtil._getGLIndexType(binding.format);
@@ -17562,12 +17598,14 @@
17562
17598
  var mesh = this._mesh;
17563
17599
  if (mesh && !mesh.destroyed) {
17564
17600
  mesh._addRefCount(-1);
17601
+ mesh._updateFlagManager.removeListener(this._onMeshChanged);
17565
17602
  this._mesh = null;
17566
17603
  }
17567
17604
  };
17568
17605
  /**
17569
17606
  * @internal
17570
17607
  */ _proto._cloneTo = function _cloneTo(target) {
17608
+ Renderer.prototype._cloneTo.call(this, target);
17571
17609
  target.mesh = this._mesh;
17572
17610
  };
17573
17611
  /**
@@ -17857,6 +17895,7 @@
17857
17895
  (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17858
17896
  this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
17859
17897
  this._jointTexture.filterMode = exports.TextureFilterMode.Point;
17898
+ this._jointTexture.isGCIgnored = true;
17860
17899
  }
17861
17900
  shaderData.disableMacro("O3_JOINTS_NUM");
17862
17901
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
@@ -17890,6 +17929,15 @@
17890
17929
  };
17891
17930
  /**
17892
17931
  * @internal
17932
+ * @override
17933
+ */ _proto._onDestroy = function _onDestroy() {
17934
+ var _this_rootBone, _this__jointTexture;
17935
+ MeshRenderer.prototype._onDestroy.call(this);
17936
+ (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
17937
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
17938
+ };
17939
+ /**
17940
+ * @internal
17893
17941
  */ _proto._cloneTo = function _cloneTo(target) {
17894
17942
  MeshRenderer.prototype._cloneTo.call(this, target);
17895
17943
  this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
@@ -19043,14 +19091,17 @@
19043
19091
  _proto._createMesh = function _createMesh(engine, index) {
19044
19092
  var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
19045
19093
  var mesh = new BufferMesh(engine, "BufferMesh" + index);
19094
+ mesh.isGCIgnored = true;
19046
19095
  var vertexElements = [];
19047
19096
  var vertexStride = this.createVertexElements(vertexElements);
19048
19097
  // vertices
19049
- this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
19098
+ var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
19099
+ vertexBuffer.isGCIgnored = true;
19050
19100
  // indices
19051
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
19052
- mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
19053
- mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
19101
+ var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
19102
+ indiceBuffer.isGCIgnored = true;
19103
+ mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
19104
+ mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
19054
19105
  mesh.setVertexElements(vertexElements);
19055
19106
  return mesh;
19056
19107
  };
@@ -19283,6 +19334,12 @@
19283
19334
  var _proto = Sky.prototype;
19284
19335
  /**
19285
19336
  * @internal
19337
+ */ _proto.destroy = function destroy() {
19338
+ this.mesh = null;
19339
+ this.material = null;
19340
+ };
19341
+ /**
19342
+ * @internal
19286
19343
  */ _proto._render = function _render(context) {
19287
19344
  var _this = this, material = _this.material, mesh = _this.mesh;
19288
19345
  if (!material) {
@@ -19321,6 +19378,40 @@
19321
19378
  rhi.drawPrimitive(mesh, mesh.subMesh, program);
19322
19379
  cameraShaderData.setMatrix(RenderContext._vpMatrixProperty, originViewProjMatrix);
19323
19380
  };
19381
+ _create_class$3(Sky, [
19382
+ {
19383
+ key: "material",
19384
+ get: /**
19385
+ * Material of the sky.
19386
+ */ function get() {
19387
+ return this._material;
19388
+ },
19389
+ set: function set(value) {
19390
+ if (this._material !== value) {
19391
+ var _this__material;
19392
+ value == null ? void 0 : value._addRefCount(1);
19393
+ (_this__material = this._material) == null ? void 0 : _this__material._addRefCount(-1);
19394
+ this._material = value;
19395
+ }
19396
+ }
19397
+ },
19398
+ {
19399
+ key: "mesh",
19400
+ get: /**
19401
+ * Mesh of the sky.
19402
+ */ function get() {
19403
+ return this._mesh;
19404
+ },
19405
+ set: function set(value) {
19406
+ if (this._mesh !== value) {
19407
+ var _this__mesh;
19408
+ value == null ? void 0 : value._addRefCount(1);
19409
+ (_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addRefCount(-1);
19410
+ this._mesh = value;
19411
+ }
19412
+ }
19413
+ }
19414
+ ]);
19324
19415
  return Sky;
19325
19416
  }();
19326
19417
  (function() {
@@ -19350,11 +19441,28 @@
19350
19441
  this.sky = new Sky();
19351
19442
  this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
19352
19443
  this._texture = null;
19353
- this._mesh = this._createPlane(_engine);
19444
+ this._initMesh(_engine);
19354
19445
  };
19355
19446
  var _proto = Background.prototype;
19356
19447
  /**
19357
19448
  * @internal
19449
+ */ _proto.destroy = function destroy() {
19450
+ this._mesh._addRefCount(-1);
19451
+ this._mesh = null;
19452
+ this.texture = null;
19453
+ this.solidColor = null;
19454
+ this.sky.destroy();
19455
+ this._engine = null;
19456
+ };
19457
+ /**
19458
+ * @internal
19459
+ * Standalone for CanvasRenderer plugin.
19460
+ */ _proto._initMesh = function _initMesh(engine) {
19461
+ this._mesh = this._createPlane(engine);
19462
+ this._mesh._addRefCount(1);
19463
+ };
19464
+ /**
19465
+ * @internal
19358
19466
  */ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
19359
19467
  if (!this._texture) {
19360
19468
  return;
@@ -19423,6 +19531,9 @@
19423
19531
  },
19424
19532
  set: function set(value) {
19425
19533
  if (this._texture !== value) {
19534
+ var _this__texture;
19535
+ value == null ? void 0 : value._addRefCount(1);
19536
+ (_this__texture = this._texture) == null ? void 0 : _this__texture._addRefCount(-1);
19426
19537
  this._texture = value;
19427
19538
  this._engine._backgroundTextureMaterial.shaderData.setTexture("u_baseTexture", value);
19428
19539
  }
@@ -19922,6 +20033,7 @@
19922
20033
  this._rootEntities[0].destroy();
19923
20034
  }
19924
20035
  this._activeCameras.length = 0;
20036
+ this.background.destroy();
19925
20037
  this.shaderData._addRefCount(-1);
19926
20038
  };
19927
20039
  _proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
@@ -20312,7 +20424,7 @@
20312
20424
  _this._spriteDefaultMaterial = _this._createSpriteMaterial();
20313
20425
  _this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
20314
20426
  _this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
20315
- _this._textDefaultFont.isGCIgnored = false;
20427
+ _this._textDefaultFont.isGCIgnored = true;
20316
20428
  _this.inputManager = new InputManager(_assert_this_initialized(_this));
20317
20429
  var magentaPixel = new Uint8Array([
20318
20430
  255,
@@ -20347,6 +20459,7 @@
20347
20459
  _this._magentaTexture2DArray = magentaTexture2DArray;
20348
20460
  }
20349
20461
  var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
20462
+ magentaMaterial.isGCIgnored = true;
20350
20463
  magentaMaterial.shaderData.setColor("u_baseColor", new Color(1.0, 0.0, 1.01, 1.0));
20351
20464
  _this._magentaMaterial = magentaMaterial;
20352
20465
  var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
@@ -21872,7 +21985,11 @@
21872
21985
  var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
21873
21986
  this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
21874
21987
  }
21875
- this._renderTargets = null;
21988
+ var renderTargets = this._renderTargets;
21989
+ if (renderTargets) {
21990
+ renderTargets.destroy();
21991
+ this._renderTargets = null;
21992
+ }
21876
21993
  var viewportOffset = this._viewportOffsets;
21877
21994
  var shadowTileResolution1 = this._shadowTileResolution;
21878
21995
  switch(shadowCascades){
@@ -23894,10 +24011,17 @@
23894
24011
  * @internal
23895
24012
  */ _proto._addSprite = function _addSprite(sprite) {
23896
24013
  this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
24014
+ sprite._atlas = this;
24015
+ sprite.isGCIgnored = true;
23897
24016
  };
23898
24017
  /**
23899
24018
  * @override
23900
24019
  */ _proto._onDestroy = function _onDestroy() {
24020
+ var _this = this, sprites = _this._sprites;
24021
+ for(var i = 0, n = sprites.length; i < n; i++){
24022
+ sprites[i].destroy();
24023
+ }
24024
+ sprites.length = 0;
23901
24025
  this._sprites = null;
23902
24026
  this._spriteNamesToIndex = null;
23903
24027
  };
@@ -23996,10 +24120,29 @@
23996
24120
  };
23997
24121
  /**
23998
24122
  * @override
24123
+ * @internal
24124
+ */ _proto._addRefCount = function _addRefCount(value) {
24125
+ var _this__atlas;
24126
+ RefObject.prototype._addRefCount.call(this, value);
24127
+ (_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addRefCount(value);
24128
+ };
24129
+ /**
24130
+ * @override
24131
+ * @internal
23999
24132
  */ _proto._onDestroy = function _onDestroy() {
24000
- if (this._texture) {
24001
- this._texture = null;
24002
- }
24133
+ this._positions.length = 0;
24134
+ this._positions = null;
24135
+ this._uvs.length = 0;
24136
+ this._uvs = null;
24137
+ this._atlasRegion = null;
24138
+ this._atlasRegionOffset = null;
24139
+ this._region = null;
24140
+ this._pivot = null;
24141
+ this._border = null;
24142
+ this._bounds = null;
24143
+ this._atlas = null;
24144
+ this._texture = null;
24145
+ this._updateFlagManager = null;
24003
24146
  };
24004
24147
  _proto._calDefaultSize = function _calDefaultSize() {
24005
24148
  if (this._texture) {
@@ -24102,7 +24245,7 @@
24102
24245
  key: "width",
24103
24246
  get: /**
24104
24247
  * The width of the sprite (in world coordinates).
24105
- *
24248
+ *
24106
24249
  * @remarks
24107
24250
  * If width is set, return the set value,
24108
24251
  * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
@@ -24125,7 +24268,7 @@
24125
24268
  key: "height",
24126
24269
  get: /**
24127
24270
  * The height of the sprite (in world coordinates).
24128
- *
24271
+ *
24129
24272
  * @remarks
24130
24273
  * If height is set, return the set value,
24131
24274
  * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
@@ -24426,21 +24569,11 @@
24426
24569
  /**
24427
24570
  * @internal
24428
24571
  */ _proto._cloneTo = function _cloneTo(target) {
24572
+ Renderer.prototype._cloneTo.call(this, target);
24429
24573
  target.sprite = this._sprite;
24430
24574
  target.drawMode = this._drawMode;
24431
24575
  };
24432
24576
  /**
24433
- * @internal
24434
- */ _proto._onDestroy = function _onDestroy() {
24435
- var _this__sprite;
24436
- (_this__sprite = this._sprite) == null ? void 0 : _this__sprite._updateFlagManager.removeListener(this._onSpriteChange);
24437
- this._color = null;
24438
- this._sprite = null;
24439
- this._assembler = null;
24440
- this._renderData = null;
24441
- Renderer.prototype._onDestroy.call(this);
24442
- };
24443
- /**
24444
24577
  * @override
24445
24578
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
24446
24579
  if (this.sprite) {
@@ -24478,6 +24611,20 @@
24478
24611
  context.camera._renderPipeline.pushPrimitive(spriteElement);
24479
24612
  }
24480
24613
  };
24614
+ /**
24615
+ * @internal
24616
+ */ _proto._onDestroy = function _onDestroy() {
24617
+ Renderer.prototype._onDestroy.call(this);
24618
+ var sprite = this._sprite;
24619
+ if (sprite) {
24620
+ sprite._addRefCount(-1);
24621
+ sprite._updateFlagManager.removeListener(this._onSpriteChange);
24622
+ }
24623
+ this._color = null;
24624
+ this._sprite = null;
24625
+ this._assembler = null;
24626
+ this._renderData = null;
24627
+ };
24481
24628
  _proto._calDefaultSize = function _calDefaultSize() {
24482
24629
  var sprite = this._sprite;
24483
24630
  if (sprite) {
@@ -24569,9 +24716,13 @@
24569
24716
  set: function set(value) {
24570
24717
  var lastSprite = this._sprite;
24571
24718
  if (lastSprite !== value) {
24572
- lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
24719
+ if (lastSprite) {
24720
+ lastSprite._addRefCount(-1);
24721
+ lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
24722
+ }
24573
24723
  this._dirtyUpdateFlag |= 0x7;
24574
24724
  if (value) {
24725
+ value._addRefCount(1);
24575
24726
  value._updateFlagManager.addListener(this._onSpriteChange);
24576
24727
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
24577
24728
  } else {
@@ -25175,6 +25326,7 @@
25175
25326
  /**
25176
25327
  * @internal
25177
25328
  */ _proto._cloneTo = function _cloneTo(target) {
25329
+ Renderer.prototype._cloneTo.call(this, target);
25178
25330
  target.font = this._font;
25179
25331
  target._subFont = this._subFont;
25180
25332
  };
@@ -35987,7 +36139,7 @@
35987
36139
  }));
35988
36140
 
35989
36141
  //@ts-ignore
35990
- var version = "0.9.10";
36142
+ var version = "0.9.12";
35991
36143
  console.log("Galacean engine version: " + version);
35992
36144
  for(var key in CoreObjects){
35993
36145
  Loader.registerClass(key, CoreObjects[key]);