Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ASSET_STORE_PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This major-version cutover changes the package identifiers:
- `com.onesignal.unitysdk.ios`

Android and iOS depend on the exact same version of Core. All packages require
Unity 2022.3 or newer.
Unity 6 (6000.0.23f1) or newer.

## Release verification

Expand All @@ -21,7 +21,7 @@ Before uploading a release:
4. Run Unity package validation for every tarball.
5. Upload each tarball to the matching technical name in the existing
multi-package draft.
6. Install the draft product in clean Unity 2022.3 and current Unity 6
6. Install the draft product in clean Unity 6.0 LTS and current Unity 6
projects. Verify dependency resolution, valid signatures, and the absence
of duplicate assemblies or missing scripts.

Expand Down
39 changes: 39 additions & 0 deletions MIGRATION_GUIDE_v5_to_v6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Unity v6.0.0 Migration Guide

Version 6.0.0 drops CocoaPods on iOS. The CocoaPods trunk is read-only from December 2, 2026, so new OneSignal iOS SDK versions can no longer be published there. The SDK now adds OneSignal to the exported Xcode project as a Swift package, [OneSignal-XCFramework](https://github.com/OneSignal/OneSignal-XCFramework).

The packages are now published as `com.onesignal.unitysdk.core`, `com.onesignal.unitysdk.android` and `com.onesignal.unitysdk.ios`, and Android dependencies resolve through [Unity's External Dependency Manager](https://docs.unity3d.com/Packages/com.unity.external-dependency-manager@2.0/manual/get-started-with-edm.html). The runtime C# API is unchanged.

## Requirements

- Unity 6 (`6000.0.23f1`) or newer. The Swift package APIs the iOS package uses aren't available in Unity 2022.3.
- Xcode needs network access to GitHub to resolve the package, the same way CocoaPods needed access to its CDN.

## Upgrade steps

1. Update the OneSignal packages to 6.0.0.
2. Open the project in Unity. The SDK deletes `Assets/OneSignal/Editor/OneSignaliOSDependencies.xml`, the External Dependency Manager file that installed the `OneSignalXCFramework` pod. Don't recreate it, or the pods will duplicate the Swift package. If your project still contains Google's legacy EDM4U under `Assets/ExternalDependencyManager`, select **Use Unity's External Dependency Manager** when prompted.
3. Build iOS with **Replace**, not **Append**, the first time after upgrading, so the old Pods integration is removed from the Xcode project.
4. Open `Unity-iPhone.xcworkspace` if the build created one, otherwise `Unity-iPhone.xcodeproj`.

## Custom extension targets

If you added your own target that uses OneSignal, such as a Live Activities widget extension, remove its `OneSignalXCFramework` pod from your Podfile edits. Link the Swift package product from an `IPostprocessBuildWithReport` instead:

```csharp
using OneSignalSDK.iOS;

var project = new PBXProject();
project.ReadFromFile(projectPath);

var widgetGuid = project.TargetGuidByName("OneSignalWidgetExtension");
OneSignalSwiftPackage.AddProduct(project, widgetGuid, "OneSignalFramework");

project.WriteToFile(projectPath);
```

`AddProduct` adds the package reference when it's missing, pins it to the SDK's OneSignal iOS version, and does nothing if the target already links the product.

## Disabling location

The **Disable Location Module** setting and `ONESIGNAL_DISABLE_LOCATION` work as before. On iOS, the SDK now leaves the `OneSignalLocation` product out of the Xcode project. When you change the setting, build with **Replace** so a previously linked product isn't kept.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ And via many additional platforms. [Check them all out](https://documentation.on
## Requirements
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
- Unity 2022.3 or newer
- Unity 6 (6000.0.23f1) or newer
- Android Builds: Target API Level 33 or higher
- iOS Builds: CocoaPods 1.11.3 or newer
- iOS Builds: Xcode with network access to GitHub. The SDK adds OneSignal to the exported Xcode project as a Swift package, so CocoaPods is not required.
- In order to test push notifications you will need
- An Android 7 or newer device or emulator with "Google Play Store (Services)" installed
- An iOS 15 or newer device (iPhone, iPad, or iPod Touch)
Expand All @@ -71,6 +71,8 @@ You must generate the appropriate credentials for the platform(s) you are releas
> **Upgrading to 6.x.x?**</br>
> Version 6 uses [Unity's External Dependency Manager](https://docs.unity3d.com/Packages/com.unity.external-dependency-manager@2.0/manual/get-started-with-edm.html). If your project still contains Google's legacy EDM4U under `Assets/ExternalDependencyManager`, select **Use Unity's External Dependency Manager** when prompted. After confirming that your other plugins support Unity EDM, delete the legacy Assets installation so only one dependency manager remains.

> Version 6 also adds OneSignal to iOS builds as a Swift package instead of CocoaPods, and requires Unity 6. See the [v5 to v6 migration guide](MIGRATION_GUIDE_v5_to_v6.md).

1. Add the OneSignal Unity SDK as an available asset to your account by clicking **Add to My Assets** from [our listing on the Unity Asset Store](https://assetstore.unity.com/packages/add-ons/services/billing/onesignal-sdk-193316).
2. Find the package waiting for you to download by clicking **Open in Unity** from that same page. This will open the Unity Editor and its Package Manager window.
3. Install **OneSignal SDK Android** and/or **OneSignal SDK iOS** from the product. Unity installs **OneSignal SDK Core** automatically as a dependency.
Expand All @@ -81,7 +83,7 @@ No scoped npm registry is required.
## Platform Configuration
### iOS
After building in Unity and exporting the XCode project follow these steps:
1. To open your project ensure that you use the `.xcworkspace` file and not the `.xcodeproj` to open the project.
1. Open `Unity-iPhone.xcworkspace` if the build created one, otherwise `Unity-iPhone.xcodeproj`. External Dependency Manager runs `pod install` during the build, which creates the workspace. Xcode resolves the OneSignal Swift package the first time it opens the project.
2. Click on the **Unity-iPhone** project and its similarly named target and select the **Signing & Capabilities** tab.
3. From here check **Automatically manage signing**, on the prompt click **Enable Automatic**, and select your **Team**.

Expand Down Expand Up @@ -126,9 +128,9 @@ By default, the OneSignal Unity SDK includes OneSignal's native location module

When set, the environment variable takes precedence over the Editor toggle, so headless builds can opt out without changing project settings.

With the location module disabled, Android resolves OneSignal's native modules without the location artifact and iOS uses OneSignal pods without `OneSignalLocation`. `OneSignal.Location.RequestPermission()` and `OneSignal.Location.IsShared = ...` no-op on native builds without the location module, and `OneSignal.Location.IsShared` returns `false`.
With the location module disabled, Android resolves OneSignal's native modules without the location artifact and iOS links the OneSignal Swift package without the `OneSignalLocation` product. `OneSignal.Location.RequestPermission()` and `OneSignal.Location.IsShared = ...` no-op on native builds without the location module, and `OneSignal.Location.IsShared` returns `false`.

When toggling the flag, clear stale native outputs (the generated Xcode project, CocoaPods/Gradle caches, and prior `Build/` artifacts) so a previously linked location module isn't reused.
When toggling the flag, clear stale native outputs (the generated Xcode project, Gradle caches, and prior `Build/` artifacts) so a previously linked location module isn't reused.

## Usage
Follow the [Unity SDK setup guide](https://documentation.onesignal.com/docs/unity-sdk-setup) to initialize OneSignal. A complete development demo is available in [`examples/demo`](examples/demo).
Expand Down
24 changes: 6 additions & 18 deletions examples/demo-no-location/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ Have an iOS simulator booted, then run:
./run-ios.sh
```

Recent macOS ships `openrsync` as `/usr/bin/rsync`, which fails the CocoaPods "Copy XCFrameworks" build phase (`renameat: No such file or directory` on the OneSignal dSYM). Install a real rsync once and `run-ios.sh` will prefer it automatically:

```sh
brew install rsync
```

Useful options:

```sh
Expand All @@ -80,7 +74,7 @@ Useful options:

Set `UNITY_PATH` if you want to use a specific Unity executable.

The iOS script generates a minimal Podfile when External Dependency Manager does not create one, then runs `pod install` and builds the generated Xcode workspace.
The iOS script builds the generated Xcode project. Xcode resolves the OneSignal Swift package during the build.

## Clean Generated State

Expand All @@ -90,18 +84,17 @@ Use `clean.sh` when you want to retest setup from the Unity Editor or clear buil
./clean.sh
```

The script removes Unity-generated folders such as `Build/`, `Library/`, `Temp/`, `Obj/`, `Logs/`, and `UserSettings/`. It also removes the generated OneSignal dependency manifest XML files while preserving their `.meta` files so Unity GUIDs remain stable:
The script removes Unity-generated folders such as `Build/`, `Library/`, `Temp/`, `Obj/`, `Logs/`, and `UserSettings/`. It also removes the generated OneSignal Android dependency manifest while preserving its `.meta` file so the Unity GUID remains stable:

```text
Assets/OneSignal/Editor/OneSignalAndroidDependencies.xml
Assets/OneSignal/Editor/OneSignaliOSDependencies.xml
```

After running it, reopen the project in Unity. The OneSignal Editor setup code should regenerate those manifests from `ProjectSettings/OneSignalSettings.json`, where `disableLocation` is checked in as `true`. Confirm the regenerated files contain the granular no-location dependencies listed below.
After running it, reopen the project in Unity. The OneSignal Editor setup code should regenerate the manifest from `ProjectSettings/OneSignalSettings.json`, where `disableLocation` is checked in as `true`. Confirm the regenerated file contains the granular no-location dependencies listed below.

## Native Dependencies

The SDK generates Unity EDM manifests per project at `Assets/OneSignal/Editor/OneSignal{Android,iOS}Dependencies.xml` based on the location flag, so the granular (no-location) dependency set below is what Unity EDM resolves for this demo.
The SDK picks the native dependencies from the location flag. On Android it generates the Unity EDM manifest at `Assets/OneSignal/Editor/OneSignalAndroidDependencies.xml`. On iOS it links the OneSignal Swift package in the exported Xcode project.

### Android

Expand All @@ -117,14 +110,9 @@ If you force-resolve again, keep the location module disabled.

### iOS

When location is disabled, iOS uses OneSignal pods without `OneSignalLocation`:

```xml
<iosPod name="OneSignalXCFramework/OneSignal" version="5.5.3" addToAllTargets="true" />
<iosPod name="OneSignalXCFramework/OneSignalInAppMessages" version="5.5.3" addToAllTargets="true" />
```
When location is disabled, the app and `UnityFramework` targets link the `OneSignalFramework` and `OneSignalInAppMessages` products of the [OneSignal-XCFramework](https://github.com/OneSignal/OneSignal-XCFramework) Swift package, without `OneSignalLocation`.

The notification service extension still uses `OneSignalXCFramework/OneSignalExtension`.
The notification service extension still links `OneSignalExtension`.

## App Code

Expand Down
8 changes: 5 additions & 3 deletions examples/demo/Assets/OneSignal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ And via many additional platforms. [Check them all out](https://documentation.on
## Requirements
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
- Unity 2022.3 or newer
- Unity 6 (6000.0.23f1) or newer
- Android Builds: Target API Level 33 or higher
- iOS Builds: CocoaPods 1.11.3 or newer
- iOS Builds: Xcode with network access to GitHub. The SDK adds OneSignal to the exported Xcode project as a Swift package, so CocoaPods is not required.
- In order to test push notifications you will need
- An Android 7 or newer device or emulator with "Google Play Store (Services)" installed
- An iOS 15 or newer device (iPhone, iPad, or iPod Touch)
Expand All @@ -56,6 +56,8 @@ You must generate the appropriate credentials for the platform(s) you are releas
> **Upgrading to 6.x.x?**</br>
> Version 6 uses [Unity's External Dependency Manager](https://docs.unity3d.com/Packages/com.unity.external-dependency-manager@2.0/manual/get-started-with-edm.html). If your project still contains Google's legacy EDM4U under `Assets/ExternalDependencyManager`, select **Use Unity's External Dependency Manager** when prompted. After confirming that your other plugins support Unity EDM, delete the legacy Assets installation so only one dependency manager remains.

> Version 6 also adds OneSignal to iOS builds as a Swift package instead of CocoaPods, and requires Unity 6. See the [v5 to v6 migration guide](https://github.com/OneSignal/OneSignal-Unity-SDK/blob/main/MIGRATION_GUIDE_v5_to_v6.md).

1. Add the OneSignal Unity SDK as an available asset to your account by clicking **Add to My Assets** from [our listing on the Unity Asset Store](https://assetstore.unity.com/packages/add-ons/services/billing/onesignal-sdk-193316).
2. Find the package waiting for you to download by clicking **Open in Unity** from that same page. This will open the Unity Editor and its Package Manager window.
3. Install **OneSignal SDK Android** and/or **OneSignal SDK iOS** from the product. Unity installs **OneSignal SDK Core** automatically as a dependency.
Expand All @@ -66,7 +68,7 @@ No scoped npm registry is required.
## Platform Configuration
### iOS
After building in Unity and exporting the XCode project follow these steps:
1. To open your project ensure that you use the `.xcworkspace` file and not the `.xcodeproj` to open the project.
1. Open `Unity-iPhone.xcworkspace` if the build created one, otherwise `Unity-iPhone.xcodeproj`. External Dependency Manager runs `pod install` during the build, which creates the workspace. Xcode resolves the OneSignal Swift package the first time it opens the project.
2. Click on the **Unity-iPhone** project and its similarly named target and select the **Signing & Capabilities** tab.
3. From here check **Automatically manage signing**, on the prompt click **Enable Automatic**, and select your **Team**.

Expand Down
15 changes: 7 additions & 8 deletions examples/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ The demo uses the bundle ID `com.onesignal.example` on Android and iOS, with App

## Prerequisites

- [Unity Hub](https://unity.com/download) with Unity `6000.4.11f1` (see `ProjectSettings/ProjectVersion.txt`). The project also opens in Unity 2022.3.
- [Unity Hub](https://unity.com/download) with Unity `6000.4.11f1` (see `ProjectSettings/ProjectVersion.txt`). The OneSignal packages require Unity 6.
- Android Build Support and iOS Build Support modules
- For Android: an Android SDK with `adb` and a running emulator
- For iOS: macOS, Xcode, CocoaPods, and Rosetta 2 on Apple Silicon (`softwareupdate --install-rosetta --agree-to-license`)
- For iOS: macOS, Xcode, and Rosetta 2 on Apple Silicon (`softwareupdate --install-rosetta --agree-to-license`)

## Setup

Expand Down Expand Up @@ -56,13 +56,13 @@ The scripts build without opening the Editor:
```

- `run-android.sh` builds an ARM64 IL2CPP APK to `Build/Android/` and installs and launches it on a running emulator, prompting if several are running. Physical devices aren't supported.
- `run-ios.sh` generates a simulator Xcode project in `Build/iOS/`, runs `pod install`, builds with `xcodebuild`, and installs and launches it on a booted simulator. If none is booted, it boots the newest available iPhone.
- `run-ios.sh` generates a simulator Xcode project in `Build/iOS/`, builds it with `xcodebuild` (which resolves the OneSignal Swift package), and installs and launches it on a booted simulator. If none is booted, it boots the newest available iPhone.

Options:

- `--no-install`: build only
- `--install-only`: install the existing build without rebuilding
- `--open` (iOS only): open the existing `Build/iOS/Unity-iPhone.xcworkspace` without building
- `--open` (iOS only): open the existing `Build/iOS` workspace, or the Xcode project if there's no workspace, without building

The scripts use the newest Unity version installed under `/Applications/Unity/Hub/Editor`. Set `UNITY_PATH` to the Unity binary to use a different one, and `ADB` or `ANDROID_HOME` if `adb` isn't found. Build logs are written to `Build/build-android.log` and `Build/build-ios.log`.

Expand Down Expand Up @@ -109,18 +109,17 @@ Use `clean.sh` to retest setup from the Editor or to clear build artifacts befor
./clean.sh
```

It removes Unity-generated folders such as `Build/`, `Library/`, `Temp/`, `Obj/`, `Logs/`, and `UserSettings/`. It also removes the generated OneSignal dependency manifests while keeping their `.meta` files so Unity GUIDs stay stable:
It removes Unity-generated folders such as `Build/`, `Library/`, `Temp/`, `Obj/`, `Logs/`, and `UserSettings/`. It also removes the generated OneSignal Android dependency manifest while keeping its `.meta` file so the Unity GUID stays stable:

```text
Assets/OneSignal/Editor/OneSignalAndroidDependencies.xml
Assets/OneSignal/Editor/OneSignaliOSDependencies.xml
```

Reopen the project in Unity afterwards. The OneSignal Editor setup regenerates those manifests for the default location-enabled dependency set.
Reopen the project in Unity afterwards. The OneSignal Editor setup regenerates the manifest for the default location-enabled dependency set.

## Unity versions

The demo opens in Unity 2022.3 or Unity 6. The E2E workflow enables Unity 6's Accessibility module only for its automated builds, because that module isn't available in Unity 2022.3.
The demo requires Unity 6, because the OneSignal packages do. The iOS package adds OneSignal through Unity 6's Swift package APIs. The E2E workflow enables Unity's Accessibility module only for its automated builds.

## Publishing to the Asset Store

Expand Down