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

Using a custom Phaser.Game class #32

Closed
eli-s-r opened this issue Mar 26, 2021 · 1 comment
Closed

Using a custom Phaser.Game class #32

eli-s-r opened this issue Mar 26, 2021 · 1 comment
Labels
question Further information is requested

Comments

@eli-s-r
Copy link

eli-s-r commented Mar 26, 2021

Hi! I'm having issues getting this to work with my setup which uses a custom class that extends Phaser.Game (necessary as there's data that needs to be passed into the game and its scenes from React). I noticed that the game is initialized by instantiating a new Phaser.Game directly, but can't find a way to customize this. I'm also a bit confused as to the purpose of the instance prop on the GameInstance type, as instantiating the game externally doesn't allow for the necessary ref to be passed into the game. Is there any way I might be able to get around this?

Thank you so much!

@jdnichollsc
Copy link
Member

jdnichollsc commented Mar 26, 2021

For that specific scenario I recommend you using Phaser with React hooks instead, e.g: https://stackblitz.com/edit/react-phaser

@jdnichollsc jdnichollsc added the question Further information is requested label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants