Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

DEBUG define symbol ?

Discussion in 'Editor & General Support' started by WryMim, Feb 23, 2021.

  1. WryMim

    WryMim

    Joined:
    Mar 16, 2019
    Posts:
    64
    Need help. The documentation does not say this.
    Do we need to use DEBUG define? Or is it out of date and will be deleted in the future?

    I have two important questions:
    1. When does DEBUG go to build and when does not?
    2. How do I enable/disable DEBUG in build?

    I have DEBUG always working in editor
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
  3. WryMim

    WryMim

    Joined:
    Mar 16, 2019
    Posts:
    64
    Yes, I read https://docs.unity3d.com/Manual/PlatformDependentCompilation.html but I am interested specifically in DEBUG.

    I want to separate piece of code that will ONLY be for debug build. Do I need to add my define type TEST to Player Settings - Define Symbols?
     
  4. WryMim

    WryMim

    Joined:
    Mar 16, 2019
    Posts:
    64
    For example, github, I want to put out a library there, it will have code that should ONLY work in debug builds (not in releases)
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    This is generally how it is done, yes. You would just need to tweak those settings before making either a DEBUG or non-DEBUG build accordingly. You can write editor scripts for easy reconfiguration.