Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix force gc bug #1819

Merged
merged 1 commit into from
Oct 17, 2023
Merged

Fix force gc bug #1819

merged 1 commit into from
Oct 17, 2023

Conversation

cptbtptpbcptdtptp
Copy link
Collaborator

Demo:

import { OrbitControl } from "@galacean/engine-toolkit-controls";
import { Camera, WebGLEngine, Script } from "@galacean/engine";

WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  engine.canvas.resizeByClientSize();

  const rootEntity = engine.sceneManager.activeScene.createRootEntity();

  const cameraEntity = rootEntity.createChild("camera");
  cameraEntity.addComponent(Camera);
  cameraEntity.transform.setPosition(3, 3, 3);
  cameraEntity.addComponent(OrbitControl);

  const cameraEntityAno = rootEntity.createChild("camera1");
  cameraEntityAno.addComponent(Camera);

  class GCScript extends Script {
    private count = 5;
    onUpdate() {
      if (--this.count === 0) {
        rootEntity.removeChild(cameraEntityAno);
        this.engine.destroy();
      }
    }
  }

  rootEntity.addComponent(GCScript);
  engine.run();
});

@cptbtptpbcptdtptp cptbtptpbcptdtptp self-assigned this Oct 16, 2023
@cptbtptpbcptdtptp cptbtptpbcptdtptp added the bug Something isn't working label Oct 16, 2023
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (014de1d) 64.28% compared to head (2d068b0) 64.98%.

❗ Current head 2d068b0 differs from pull request most recent head 5e52c2b. Consider uploading reports for the commit 5e52c2b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1819      +/-   ##
==========================================
+ Coverage   64.28%   64.98%   +0.69%     
==========================================
  Files         473      473              
  Lines       23757    23754       -3     
  Branches     3369     3369              
==========================================
+ Hits        15273    15436     +163     
+ Misses       7294     7115     -179     
- Partials     1190     1203      +13     
Files Coverage Δ
packages/core/src/Engine.ts 87.04% <ø> (-0.13%) ⬇️
packages/core/src/asset/ResourceManager.ts 60.09% <100.00%> (ø)

... and 18 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cptbtptpbcptdtptp cptbtptpbcptdtptp removed the request for review from Mone0712 October 16, 2023 10:26
@GuoLei1990 GuoLei1990 added the resource Resource-related functions label Oct 17, 2023
@GuoLei1990 GuoLei1990 merged commit d7f6945 into galacean:main Oct 17, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resource Resource-related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants