I add a collection file ‘A’ in collection ‘B’ and change the position of game object which is belong to A collection in B collection, when I restart the defold, the change didn’t work.
Is this a bug? or it is working like this?
That’s just how it works. You can change the position, rotation, and scale of collection ‘A’ inside collection ‘B’, but you can’t move the game objects inside collection ‘A’ (without modifying the original and therefore all instances). I believe the only things you can change per-collection-instance are script properties.
The editor is kind of bad about enforcing and showing these things. Some things, like the transforms, show up in the editor but are wiped on restart, other things, like changing the default animation on a sprite, will actually modify the prototype collection.
Note that if you, say, change the scale of collection ‘A’, that scale will be applied to all the game objects in that collection, if you check it at runtime.
In my opinion they should just not be allowed at all—make those property fields read-only or not show them.
thanks
Thank you for bringing this to our attention. We will look into making the behavior more intuitive. Or at least document better what is going on and why.
Agreed, I’d prefer it to be read-only.
Actually, I would suggest different thing. Much better to just apply change immediately to collection file (and all instances), because this is the same logic as instant applying changes of game object properties to all instances.
Just an example - I have instance of game object with sprite and changed position X of sprite in editor. It is immediately applied to game object file and all other instances. Let’s say I have instance of collection file deep in hierarchy with some game object inside. With the same logic I expect that after I change position X of game object - this will update collection file immediately (and all instances of this collection file). Instead I see change applied just visually in editor. However, logic works with other actions - if I remove game object from instance of collection file somewhere in deep hierarchy - this action applied immediately for collection file and all instances.
Another reason to avoid “read-only”: let’s say I have sophisticated scene and trying to tweak few positions of some objects. I need to do this in a full scene to see how it looks. But, after I make tweaks, I need to white them down in notebook (because they applied only visually!) then enter appropriate collection files, where these objects are first tier children and re-enter changes. Which is weird.