PhaserEditor2D-v3 icon indicating copy to clipboard operation
PhaserEditor2D-v3 copied to clipboard

Images don't load if there is an audio key with the same key as the sprite

Open robinheidrich opened this issue 2 years ago • 8 comments

Version

  • Phaser Editor 2D Version: 3.33.2
  • Operating System: Windows 11
  • Web Browser and version: Google Chrome 103.0.5060.114

Description

I have an audio in the pack of my scene with the same key as the spritesheet. When I change the key, the images load normally again.

In Phaser, both the images and the audio load, so I assume it shouldn't be a problem to use the same key since they are two different types.

So I assume it's a problem with Phaser Editor?

image

robinheidrich avatar Jul 07 '22 19:07 robinheidrich

Yes you should use different keys.

PhaserEditor2D avatar Jul 09 '22 12:07 PhaserEditor2D

But why? In Phaser you can use the same keys.

robinheidrich avatar Jul 09 '22 14:07 robinheidrich

It is different in Phaser Editor. We use a custom cache for storing the images.

This is something I can fix but may introduce bugs. I don't know if the issue worths the effort and risk.

Is it mandatory for you to share the same keys? I would like to know more the problem.

PhaserEditor2D avatar Jul 09 '22 22:07 PhaserEditor2D

I have several scenes that have background music, and for this background music I would like to use the same key as for the sprite.

If this could really cause problems, an alternative for me would be to just set the scene key as a prefix in the background music key, like sceneName/background. Even though I would rather use the scene key.

robinheidrich avatar Jul 10 '22 00:07 robinheidrich

Yes it is a bit problematic to change it. It may introduce bugs.

But please, can you explain me a bit why are you organizing the assets in that way? I need to understand the big picture here.

arianfornaris avatar Jul 11 '22 03:07 arianfornaris

I have several rooms in my game that all have a sprite and background music. The sprite has the same key as the scene of the room, so I find it most useful if the audio also has the same key.

Wouldn't it be enough to use the type as a prefix in the caching? Like for example sprite/myspritename or audio/mybackground. Or is it more complicated than that?

robinheidrich avatar Jul 11 '22 13:07 robinheidrich

Hi. You find it more useful if the audio also has the same key, but why? I can change the editor for allowing repeated keys, but it may introduce bugs. Maybe you can use a prefix in your audio keys in the meantime.

PhaserEditor2D avatar Jul 25 '22 12:07 PhaserEditor2D

I think it would be more consistent. You could use the same key for sprite and audio instead of different ones.

And since Phaser uses keys per type, I think it makes the most sense for Phaser Editor to do the same.

I was really surprised when the images stopped loading in Phaser Editor, since it worked in Phaser.

robinheidrich avatar Jul 25 '22 19:07 robinheidrich