Search Unity

Querying the 'Enable Exceptions' field in the Player Settings.

Discussion in 'Web' started by cjddmut, Aug 23, 2016.

  1. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    179
    I see that Unity suggests not leaving the exceptions on 'Full' for an actual build. This makes sense but is very useful while in development. I'm always worried about myself (or a teammate) forgetting to revert stuff before a release build. Is there a way I can query this field so I can watermark the build? It could be through UnityEngine, UnityEditor, or through some .js api I can call? (I guess I'd be ok with Internal namespace too for now)

    Thanks!
     

    Attached Files:

  2. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    179
    Well, unity decompilation to the rescue.

    The value can be queried from the generic Player Settings as shown below.

    Code (CSharp):
    1. int exceptionSupport = PlayerSettings.GetPropertyInt("exceptionSupport", BuildTargetGroup.WebGL);
    2.  
    3. // 0 - None
    4. // 1 - Explicit only
    5. // 2 - Full
    It uses the UnityEditor namespace so it can't be done during runtime but this solves my case.