Hot reloading a game object file causes script properties to become nil

I have a player.go with a player.script attached. The script has two properties on it defined with go.property(). I’m using the Platypus library.

If I run the game and try to change the properties inside player.script, the game can reload with no issues. But if I try to change the properties on the game object in its Properties window, an error is thrown:

ERROR:SCRIPT: /platypus/platypus.lua:282: You must provide a velocity
stack traceback:
	[C]: in function 'assert'
	/platypus/platypus.lua:282: in function 'right'
	/src/player/player.script:30: in function </src/player/player.script:28>

This pops up because I’m calling self.platypus.right(self.move_speed) in on_update. I couldn’t get a print statement from on_reload, but I figured it was safe to assume self.move_speed was nil.

What causes this to happen? Is there a way for me to prevent this behaviour, or should I stick to reloading the script instead?

Managed to run into this exact same issue 1 year later. Hot reloading game object files seems to remove their properties. I tried this with go.get() too, the error I get says:

ERROR:SCRIPT: /main/player.script:25: '/go_player#player' does not have any property called 'jump_height'
stack traceback:
  [C]:-1: in function get
  /main/player.script:25: in function </main/player.script:23>

Is it possible to hot reload properties in a game object file, or should I continue to hot reload from scripts?

2 Likes

It should be possible to hot reload script properties, since they’re part of the actual game object prototype. So if this fails, it’s clearly a bug.

2 Likes