Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.

Facebook Instant Games issue - can't add plugin #35

Open
bkirvin opened this issue Jun 19, 2019 · 3 comments
Open

Facebook Instant Games issue - can't add plugin #35

bkirvin opened this issue Jun 19, 2019 · 3 comments

Comments

@bkirvin
Copy link

bkirvin commented Jun 19, 2019

Node 9.2.1

npm

.yo-rc.json
{
"generator-phaser-plus": {
"meta": {
"createdWith": "3.0.0-beta.7",
"creationDate": "2019-06-03T18:33:31.708Z"
},
"objects": {
"dest": "app/scripts/objects/"
},
"plugins": {
"dest": "app/scripts/plugins/"
},
"scenes": {
"dest": "app/scripts/scenes/",
"index": {
"name": "app/scripts/scenes/index.js",
"requirePath": "./"
}
}
}
}

I have added

<script src="https://connect.facebook.net/en_US/fbinstant.6.2.js"></script>

to the index.html file head. I also tried adding it to the body above the comment line where scripts are injected.

I also added

new webpack.DefinePlugin({
// Required by Phaser: Enable Canvas and WebGL renderers.
'CANVAS_RENDERER': JSON.stringify(true),
'WEBGL_RENDERER': JSON.stringify(true),
'PLUGIN_FBINSTANT': JSON.stringify(true)
}),

to the gulpfile.js/webpack/config/plugins.js file but I get the FBInstant is not defined when I add this to my index.js file

export function boot() {
return new Phaser.Game(config);
}
FBInstant.initializeAsync().then(function() {
FBInstant.setLoadingProgress(100);
FBInstant.startGameAsync().then(function() {
boot();
});
});

Any idea what I'm doing wrong? Other development environments do this and it works great, but this generated development environment is the best I've found yet and I would love to make it my go to project creator.

Thanks for your work on this generator.

@rblopes
Copy link
Owner

rblopes commented Jun 19, 2019

Sorry about that.

It's been a while since I made any significant updates to the generator template, and Facebook Instant Games are a recent addition to Phaser I'm not aware of yet. I'll have a look into this issue later.

@bkirvin
Copy link
Author

bkirvin commented Jun 19, 2019

There are two parts to this plug in. The Facebook SDK referenced by the URL created by Facebook and also Phaser's own plugin phaser-facebook-instant-games.js that exposes calls (this.facebook.call()) within the game code. Thank you for your response.

@bkirvin
Copy link
Author

bkirvin commented Jun 19, 2019

Amazing project generator, btw. I wish Phaser would officially adopt this structure and provide all code examples compliant with this set up.

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

No branches or pull requests

2 participants