Ready Player Me WebView is an extension to www.readyplayer.me avatar platform and is an optional part of the Ready Player Me Unity SDK, which helps you load and display avatars created on the website.
Please visit the online documentation and join our public Forums
community.
Ready Player me Webview module requires, that you have core package installed. Please refer to the Quick Start guide for instructions on how to install the Unity Core module.
The installation steps for the Webview module can be found here.
Users can create Ready Player Me avatars seamlessly in a WebView displayed within a Unity application.
Ready Player Me Core: You need the Unity Ready Player Me Core for Unity installed in your project to retrieve avatars. See the Quickstart guide 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.
Required permissions. The Ready Player Me WebView module requires the following permissions to enable all features:
- Camera access
- Microphone access
- Local storage access
- Photo Gallery access
- Hardware acceleration
- AllowBackup
We provide a script that will automatically add these permissions for Android called AndroidBuildProcessor.cs which is is enabled by default.
To disable this just add the following define to your project via the player settings for Android build target: RPM_DISABLE_WEBVIEW_PERMISSIONS
Creating a Scene with a WebView in your Unity project is the same for Android and iOS.
- Create or open your Unity project.
- Import the Ready Player Me Core package into your project, if you haven't done so already.
- Navigate to the Unity package manager by going to Window > Package Manager.
- Find the Ready Player Me WebView package under Packages - Ready Player Me.
- Find and import the WebView Sample by clicking the Import button.
- Now open the WebView example scene by finding it in the Projects tab under
Samples/Ready Player Me WebView/\[VERSION_NUMBER\]/WebView
. - In the Hierarchy tab, you will find a WebView Canvas object with a child object called WebView Panel, select the WebViewPanel.
- In the inspector you will find a WebViewPanel script with some adjustable settings.
- Screen padding: For adjusting the padding of the Panel UI.
- Url Config: By adjusting this you can control the behaviour of the RPM Avatar creator.
- On Avatar Created: This Event can be used to retrieve the avatar URL after finishing the avatar creation process.
- Open the Build Settings to set up deployment for your chosen platform.
- don't forget to add the scene to the build settings.
NOTE: The WebView example scene will not load an avatar into the unity scene, it will just return and display the avatar URL on the screen. To load an avatar in the screen you can create an avatar loader script make use of the OnAvatarCreated event on the WebViewPanel.
- In Build Settings, set the Platform to Android.
- Check Development Build.
- Click Player Settings....
- Find
Player > Other Settings > Identification
.- Check Override Default Package Name.
- Set a unique Package Name in the format com.YourCompanyName.YourProductName.
- Find
Player > Other Settings > Under Configuration > Camera Usage Description
and put some descriptive text in this mandatory field. - Find
Player > Other Settings > Under Configuration > Microphone Usage Description
and put some descriptive text in this mandatory field. - Close the Project Settings.
- On your device, turn on USB debugging in your Developer Options settings.
- Connect your device to your computer.
- Click Build and Run.
- 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.
- In Build Settings, set the Platform to iOS.
- Select Debug and check Development build.
- 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.
- Find
Player > Other Settings > Under Configuration > Camera Usage Description
and put some descriptive text in this mandatory field. - Find
Player > Other Settings > Under Configuration > Microphone Usage Description
and put some descriptive text in this mandatory field. - Close Project Settings.
- Click Build.
- In the file explorer, find your Builds folder and in it the
Unity-iPhone.xcodeproj
.
As of WebView 2.0 a number of changes have been made to isolate the WebView module from the rest of the Ready Player Me Unity SDK.
This means that the classes and logic required to work with an iFrame (AKA a WebView), that is running Web Avatar Creator have now been moved to the Ready Player Me Core module. This change enables developers to utilize API's for working with any iFrame, without requiring the installation of our WebView package.
As such the following classes are now located in the Ready Player Me Core module:
- WebViewMessageHelper
- UrlConfig
- WebMessage
- MessagePanel
- WebMessageHelper
- WebViewEvents
If you have any scripts in your Unity project that reference these classes you will need to update the namespace to use ReadyPlayerMe.Core instead of ReadyPlayerMe.WebView, be sure to update the import statements in these scripts.
EG: using ReadyPlayerMe.WebView;
should be changed to using ReadyPlayerMe.Core;