Skip to content

Commit 6af37f6

Browse files
committed
Update Unity SDK to 3.0.0 and native integrations
1 parent 31d3d86 commit 6af37f6

8 files changed

Lines changed: 97 additions & 7 deletions

File tree

Editor/IOSProjectBuildCustomizer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuil
2222
string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();
2323

2424
// Get the remote package GUID
25-
string packageGuid = pbxProject.AddRemotePackageReferenceAtVersionUpToNextMajor("https://github.com/bugfender/BugfenderSDK-iOS", "2.0.0");
25+
string packageGuid = pbxProject.AddRemotePackageReferenceAtVersionUpToNextMajor("https://github.com/bugfender/BugfenderSDK-iOS", "2.2.0");
2626

2727
// Add the Remote Package to the Xcode project (both Unity framework and main target)
2828
pbxProject.AddRemotePackageFrameworkToProject(pbxProject.GetUnityFrameworkTargetGuid(), "BugfenderLibrary", packageGuid, false /* required dependency */);
@@ -36,4 +36,4 @@ public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuil
3636
// Apply changes to the pbxproj file
3737
pbxProject.WriteToFile(projectPath);
3838
}
39-
}
39+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ By default, the latest compatible versions are used. If you would like to tweak
3333

3434
## Example project
3535
Check out this project to see Bugfender in action: https://github.com/bugfender/unity-demo
36+
37+
## Testing
38+
See `TESTING.md` for a manual validation checklist for Unity import, Android builds, iOS builds, and runtime verification.

Runtime/Bugfender.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using UnityEngine.Diagnostics;
44

55
public class Bugfender : MonoBehaviour {
6+
private const string SDK_TYPE = "unity";
7+
private const int SDK_TYPE_VERSION = 30000;
68

79
public string APP_KEY;
810
public bool ENABLE_UI_EVENT_LOGGING = false;
@@ -18,6 +20,9 @@ public enum LogLevel { Debug, Warning, Error, Trace, Info, Fatal };
1820
#if UNITY_ANDROID && !UNITY_EDITOR
1921
private static AndroidJavaClass bugfender;
2022
#elif UNITY_IOS && !UNITY_EDITOR
23+
[DllImport ("__Internal")]
24+
private static extern void BugfenderSetSDKType(string sdkType, int version);
25+
2126
[DllImport ("__Internal")]
2227
private static extern void BugfenderActivateLogger(string key, bool printToConsole, bool hideDeviceName, string apiURL, string baseURL);
2328

@@ -72,6 +77,11 @@ void Start()
7277

7378
bugfender = new AndroidJavaClass ("com.bugfender.sdk.Bugfender");
7479
if (bugfender != null) {
80+
try {
81+
bugfender.CallStatic ("setSDKType", SDK_TYPE, SDK_TYPE_VERSION);
82+
} catch (AndroidJavaException) {
83+
Debug.LogWarning("[BF] Bugfender.setSDKType is not available in the Android SDK.");
84+
}
7585
if(HIDE_DEVICE_NAME) {
7686
bugfender.CallStatic ("overrideDeviceName", "Unknown");
7787
}
@@ -95,6 +105,7 @@ void Start()
95105
}
96106
}
97107
#elif UNITY_IOS && !UNITY_EDITOR
108+
BugfenderSetSDKType(SDK_TYPE, SDK_TYPE_VERSION);
98109
BugfenderActivateLogger(APP_KEY, PRINT_TO_CONSOLE, HIDE_DEVICE_NAME, API_URL, BASE_URL);
99110
if(ENABLE_UI_EVENT_LOGGING) {
100111
BugfenderEnableUIEventLogging();
@@ -273,4 +284,4 @@ public static void ForceSendOnce()
273284
#endif
274285
}
275286

276-
}
287+
}

Runtime/Plugins/Android/Bugfender.androidlib.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Plugins/Android/Bugfender.androidlib/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ android {
1010
}
1111

1212
dependencies {
13-
implementation 'com.bugfender.sdk:android:3.+'
13+
implementation 'com.bugfender.sdk:android:3.6.2'
1414
}

Runtime/Plugins/iOS/BugfenderBridge.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
}
2424

2525
extern "C" {
26+
void BugfenderSetSDKType(const char* sdkType, int version) {
27+
SEL selector = NSSelectorFromString(@"setSDKType:version:");
28+
if ([Bugfender respondsToSelector:selector]) {
29+
typedef void (*SetSDKTypeMethod)(id, SEL, NSString*, int);
30+
SetSDKTypeMethod method = (SetSDKTypeMethod)[Bugfender methodForSelector:selector];
31+
method(Bugfender, selector, convertCStringToNSString(sdkType), version);
32+
}
33+
}
34+
2635
void BugfenderActivateLogger(const char* key, bool printToConsole, bool hideDeviceName, const char* apiURL, const char* baseURL) {
2736
NSString* apiURLString = convertCStringToNSString(apiURL);
2837
if(apiURLString.length > 0) {

TESTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Testing Bugfender SDK for Unity
2+
3+
This document describes the manual validation flow for the Unity SDK package.
4+
5+
## Test project
6+
7+
Use the sample project at:
8+
9+
`/home/aleix/Projects/bugfender/unity-demo`
10+
11+
To test local package changes, the sample project's package manifest should point to:
12+
13+
`file:../../BugfenderSDK-Unity`
14+
15+
## Unity version
16+
17+
Validate with Unity `6000.3.10f` or the target Unity 6 version under support.
18+
19+
## Import checks
20+
21+
1. Open `/home/aleix/Projects/bugfender/unity-demo` in Unity.
22+
2. Wait for Package Manager and asset import to finish.
23+
3. Confirm the Bugfender package resolves from the local file path.
24+
4. Confirm there are no C# compilation errors.
25+
5. Confirm there are no Android plugin import errors for `Bugfender.androidlib`.
26+
6. Confirm there are no iOS plugin compilation issues for `BugfenderBridge.mm`.
27+
28+
## Android build checks
29+
30+
1. Switch the active platform to Android.
31+
2. Build the sample project.
32+
3. If the build fails, capture the first Gradle error block.
33+
34+
Expected result:
35+
36+
- No `Could not find com.bugfender.sdk:android` errors.
37+
- No `ClassNotFoundException` or `cannot find symbol` errors for `com.bugfender.sdk.Bugfender`.
38+
- No missing module or `Project with path` errors involving `Bugfender.androidlib`.
39+
40+
## iOS build checks
41+
42+
1. Switch the active platform to iOS.
43+
2. Build the Xcode project from Unity.
44+
3. Open the generated Xcode project and build it.
45+
46+
Expected result:
47+
48+
- Swift Package Manager resolves `BugfenderSDK-iOS`.
49+
- No compile or link errors for `Bugfender`.
50+
- No selector or symbol errors related to `setSDKType:version:`.
51+
52+
## Runtime checks
53+
54+
1. Set a valid Bugfender app key in the sample scene.
55+
2. Run the app on a device or simulator.
56+
3. Confirm startup completes without crashing.
57+
4. Confirm Bugfender initializes successfully.
58+
5. Send a test log and verify it appears in Bugfender.
59+
60+
## What to capture on failure
61+
62+
When reporting a failure, include:
63+
64+
- Unity version
65+
- Target platform
66+
- Whether the failure happens during import, build, or runtime
67+
- The first relevant error block from Unity Console, Gradle, or Xcode

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.bugfender.unity",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"displayName": "Bugfender",
55
"description": "Unity bindings for the native Bugfender iOS and Android SDKs",
66
"unity": "2022.3",

0 commit comments

Comments
 (0)