Confusion between GO files from project explorer and those created in collection

I have a tree in my game. That tree is made up of a few different sprites (leaves, trunk, shadow). As I need to change the scale of those images (and as it is not possible to change the scale of a sprite directly) I put them inside another game object (so Leaves, Trunk and Shadow are three GOs inside the tree GO, and the code changes the scale of GO rather than the image). But the problem I’m having is that:

  1. I can’t copy the “tree” game object and have two instances of it inside the same collection (i get a name clash), but also
  2. If I create a “tree” game object in the project explorer (and then put an instance of it into the scene) I can’t put other game objects inside it.

Any help? I have checked documentation already but I am unable to understand why this would be the case.

You should be able to rename the tree game object and it’s children such that their ids are unique for the collection.

If you need the GO:s having the same names in the hierarchy, create a “tree” collection file with the tree game object structure, then add that collection to main as many times as you need.

See http://www.defold.com/manuals/building-blocks/#_collections

@sicher that’s the problem I was having, the script refers to the sub objects by names. I’ll investigate that link because I’m sure it will help. Thanks and thankd @britzl

Hm… I am having some strange behaviour with my collisions now. Namely, they stop working when there is more than one instance of the new “tree” collection. I can’t imagine why that would happen… I will look into it.

edit: Creating another instance of the tree collection within the scene causes some strange behaviour with the collision detection (collision detections seem to fail randomly) whereas creating another copy of the collection (in the project explorer) and then placing THAT in the scene, everything works fine.

Edit: I’ve got it. It was unrelated