Skip to content

gridMovementPlugin property not found on Scene #47

Answered by Annoraaq
splashsky asked this question in Q&A
Discussion options

You must be logged in to vote

Hi splashsky,

this seems to be Typescript complaining, because the properties for the plugins are added to the GameScene by Phaser at runtime. At compile time Typescript only knows that this refers to class GameScene extends Phaser.Scene which has no property called gridMovementPlugin. I have to investigate, if there is a different way to access plugins in a type safe way.

However, as a workaround you could create a variable or property and tell Typescript what type it has:

const gridMovementPlugin: GridMovementPlugin = (<any>this).gridMovementPlugin;

Or you could add it to your GameScene:

export class GameScene extends Phaser.Scene {
   private gmPlugin: GridMovementPlugin;
    construc…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by splashsky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants