Jump to content

Handling cross-scene input for a sprite


Recommended Posts



I am running two scenes in parallell.


I add a sprite in one scene, but I want to make it interactive in another scene, so that the code bellow would work

// In scene 2

this.input.on('pointerdown', (pointer, [gameObject]) => {
    if (!gameObject) {
        console.log('clicked', gameObject)


I have tried to explicitly add it to scene 2

// in scene 2, "sprite" was created in scene 1 and passed via the data register
if (sprite) {


But this does not work since even if `add.existing(...)` does add the sprite to the input list, it does so using `object.scene` which is the scene were the sprite was originally created.


Sp, my question is, can I add the external sprite to the scenes input list (without duplicating the data preferrably)?


Thanks in advance.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...