# Game Object Or Collections - Best Practices

**URL:** <https://forum.defold.com/t/game-object-or-collections-best-practices/41306>\
**Category:** Questions\
**Created:** [January 23, 2019, 12:13pm UTC](https://forum.defold.com/t/game-object-or-collections-best-practices/41306 "2019-01-23T12:13:55Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 23, 2019, 2:32pm UTC](https://forum.defold.com/t/game-object-or-collections-best-practices/41306/3 "2019-01-23T14:32:49Z")

</div>

> [@sicher](#):
>
> I think that the answer highly depends on what you are building.

It’s a boring answer but also very true.

> [@jfrangoudes](#):
>
> Game Objects or collections as the top level containers for game entities

The first thing to mention is that game objects are cheap. You can have quite a few without any significant impact to performance. If it makes sense to separate an entity in your game into multiple game objects then sure, put them in a collection.

> [@jfrangoudes](#):
>
> - Ability to resize/reposition sprites

Yes, this is nice. For complex things such as bosses or characters with weapons that should be animated but anchored to a main game object it is really convenient to put all of the game objects in a collection.

> [@jfrangoudes](#):
>
> - Multiple scripts controlling different parts of an entity (a gun that has a kickback animation when it fires)

This could potentially have a bit of negative impact on performance, especially if you have a lot of messages going back and forth between the different scripts on a game object. Also if you have multiple scripts you’ll end up with multiple transitions from engine native code across the boundary to the Lua lifecycle functions. The more you can collect your logic in a single script the better.

> [@jfrangoudes](#):
>
> Added complexity in message passing

Yes, this is a risk with the approach. Especially if you have child game objects with collision objects that need to communicate collisions to a script on the parent game object.

> [@jfrangoudes](#):
>
> - In a large project, it can be confusing if certain entities are defined as collections, and others as game objects.

I don’t consider this a big problem. The most annoying thing is usually when you start with a game object and a factory but later on need to change it to a collection and a collection factory.

---

_[View the full topic](https://forum.defold.com/t/game-object-or-collections-best-practices/41306)._
