# Solution to the lack of flexibility in Collection file and Game Object file

**URL:** <https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590>\
**Category:** The Defoldmine\
**Created:** [March 26, 2026, 7:48am UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590 "2026-03-26T07:48:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuLongZhiLu](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/julongzhilu/32/42720_2.png) [@JuLongZhiLu](https://forum.defold.com/u/JuLongZhiLu)\
**Post date:** [March 26, 2026, 7:48am UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/1 "2026-03-26T07:48:12Z")

</div>

I’m just writing this down as I felt. Don’t take it too seriously. 😀

* * *

# Background

I previously created a canon\_enemy that can fire projectiles using a collection file. Today, I wanted to give this canon\_enemy the ability to move vertically in certain scenes, but the collection file simply can’t do that because modifying the canon\_enemy in one scene will modify all canon\_enemy in all scenes.

Of course, I can solve this problem by creating a new collection file called canon\_movale\_enemy.But when I need to add more functionality to the canon\_enemy, I’ll be forced to create more and more collection files.

However, I later discovered that modifying the script properties of certain instantiated Collection files individually is also a good solution.

* * *

# Solution

The drawback of a Game Object file is that it cannot contain Game Objects; it can only store components.

However, modifying the script properties of a instantiated Game Object file will not affect other instantiated Game Object files.

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/a/5/a57eba81c2286a22074ecbb0386776367de22bde.png)

Although a Collection file can hold multiple game objects, modifying a instantiated Collection file in one scene will also modify instantiated Collection files in other scenes.

However, modifying the script properties of a instantiated Collection file will not affect other instantiated Collection files.

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/4/5/45d33f2006399011555a11c2ccc67b113578b2c4.png)

My solution is to put all prefabs into a single Collection File. When a scene needs these prefabs, I manually copy the corresponding prefabs from this Collection File to other scenes.

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/1/7/1774f0b20bbcbf2e30acdfac70a7ed5ed5e2e108.png)

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/d/c/dc061950b119f6c916c0248951dbcf9c622e93ac.png)

This solution reminds me of the Contruct3 game engine; I remember seeing something similar when I watched a Contruct3 video tutorial a year ago.

Then I thought of creating a collection file to store custom “components”. These components could be scripts or Game Objects. Some custom components could implement vertical movement, while others could implement bullet firing. These custom components could then be freely combined and placed elsewhere.

---

<div class="post-metadata">

**Author:** ![a-daniel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/a-daniel/32/39781_2.png) [@a-daniel](https://forum.defold.com/u/a-daniel)\
**Post date:** [March 27, 2026, 1:26pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/2 "2026-03-27T13:26:21Z")

</div>

> [@JuLongZhiLu](#):
>
> My solution is to put all prefabs into a single Collection File. When a scene needs these prefabs, I manually copy the corresponding prefabs from this Collection File to other scenes.

I’m not sure I understand this part. Instead of storing game objects/components as files in the project structure you create them inside a collection? And you copy-paste from this collection to other collections?

---

<div class="post-metadata">

**Author:** ![JuLongZhiLu](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/julongzhilu/32/42720_2.png) [@JuLongZhiLu](https://forum.defold.com/u/JuLongZhiLu)\
**Post date:** [March 27, 2026, 2:21pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/3 "2026-03-27T14:21:40Z")

</div>

> [@a-daniel](#):
>
> you create them inside a collection

> [@a-daniel](#):
>
> And you copy-paste from this collection to other collections

Yes 😀

---

<div class="post-metadata">

**Author:** ![a-daniel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/a-daniel/32/39781_2.png) [@a-daniel](https://forum.defold.com/u/a-daniel)\
**Post date:** [March 27, 2026, 2:33pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/4 "2026-03-27T14:33:36Z")

</div>

What problem does this solve? Is there any advantage over having files?

---

<div class="post-metadata">

**Author:** ![JuLongZhiLu](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/julongzhilu/32/42720_2.png) [@JuLongZhiLu](https://forum.defold.com/u/JuLongZhiLu)\
**Post date:** [March 27, 2026, 3:52pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/5 "2026-03-27T15:52:50Z")

</div>

Actually, I later realized this isn’t very useful 😂 . Maybe in certain specific scenarios it has a slight advantage over having files. 🤔

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [March 27, 2026, 4:59pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/6 "2026-03-27T16:59:12Z")

</div>

If you have a templated structure that you need to recreate quickly, I would suggest looking at editor scripts to automate that.  
A collection is just a text file.

---

<div class="post-metadata">

**Author:** ![JuLongZhiLu](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/julongzhilu/32/42720_2.png) [@JuLongZhiLu](https://forum.defold.com/u/JuLongZhiLu)\
**Post date:** [March 27, 2026, 11:28pm UTC](https://forum.defold.com/t/solution-to-the-lack-of-flexibility-in-collection-file-and-game-object-file/82590/7 "2026-03-27T23:28:15Z")

</div>

Thank you 😀
