Skip to content

Commit

Permalink
Fixed web runtime error of editor mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JiepengTan committed Oct 23, 2024
1 parent 0de746a commit 6ca1989
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions platform/web/js/engine/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ const Engine = (function () {
* @return {Promise} A ``Promise`` that resolves once the engine is loaded and initialized.
*/
init: function (basePath) {
GodotEngine = this;
const me = this;
if (initPromise) {
return initPromise;
}
Expand All @@ -87,7 +89,6 @@ const Engine = (function () {
}
Engine.load(basePath, this.config.fileSizes[`${basePath}.wasm`]);
}
const me = this;

createWrapper = function (module, name) {
return function() {
Expand Down Expand Up @@ -158,6 +159,8 @@ const Engine = (function () {
start: function (override) {
this.config.update(override);
const me = this;
const exe = this.config.executable;
this.basePath = exe;
return me.init().then(function () {
if (!me.rtenv) {
return Promise.reject(new Error('The engine must be initialized before it can be started'));
Expand Down Expand Up @@ -205,7 +208,7 @@ const Engine = (function () {
return Promise.all(libs).then(function () {
if (libs.length === 0) {
basePath = me.basePath;
const gdspxPath = basePath.replace("index", "gdspx");
const gdspxPath = "gdspx";
const gdspxPromise = preloader.loadPromise(`${gdspxPath}.wasm`, me.config.fileSizes[`${gdspxPath}.wasm`], true);

return gdspxPromise.then(function (gdspxResponse) {
Expand Down

0 comments on commit 6ca1989

Please sign in to comment.