Is there any good reason why you can’t do this? You can reparent G.O. trees at runtime, so it seems like just an editor limitation?
The whole point of collections is to have reusable…collections of game objects. But if you can’t actually use them as pieces of something larger, that really limits their usefulness.
If you can make your reusable piece out of a single GO then great(!), you can build them up as much as you want, but as soon as you want to reuse a piece with more than one GO…suddenly that’s impossible.
IMO having separate GO and Collection files (and factory/collection-factory components) is just confusing and a nuisance.
I don’t think anyone’s requested this specifically before, but I think it really hurts the UX and causes a lot of other questions, like:
- Q: “How do I move a sprite?” (at runtime), “How do I move a tilemap?”, “How do I scale a sprite in the editor?”
- A: “Put the sprite/tilemap on a child GO and move that.”
- Q: “I tried that and you can’t add child GOs in the editor.”
- A: “Oh yeah, you have to use a collection instead. If you’re also spawning them at runtime you have to switch to a collection-factory component and switch the function you use to spawn it, etc.”
Game-Object Files
- A single GO, can’t have child game objects.
- Instances can be children of other game objects in-editor.
Collection Files
- Can have multiple GOs, at the root level or as a tree.
- Instances can not be children of other game objects, are always added at the global root level.
The engine can obviously handle any parent-child hierarchy of GOs, so I’m wondering why we have to work around this weird limitation.
Alternatively, you could allow child GOs inside .go files, but I believe that would cause a big mess with naming conflicts.