# How to debug a specific collection/stage/game configuration?

**URL:** <https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230>\
**Category:** Questions\
**Created:** [December 22, 2024, 12:47pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230 "2024-12-22T12:47:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramoneur](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ramoneur/32/30878_2.png) [@ramoneur](https://forum.defold.com/u/ramoneur)\
**Post date:** [December 22, 2024, 12:47pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/1 "2024-12-22T12:47:26Z")

</div>

Hello folks,  
If I was to try making a pretty big game with Defold how would I proceed to launch debug not at the beginning of the game ? For example, to launch a specific level/stage, to launch with a specific inventory, or to launch after some specific random results.

Is it a better way than changing the main collection in project configuration ?

Thanks

---

<div class="post-metadata">

**Author:** ![iotaHum](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/i/977dab/32.png) [@iotaHum](https://forum.defold.com/u/iotaHum)\
**Post date:** [December 22, 2024, 3:13pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/2 "2024-12-22T15:13:46Z")

</div>

A way is to add some code like:

```lua
if some_thing then 
  print " break point line"
end

```

> **[Debugging in Defold](https://defold.com/manuals/debugging-game-logic/?q=debugger)**
>
> This manual explains the debugging facilities present in Defold.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [December 22, 2024, 3:41pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/3 "2024-12-22T15:41:57Z")

</div>

It solely depends on what you want to do.  
Such mechanics take multiple iterations until you have something you like.

- Setting the level collection as the bootstrap collection is one way.

- Having a debug button in a corner of the screen is another, allowing you to access a debug menu where you can send the appropriate messages (load level, assign health, deal damage, spawn enemies etc)

- Also, once could use the config system if you’re launching from command line, using the `--config=...` option to configure the game.

---

<div class="post-metadata">

**Author:** ![ramoneur](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ramoneur/32/30878_2.png) [@ramoneur](https://forum.defold.com/u/ramoneur)\
**Post date:** [December 22, 2024, 3:42pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/4 "2024-12-22T15:42:53Z")

</div>

sorry, I don’t see how this is supposed to answer my question  
I wonder how to _launch_ debugging in some gamestate, not how to pause it in some gamestate

---

<div class="post-metadata">

**Author:** ![iotaHum](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/i/977dab/32.png) [@iotaHum](https://forum.defold.com/u/iotaHum)\
**Post date:** [December 22, 2024, 3:55pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/5 "2024-12-22T15:55:16Z")

</div>

If you don’t want to launch the game with debugging and then stop on a break point you can attach to your running game instead; I have not done the latter, you have not been able to work this out from the manual, is it not helpful?

---

<div class="post-metadata">

**Author:** ![ramoneur](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ramoneur/32/30878_2.png) [@ramoneur](https://forum.defold.com/u/ramoneur)\
**Post date:** [December 22, 2024, 4:23pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/6 "2024-12-22T16:23:55Z")

</div>

Oh sorry I get why my post wasn’t clear :  
I meant “run the game in debugging mode with a specific game configuration”, for example if you code a Mario and you want to launch the game in the middle of some stage with a specific Mario transformation and a specific coins number.

---

<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:** [December 22, 2024, 9:27pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/7 "2024-12-22T21:27:36Z")

</div>

> [@ramoneur](#):
>
> I meant “run the game in debugging mode with a specific game configuration”, for example if you code a Mario and you want to launch the game in the middle of some stage with a specific Mario transformation and a specific coins number.

I think Mathias accurately answered your question. Adding a debug menu with “cheat” options is definitely a good solution. You can check if the game is running in debug mode using `sys.get_engine_info().is_debug`

> **[sys.get\_engine\_info() - API reference (System)](https://defold.com/ref/sys/#sys.get_engine_info:)**
>
> sys.get\_engine\_info() | Defold is a free and open game engine used for development of console, desktop, mobile and web games.

---

<div class="post-metadata">

**Author:** ![ramoneur](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ramoneur/32/30878_2.png) [@ramoneur](https://forum.defold.com/u/ramoneur)\
**Post date:** [December 22, 2024, 9:30pm UTC](https://forum.defold.com/t/how-to-debug-a-specific-collection-stage-game-configuration/79230/8 "2024-12-22T21:30:44Z")

</div>

Oh I haven’t seen the Mathias’ reply yes it’s accurate thank you
