react-godot
react-godot copied to clipboard
TypeError: path is undefined
I have added the godot game into my site using the example provided in the repo.
Godot version: 3.2.1 stable win64
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.
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.
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.
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.