{"id":13731227,"url":"https://github.com/OneSignal/OneSignal-Unity-SDK","last_synced_at":"2025-05-08T04:32:19.119Z","repository":{"id":29975175,"uuid":"33522199","full_name":"OneSignal/OneSignal-Unity-SDK","owner":"OneSignal","description":"OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com","archived":false,"fork":false,"pushed_at":"2024-11-05T22:14:36.000Z","size":1093624,"stargazers_count":222,"open_issues_count":51,"forks_count":61,"subscribers_count":55,"default_branch":"main","last_synced_at":"2024-11-05T22:23:35.443Z","etag":null,"topics":["apns","c-sharp","gcm","notification-service","notifications","push-notifications","pushnotificaitions","sdk","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OneSignal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-07T04:33:17.000Z","updated_at":"2024-11-05T21:58:49.000Z","dependencies_parsed_at":"2024-03-08T23:23:34.305Z","dependency_job_id":"1e041935-e675-4193-9a08-a5bdb757d387","html_url":"https://github.com/OneSignal/OneSignal-Unity-SDK","commit_stats":{"total_commits":1203,"total_committers":26,"mean_commits":46.26923076923077,"dds":0.6866167913549459,"last_synced_commit":"454c42d95fa81cb74531d741f6d2f0d7ef3d6b2d"},"previous_names":[],"tags_count":127,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneSignal%2FOneSignal-Unity-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneSignal%2FOneSignal-Unity-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneSignal%2FOneSignal-Unity-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneSignal%2FOneSignal-Unity-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OneSignal","download_url":"https://codeload.github.com/OneSignal/OneSignal-Unity-SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224124862,"owners_count":17259746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apns","c-sharp","gcm","notification-service","notifications","push-notifications","pushnotificaitions","sdk","unity","unity3d"],"created_at":"2024-08-03T02:01:25.581Z","updated_at":"2025-05-08T04:32:19.100Z","avatar_url":"https://github.com/OneSignal.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://media.onesignal.com/cms/Website%20Layout/logo-red.svg\"/\u003e\n\u003c/p\u003e\n\n# OneSignal Unity SDK\n\n#### ⚠️ Migration Advisory for current OneSignal customers\n\nOur new [user-centric APIs and v5.x.x SDKs](https://onesignal.com/blog/unify-your-users-across-channels-and-devices/) offer an improved user and data management experience. However, they may not be at 1:1 feature parity with our previous versions yet.\n\nIf you are migrating an existing app, we suggest using iOS and Android’s Phased Rollout capabilities to ensure that there are no unexpected issues or edge cases. Here is the documentation for each:\n\n[iOS Phased Rollout](https://developer.apple.com/help/app-store-connect/update-your-app/release-a-version-update-in-phases/)\n\n[Google Play Staged Rollouts](https://support.google.com/googleplay/android-developer/answer/6346149?hl=en)\n\nIf you run into any challenges or have concerns, please contact our support team at support@onesignal.com \n\n---\n\nA free email, sms, push notification and in app messaging solution for mobile applications built through Unity.\n\n[OneSignal](https://onesignal.com) provides a fully array of omni-channel messaging solutions across:\n\n- Push Notifications (mobile \u0026 web)\n- In App Messages\n- SMS\n- Email\n\nAnd via many additional platforms. [Check them all out](https://documentation.onesignal.com/docs/sdk-reference)!\n\n#### Table of Contents\n- [Requirements](#requirements)\n- [Push Notification Credentials](#push-notification-credentials)\n- [Installation](#installation)\n    - [Unity Asset Store](#installation)\n    - [Unity Package Manager](#installation)\n- [Platform Configuration](#platform-configuration)\n    - [iOS](#ios)\n    - [Android](#android)\n- [Usage](#usage)\n    - [Initialization](#initialization)\n- [API](#api)\n- [Change Log](#change-log)\n- [Support](#support)\n\n## Requirements\n- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one\n- Your OneSignal App ID which you can find under **Settings \u003e Keys \u0026 IDs**\n- Unity 2021.3 or newer\n- Android Builds: Target API Level 33 or higher\n- iOS Builds: CocoaPods 1.11.3 or newer\n- In order to test push notifications you will need\n  - An Android 7 or newer device or emulator with \"Google Play Store (Services)\" installed\n  - An iOS 11 or newer device (iPhone, iPad, or iPod Touch)\n\n### Push Notification Credentials\nYou must generate the appropriate credentials for the platform(s) you are releasing on:\n\n- iOS - [Generate an iOS Push Certificate](https://documentation.onesignal.com/docs/generate-an-ios-push-certificate)\n- Android - [Generate a Google Firebase Server API Key](https://documentation.onesignal.com/docs/generate-a-google-server-api-key)\n- Amazon Fire - [Generate an Amazon API Key](https://documentation.onesignal.com/docs/generate-an-amazon-api-key)\n\n## Installation\nThere are two methods of installation available for the OneSignal Unity SDK:\n\u003e **Upgrading from 2.x.x to 3.x.x?**\u003c/br\u003e\n\u003e Please check out our [v2 to v3 migration guide](MIGRATION_GUIDE_v2_to_v3.md).\n\n\u003e **Upgrading from 3.x.x to 5.x.x?**\u003c/br\u003e\n\u003e Please check out our [v3 to v5 migration guide](MIGRATION_GUIDE_v3_to_v5.md).\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUnity Asset Store\u003c/b\u003e \u003ci\u003e(click to expand)\u003c/i\u003e\u003c/summary\u003e\n\n1. 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).\n2. 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.\n3. On the SDK's listing in the Editor click the **Download** button. When it finishes click **Import**.\n\n    ![onesignal unity sdk in my assets](Documentation/asset_listing.png)\n\n4. A prompt to import all of the files of the OneSignal Unity SDK will appear. Click **Import** to continue and compile the scripts into your project.\n5. Navigate to **Window \u003e OneSignal SDK Setup** (or follow the popup if upgrading) in the Unity Editor which will bring up a window with some final steps which need \n   to be completed in order to finalize the installation. The most important of these steps is **Import OneSignal packages**.\n   \n    \u003e *Depending on your project configuration and if you are upgrading from a previous version, some of these steps may already be marked as \"completed\"*\n   \n    ![sdk setup steps window](Documentation/setup_window.png)\n\n6. After importing the packages Unity will notify you that a new registry has been added and the **OneSignal SDK Setup** window will have refreshed with a few additional \n   steps. Following these will finalize your installation of the OneSignal Unity SDK.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUnity Package Manager\u003c/b\u003e \u003ci\u003e(click to expand)\u003c/i\u003e\u003c/summary\u003e\n\n1. From within the Unity Editor navigate to **Edit \u003e Project Settings** and then to the **Package Manager** settings tab.\n   \n    ![unity registry manager](Documentation/package_manager_tab.png)\n\n2. Create a *New Scoped Registry* by entering \n    ```\n    Name        npmjs\n    URL         https://registry.npmjs.org\n    Scope(s)    com.onesignal\n    ```\n   and click **Save**.\n3. Open the **Window \u003e Package Manager** and switch to **My Registries** via the **Packages:** dropdown menu. You will see all of the OneSignal Unity SDK packages available\n   on which you can then click **Install** for the platforms you would like to include. Dependencies will be added automatically.\n4. Once the packages have finished importing you will find a new menu under **Window \u003e OneSignal SDK Setup**. Open it and you will find some final steps which need to be completed\n   in order to finalize the installation.\n\n    \u003e *Depending on your project configuration and if you are upgrading from a previous version, some of these steps may already be marked as \"completed\"*\n\n    ![my registries menu selection](Documentation/registry_menu.png)\n\n\u003c/details\u003e\n\n## Platform Configuration\n### iOS\nAfter building in Unity and exporting the XCode project follow these steps:\n1. To open your project ensure that you use the `.xcworkspace` file and not the `.xcodeproj` to open the project.\n2. Click on the **Unity-iPhone** project and its similarly named target and select the **Signing \u0026 Capabilities** tab.\n3. From here check **Automatically manage signing**, on the prompt click **Enable Automatic**, and select your **Team**.\n\n    ![automatically manage signing](Documentation/ios_auto_sign.png)\n\n4. Scroll down to **App Groups** and click on the refresh button.\n    \u003e NOTE: You may have to press this a few times as it will ask you for each signing type.\n\n    ![refresh app groups](Documentation/ios_refresh_app_groups.png)\n\n5. Repeat the same steps above but for the **OneSignalNotificationServiceExtension** target this time.\n\n    ![extension signing and groups](Documentation/ios_extension_sign_and_groups.png)\n\n6. **App Groups** should now be provisioned for you going forward for your iOS bundle id, even on clean builds.\n\n7. Make sure all **Targets** have **Enable Bitcode** set to **No** in **Build Settings**.\n\n### Android\n1. From the Unity Editor, navigate to **Edit \u003e Project Settings \u003e Player** and click the **Android** settings tab.\n2. Expand **Publishing Settings** and enable:\n   - Custom Main Gradle Template\n   - Custom Gradle Properties Template\n3. Navigate to **Assets \u003e External Dependency Manager \u003e Android Resolver \u003e Force Resolve** and resolve your Android dependencies.\n\nMost of the Android setup was already handled during installation!\n\nThe only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res` \nwith your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.androidlib/README.md). See our \n[Customize Notification Icons](https://documentation.onesignal.com/docs/customize-notification-icons) page for additional details.\n\n## Usage\nYou can find a complete implementation in our included [example MonoBehaviour](OneSignalExample/Assets/OneSignal/Example/OneSignalExampleBehaviour.cs). Additionally we have included a\n[sample scene](OneSignalExample/Assets/OneSignal/Example/OneSignalExampleScene.unity) which you can run to test out the SDK.\n\n### Initialization\n#### Prefab\nLocated in the `com.onesignal.unity.core` package we've include a simple prefab which initializes OneSignal. You can easily find it using the Asset search bar\nto find `OneSignalController.prefab` and making sure to select **All** or **In Packages** for your search option. Drag the prefab into your very first scene, fill\nin the **App Id**, and you are immediately ready to go!\n\n#### Code\nTo get started add the following code in an appropriate place such as the `Start` method of a `MonoBehaviour` early in your application's lifecycle.\n```C#\n// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID from app.onesignal.com\nOneSignal.Initialize(\"YOUR_ONESIGNAL_APP_ID\");\n```\n\nYou are now ready to start sending and receiving notifications and in-app messages. For additional information please see [our complete OneSignal Unity SDK docs](https://documentation.onesignal.com/docs/unity-sdk-setup).\n\n## API\nSee OneSignal's [OneSignal SDK Reference](https://documentation.onesignal.com/docs/sdk-reference) page for a list of all available methods.\n\n## Change Log\nSee this repository's [releases](https://github.com/OneSignal/OneSignal-Unity-SDK/releases) for a complete change log of every released version.\n\n## Support\nPlease visit this repository's [Github issue tracker](https://github.com/OneSignal/OneSignal-Unity-SDK/issues) for feature requests and bug reports related specifically to the SDK.\n\nFor account issues and support please contact OneSignal support from the [OneSignal](https://onesignal.com) dashboard.\n\n## License\n[Modified MIT License](LICENSE)\n","funding_links":[],"categories":["C#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOneSignal%2FOneSignal-Unity-SDK","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOneSignal%2FOneSignal-Unity-SDK","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOneSignal%2FOneSignal-Unity-SDK/lists"}