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

TypeError: path is undefined #2

Open
WillYuum opened this issue May 14, 2020 · 3 comments
Open

TypeError: path is undefined #2

WillYuum opened this issue May 14, 2020 · 3 comments

Comments

@WillYuum
Copy link

I have added the godot game into my site using the example provided in the repo.

Godot version: 3.2.1 stable win64

image

Reproduce:

  • Added the game files in the public folder
  • Imported ReactGodot component and added the required properties(pck and script)
<ReactGodot pck={"./game/game.pck"} script={"./game/game.js"} />
  • added the directory the same way it's used in the example in the repo leading to get me the error in the image.
@d3dc
Copy link
Owner

d3dc commented May 17, 2020

Where is path consumed? Its not in that stacktrace.

Its part of godot's generated game.js, right?

It sounds like a version incompatibility. I would need to do what I mentioned in #1 and make a map of different configuration values for different engines.

@WillYuum
Copy link
Author

WillYuum commented May 23, 2020

Ah yes, I am using Godot 3.2 and this could be reason for the issue.
I think I'll try to put the directory manually from the package files for now.

@city41
Copy link

city41 commented Aug 29, 2020

I hit this issue as well. I am using Godot 3.2.2. I was able to fix it with this in ReactCanvas.tsx

.startGame(pck.replace('.pck', ''), pck)

Godot's js seems to now be looking for a base name it can use to find the wasm file. In my case, my pck file is called index.pck and my wasm is index.wasm, so stripping off .pck enabled Godot to find my wasm file and start the game.

This is what my startGame looks like inside my index.js file that Godot generated

    this.startGame = function(execName, mainPack) {
      executableName = execName;
      var mainArgs = ['--main-pack', getPathLeaf(mainPack)];

      return Promise.all([
        this.init(getBasePath(execName)),
        this.preloadFile(mainPack, getPathLeaf(mainPack)),
      ]).then(Function.prototype.apply.bind(synchronousStart, this, mainArgs));
    };

Based on this error, I am guessing startGame used to be startGame(mainPack)

I am brand new to Godot, so I may be wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants