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

Add Script in onStart may cause some functions to not be executed correctly. #2102

Merged
merged 2 commits into from
May 30, 2024

Conversation

cptbtptpbcptdtptp
Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp commented May 23, 2024

link:https://github.com/galacean/editor/issues/2658
Case:

class Script1 extends Script {
      const engine = await WebGLEngine.create({ canvas: document.createElement("canvas") });
      const scene = engine.sceneManager.activeScene;
        onStart(): void {
          entity1.addComponent(Script2);
        }
      }
      class Script2 extends Script {
        onStart(): void {
            console.log('called');
        }
      }

      const entity = scene.createRootEntity("1");
      entity.addComponent(Script1);
      engine.run();

@cptbtptpbcptdtptp cptbtptpbcptdtptp self-assigned this May 23, 2024
@cptbtptpbcptdtptp cptbtptpbcptdtptp added bug Something isn't working script labels May 23, 2024
@cptbtptpbcptdtptp cptbtptpbcptdtptp modified the milestones: 1.2, 1.3 May 23, 2024
@cptbtptpbcptdtptp cptbtptpbcptdtptp requested a review from gz65555 May 23, 2024 03:50
@GuoLei1990 GuoLei1990 merged commit 724bafb into galacean:main May 30, 2024
6 checks passed
GuoLei1990 added a commit to GuoLei1990/galacean-engine that referenced this pull request Jun 3, 2024
* dev/1.3:
  fix: use default material to prevent material[] (galacean#2104)
  Add `Script` in `onStart` may cause some functions to not be executed correctly. (galacean#2102)
  "v1.2.0-beta.5"
  Redesign `Skin` of `SkinnedMeshRenderer` (galacean#2100)
  Fix glTF renderer component's order is random now (galacean#2097)
  "v1.2.0-beta.4"
  "v1.2.0-beta.3"
  Fix the bug of animation playback for multiple same type components under an Entity (galacean#2095)
  Support get any subAsset from GLTFParser (galacean#2093)
  Replace `throw` with `console.error` to prevent blocking the main thread (galacean#2077)
  Fixed the problem that function macro declaration is lost after compilation (galacean#2087)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants