-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* UAT fixes * contributing * u6 support * extract playersettingscompat class * forgotten import
- Loading branch information
1 parent
97fad78
commit 5aa90b3
Showing
7 changed files
with
110 additions
and
44 deletions.
There are no files selected for viewing
53 changes: 28 additions & 25 deletions
53
Bugsnag/Assets/Bugsnag/Editor/BugsnagAddScriptingSymbol.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,41 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
[InitializeOnLoad] | ||
public class BugsnagAddScriptingSymbol : MonoBehaviour | ||
namespace BugsnagUnity.Editor | ||
{ | ||
private const string DEFINE_SYMBOL = "BUGSNAG_UNITY_WEB_REQUEST"; | ||
[InitializeOnLoad] | ||
public class BugsnagAddScriptingSymbol : MonoBehaviour | ||
{ | ||
private const string DEFINE_SYMBOL = "BUGSNAG_UNITY_WEB_REQUEST"; | ||
|
||
private static BuildTargetGroup[] _supportedPlatforms = { BuildTargetGroup.Android, BuildTargetGroup.Standalone, BuildTargetGroup.iOS, BuildTargetGroup.WebGL }; | ||
private static BuildTargetGroup[] _supportedPlatforms = { BuildTargetGroup.Android, BuildTargetGroup.Standalone, BuildTargetGroup.iOS, BuildTargetGroup.WebGL }; | ||
|
||
static BugsnagAddScriptingSymbol() | ||
{ | ||
foreach (var target in _supportedPlatforms) | ||
static BugsnagAddScriptingSymbol() | ||
{ | ||
try | ||
{ | ||
SetScriptingSymbol(target); | ||
} | ||
catch | ||
foreach (var target in _supportedPlatforms) | ||
{ | ||
// Some users might not have a platform installed, in that case ignore the error | ||
try | ||
{ | ||
SetScriptingSymbol(target); | ||
} | ||
catch | ||
{ | ||
// Some users might not have a platform installed, in that case ignore the error | ||
} | ||
} | ||
} | ||
} | ||
|
||
static void SetScriptingSymbol(BuildTargetGroup buildTargetGroup) | ||
{ | ||
var existingSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup); | ||
if (string.IsNullOrEmpty(existingSymbols)) | ||
static void SetScriptingSymbol(BuildTargetGroup buildTargetGroup) | ||
{ | ||
existingSymbols = DEFINE_SYMBOL; | ||
} | ||
else if (!existingSymbols.Contains(DEFINE_SYMBOL)) | ||
{ | ||
existingSymbols += ";" + DEFINE_SYMBOL; | ||
var existingSymbols = BugsnagPlayerSettingsCompat.GetScriptingDefineSymbols(buildTargetGroup); | ||
if (string.IsNullOrEmpty(existingSymbols)) | ||
{ | ||
existingSymbols = DEFINE_SYMBOL; | ||
} | ||
else if (!existingSymbols.Contains(DEFINE_SYMBOL)) | ||
{ | ||
existingSymbols += ";" + DEFINE_SYMBOL; | ||
} | ||
BugsnagPlayerSettingsCompat.SetScriptingDefineSymbols(buildTargetGroup, existingSymbols); | ||
} | ||
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, existingSymbols); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Bugsnag/Assets/Bugsnag/Editor/BugsnagPlayerSettingsCompat.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using UnityEditor; | ||
#if UNITY_6000_0_OR_NEWER | ||
using UnityEditor.Build; | ||
#endif | ||
namespace BugsnagUnity.Editor | ||
{ | ||
internal static class BugsnagPlayerSettingsCompat | ||
{ | ||
// Get Scripting Backend | ||
public static ScriptingImplementation GetScriptingBackend(BuildTargetGroup buildTargetGroup) | ||
{ | ||
#if UNITY_6000_0_OR_NEWER | ||
return PlayerSettings.GetScriptingBackend(NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup)); | ||
#else | ||
return PlayerSettings.GetScriptingBackend(buildTargetGroup); | ||
#endif | ||
} | ||
|
||
// Get Scripting Define Symbols | ||
public static string GetScriptingDefineSymbols(BuildTargetGroup buildTargetGroup) | ||
{ | ||
#if UNITY_6000_0_OR_NEWER | ||
return PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup)); | ||
#else | ||
return PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup); | ||
#endif | ||
} | ||
|
||
// Set Scripting Define Symbols | ||
public static void SetScriptingDefineSymbols(BuildTargetGroup buildTargetGroup, string defineSymbols) | ||
{ | ||
#if UNITY_6000_0_OR_NEWER | ||
PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup), defineSymbols); | ||
#else | ||
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, defineSymbols); | ||
#endif | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Bugsnag/Assets/Bugsnag/Editor/BugsnagPlayerSettingsCompat.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
using System.Reflection; | ||
[assembly: AssemblyVersion("8.3.0.0")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters