Troubleshooting Unity

Common setup and troubleshooting issues with Unity iOS, Android (and derivatives like Amazon).

πŸ“˜

Troubleshooting Steps

Check this page first for common issues based on Unity Setup.

For Android and/or iOS Platform issues see:

Try the example project on our Github repository.

If stuck, contact support directly or email [email protected] for help. For faster assistance, please provide:

  • What version of Unity are you using?
  • What version of the OneSignal Unity SDK are you using?
  • Do your build settings use "Custom Main Gradle Template" or not?
    Can you provide a copy of your:
  • manifest.json (located in the Packages/ folder)
  • GchProjectSettings.xml (located in the ProjectSettings/ folder)
  • AndroidResolverDependencies.xml (located in the ProjectSettings/ folder)

Unity Version Upgrade

After upgrading the Unity Version on your project, Click Window -> OneSignal and rerun all steps.

Make sure that all other configuration settings from our setup guide are correct as well, since these can change with version upgrade.


iOS framework addition failed due to a CocoaPods installation failure

You may get an error like the following in Unity:

Text version of the screenshot above:

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.

pod install output:

Analyzing dependencies
[!] Unable to find host target(s) for UnityFramework, OneSignalNotificationServiceExtension. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)

To resolve open from the top menu Assets > External Dependency Manager > iOS Resolver > Settings. Ensure "Always add the main target to Podfile" is checked:


Android - Duplicate META-INF Files

1. From the Unity Editor, navigate to Edit > Project Settings > Player and click the Android settings tab.
2. Expand Publishing Settings and enable:

  • Custom Main Gradle Template
  • Custom Gradle Properties Template

3. Navigate to Assets > External Dependency Manager > Android Resolver > Force Resolve and resolve your Android dependencies.


Android - Library Missing Error

If you see a Google Play Services, Android Support, or AndroidX missing library error then the External Dependency Manager may have not have resolved dependencies.

1. Run Assets > External Dependency Manager > Android Resolver > Force Resolve from the menu bar.

2. Check the Unity log for errors and follow the External Dependency Manager error instructions.

πŸ‘

Done! Please check the other sections below if you still see an error. If the problem persists, send your console log, Unity version, and other plugins in your project to OneSignal. support.


iOS No XCWorkspace created

If building for iOS and an XCWorkspace is not being built or you are unable to run the EDM4U step of the SDK set up for our Unity package, please check the following steps have been done here.

If all steps appear to have been completed successfully, check to see if you have EDM4U listed in your Assets/ExternalDependencyManager directory. If you do not, please try to run through the steps again to determine if there is a step that has been skipped during the set up process.

iOS MESSAGE: "Your App would like to find and connect to devices on your local network."

Unity triggers this when it's in "Development" mode when doing a build. This will not show on "Production" unless you have another iOS Library that requires it. OneSignal does not require this.


Record Unity Packaging APK Error The Option 'Android.Enabler8' Is Deprecated and Should Not Be Used Anymore.

Solution: https://www.programmersought.com/article/50008714052/


UnityPlayerActivity

Some users reported crashes when notification is received and clicked using Unity 2019.3.5f1 and extended UnityPlayerActivity.

Adding this to your AndroidManifest.xml fixed the issue reported:

<meta-data android:name="unityplayer.UnityActivity" android:value="true" />

Android - Error calling Init

When calling init method we get the following error message:

"InvalidOperationException: Android platform is not supported by OneSignal"
at OneSignal.Init () [0x00000] in <00000000000000000000000000000000>:0

Check your app's lifecycle methods and where you are invoking OneSignal's initialization process. This is likely a concurrency issue and OneSignal is being initialized too early.