Player.collection not updating with changes to player.go?

#1

I’m a beginner and messing around with the platformer example code that is included with Defold. I added a spear sprite to my player.go object and gave it a collision shape. So now my player.go has 2 sprites and 2 collision shapes.

The player game object is included in a player.collection along with a camera. I have noticed, that the player.collection is not updated with the new sprite and collision object… Is there a reason for this?

As a test, I tried changing the sprite location in my player.go and indeed, the location is not updated in the player.collection. I tried deleting the player game object from the collection and re-adding it, but that’s not ideal because there’s a camera in there too that I’d also have to re-add.

0 Likes

#2

This sounds a bit strange. Can you share some screenshots? Or an example project with this change in place so I can take a look?

0 Likes

#3

@britzl Sure no problem. Here’s my player.go

Here’s a screenshot of my player.collection

Here’s my project zipped up.

Mining_Game.zip (853.7 KB)

Thanks for looking at this! Much appreciated.

1 Like

#4

I’m unable to reproduce any problems with this (although I might be doing it wrong).

Could you please describe the exact steps I need to take from the point where the project is opened until the problem occurs?

0 Likes

#5

The issue is in the tutorial. The game object in player.collection is not player.go from the asset pane. It is a generic game object renamed as player.go with the same components (plus camera) added to it.

@britzl - to verify this:

  • Create a new Platformer game project
  • Open player.collection, so you can see player.go in there
  • Delete player.go from the assets pane
  • Note that player.go in player.collection is unaffected, since they are not linked

Looks like the tutorial needs to be updated to fix this.

1 Like

#6

It’s not really a tutorial, just a sample/template project: https://github.com/defold/template-platformer

But yeah, this explains it. The player.go should be removed! Thanks for pointing this out.

1 Like

#7

Aaaand now it is gone.

2 Likes

#8

@britzl @Alex_8BitSkull Wonderful! Thanks to both of you for the help.

2 Likes