Unity plugin installation and configuration

Follow these instructions to install the New Relic Unity plugin. The plugin includes Android and iOS agent files which embed appropriately for your build. To instrument interactions and network requests, you must use the Unity API to manually instrument your code.

Install the Unity plugin

As part of the installation process, New Relic Mobile automatically generates an application token. This is a 40-character hexadecimal string for authenticating each mobile project you monitor in New Relic Mobile.

For Admins with existing New Relic accounts, follow these steps to install and configure your Unity application. (If you do not have a New Relic account, see New Relic Mobile.)

  1. Go to rpm.newrelic.com/mobile.
  2. From the Mobile Apps list, select Add a new app.
  3. From the Get Started page, select Unity as the platform for mobile monitoring.
  4. Type a name for your mobile project, and select Continue.

Configure the Unity plugin

These procedures to configure your app also appear on the Get Started page in the New Relic UI.

  1. Install NewRelic-Unity-Plugin.unitypackage into your project by going to Assets > Import Package > Custom Package... and selecting NewRelic-Unity-Plugin.unitypackage.
  2. Create a new GameObject in your project's initial scene by going to GameObject > Create Empty and name it NewRelicAgent.
  3. Add NewRelicAgent.cs script (located in Assets/Plugins) to the NewRelicAgent GameObject by dragging it on top of NewRelicAgent in the Hierarchy tab. You can also click the Add Component button, and select New Relic Agent from the Scripts option.
  4. In the Inspector tab, set the iOS and Android Application Token from your New Relic Mobile apps. (New Relic recommends separate New Relic Mobile apps for separate platforms.)
  5. Build for your platform (iOS or Android) and open the resulting project (Xcode or Eclipse). You must import the generated Eclipse project into Android Studio.
    • Android only. Ensure that your app requests the INTERNET permission through the Player Settings inspector window. In Other Settings, Configuration, ensure Internet Access drop down is set to Required. This will result in the following permission added to the app's manifest: <uses-permission android:name="android.permission.INTERNET" />

  6. Run your app in an emulator or device to generate data.

  7. Check New Relic Mobile to ensure the data is reporting to your account.

Configure crash reporting

The New Relic Unity plugin cannot automatically upload dSYMs for iOS Crash Reporting. You will need to manually upload dSYMs once your iOS unity app is built for release. If the application is bitcode enabled, follow the instructions for bitcode enabled apps once the your iOS app is submitted to Apple.

If you are building an Android App with Proguard enabled, you must follow similar steps. The Proguard mapping needs to be uploaded to New Relic so crash reports can be de-obfuscated. For detailed information, see Android Agent Crash Reporting.

Changing the logging level (optional)

New Relic recommends setting the logging level from the Unity Inspector tab.

Six log levels are available for mobile apps monitoring:

  • NONE
  • ERROR
  • WARNING
  • INFO
  • VERBOSE
  • DEBUG

For more help

Additional documentation resources include:

Recommendations for learning more: