Avatar Creator for Android & iOS

Let users create avatars on their Android and iOS devices.

Users can create Ready Player Me avatars seamlessly in a WebView displayed within a Unity application.

Prerequisites

Ready Player Me SDK. You need the Ready Player Me SDK for Unity installed in your project to retrieve avatars. See the Quickstart guide for instructions.

Ready Player Me SDK Webview. See the Webview installation for instructions.

Deploying the app. In order to test your WebView app, you have to deploy it to a physical or virtual device. See the Unity documentation on how to do that.

  • Android development with Unity documentation.

  • iOS development with Unity documentation.

Our WebView package includes a custom BuildPostProcessor that automatically adds the following permissions during the build process.

- Camera access
- Microphone access
- Local storage access
- Photo Gallery access
- Hardware acceleration
- AllowBackup

To disable this just add the following define to your project via the player settings for Android and iOS build targets:

RPM_DISABLE_WEBVIEW_PERMISSIONS

Project setup (Android and iOS)

Creating a Scene with a WebView in your Unity project is the same for Android and iOS.

  1. Create or open your Unity project.

  2. Import the Ready Player Me SDK into your project, if you haven't done so already.

  3. Import the Webview sample from Package Manager under Ready Player Me WebView package.

    1. Open the Unity Package manager by going to Window/Package Manager

    2. Find and select the Ready Player Me WebView package

    3. On the right side of the window select or example the Samples section

    4. Find the WebView Sample and the click Import button

  4. Navigate to Assets > Samples > Ready Player Me WebView > VERSION_NUMBER > Webview

  5. Open the Webview Scene.

  6. In the Hierarchy, notice the WebView Canvas game object. It has a child object named WebView Panel with a WebViewPanel script component.

  7. If you select the WebViewPanel in the hierarchy you will see it is already preconfigured with a number of UnityEvents such as:

    • OnAvatarCreated(string)

      • This is the event you would use to retrieve the avatar URL after completing the avatar creation process inside the webview.

      • This is the avatar URL you will use to load an Avatar with the AvatarLoader API's our SDK's provide

    • OnUserSet(string)

      • this event can be used to retrieve the userID which can be useful if you need to make authorized requests to our API's

      • the userID can be stored and used to enable automatic re-login

    • OnUserAuthorized(string)

    • OnAssetUnlock(AssetRecord)

      • this is an event that is fired when the user clicks on a paid asset in the avatar creator

      • the main purpose of this is for developers to be able to implement their own payment system when it comes to purchasing Ready Player Me paid assets

  8. Open the Build Settings to set up deployment for your chosen platform.

Deploy on Android

  1. In Build Settings, set the Platform to Android.

  2. Check Development Build.

  3. Click Player Settings....

  4. Find Player > Other Settings > Identification. (Optional)

    • Check Override Default Package Name.

    • Set a unique Package Name in the format com.YourCompanyName.YourProductName.

  5. Close the Project Settings.

  6. On your device, turn on USB debugging in your Developer Options settings.

  7. Connect your device to your computer.

  8. Click Build and Run.

  9. Once the app opens on your device, click the button. Give permissions, and off you go.

Alternatively, you can build the APK and deploy it on your own.

For release builds, see the Unity and Android documentation.

Troubleshooting

Deploy on iOS

  1. In Build Settings, set the Platform to iOS.

  2. Select Debug and check Development build.

  3. Find Player > Other Settings > Identification.

    • Check Override Default Package Name.

    • Before you build your Project for iOS, make sure that you set the Bundle Identifier.

    • Set a Package Name in the format com.YourCompanyName.YourProductName.

    • Fill in the Signing Team ID (not required for Debug builds to complete).

    • You can also choose whether your app targets the simulator or an actual device. To do this, change the SDK version** >> Target SDK to Simulate SDK or Device SDK.

  4. Find Player > Other Settings > Under Configuration > Camera Usage Description and put some descriptive text in this mandatory field.

  5. Find Player > Other Settings > Under Configuration > Microphone Usage Description and put some descriptive text in this mandatory field.

  6. Close Project Settings.

  7. Click Build.

  8. In the file explorer, find your Builds folder and in it the Unity-iPhone.xcodeproj.

Publication follows the the standard procedure for publishing Unity projects to iOS.

Publishing for iOS is different from publishing for platforms such as Windows or macOS. Due to restrictions in access to development tools, Unity can only create an Xcode project for an iOS game or app and not build the binary directly.

See these resources:

Last updated