Skip to content

Loading a script should default its type to "script" #5994

@ItsGravix

Description

@ItsGravix

Version

  • Phaser Version: v3.60.0-beta.4
  • Operating system: Windows 11
  • Browser: Google Chrome

Description

Loading a script should default its type to "script" to prevent older code from breaking.
If a type is not provided, this error will be thrown:

Uncaught Error: Invalid Loader.false key
    at ScriptFile.File (phaser.js:107085:19)
    at new ScriptFile (phaser.js:116182:14)
    at LoaderPlugin.script (phaser.js:116289:22)
    at EventEmitter.<anonymous> (<anonymous>:116:21)
    at EventEmitter.emit (phaser.js:197:35)
    at LoaderPlugin.<anonymous> (<anonymous>:273:37)
    at LoaderPlugin.emit (phaser.js:200:35)
    at LoaderPlugin.loadComplete (phaser.js:108625:14)
    at LoaderPlugin.fileProcessComplete (phaser.js:108591:18)
    at ImageFile.onProcessComplete (phaser.js:107408:21)

Example Test Code

Non-working code:
scene.load.script('RoomScene', 'assets/RoomScene.js');

Working Code:
scene.load.script('RoomScene', 'assets/RoomScene.js', 'script');

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions