|
1 | | -using UnityEngine; |
| 1 | +using UnityEngine; |
2 | 2 | using System.Runtime.InteropServices; |
3 | 3 | using UnityEngine.Diagnostics; |
4 | 4 |
|
@@ -69,6 +69,18 @@ public enum LogLevel { Debug, Warning, Error, Trace, Info, Fatal }; |
69 | 69 | // Automatically called when scene starts |
70 | 70 | void Start() |
71 | 71 | { |
| 72 | + // Optional override from Resources/bugfender_app_key.txt (e.g. for CI or per-build config) |
| 73 | + var keyAsset = Resources.Load<TextAsset>("bugfender_app_key"); |
| 74 | + if (keyAsset != null && !string.IsNullOrWhiteSpace(keyAsset.text)) |
| 75 | + { |
| 76 | + APP_KEY = keyAsset.text.Trim(); |
| 77 | + } |
| 78 | + // Optional: set Resources/bugfender_print_to_console.txt to "true" to mirror logs to logcat (Android) / Xcode console (iOS) |
| 79 | + var printAsset = Resources.Load<TextAsset>("bugfender_print_to_console"); |
| 80 | + if (printAsset != null && string.Equals(printAsset.text.Trim(), "true", System.StringComparison.OrdinalIgnoreCase)) |
| 81 | + { |
| 82 | + PRINT_TO_CONSOLE = true; |
| 83 | + } |
72 | 84 | Debug.Log("[BF] *** INITIALIZING BUGFENDER ***"); |
73 | 85 | #if UNITY_ANDROID && !UNITY_EDITOR |
74 | 86 | if (bugfender == null) { |
@@ -99,6 +111,11 @@ void Start() |
99 | 111 | if (ENABLE_CRASH_REPORTING) { |
100 | 112 | bugfender.CallStatic ("enableCrashReporting"); |
101 | 113 | } |
| 114 | + // Optional: set Resources/bugfender_debug.txt to "true" to enable native SDK debug logs (tag BF/DEBUG in logcat) |
| 115 | + var debugAsset = Resources.Load<TextAsset>("bugfender_debug"); |
| 116 | + if (debugAsset != null && string.Equals(debugAsset.text.Trim(), "true", System.StringComparison.OrdinalIgnoreCase)) { |
| 117 | + try { bugfender.CallStatic("setDebugMode", true); } catch (AndroidJavaException) { /* ignore if not available */ } |
| 118 | + } |
102 | 119 | //bugfender.CallStatic ("enableLogcatLogging"); // optional, uncomment if you want it (Android only) |
103 | 120 | } |
104 | 121 |
|
|
0 commit comments