Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v2.1.0 #28

Merged
merged 8 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ This release adds support for handling account linking and asset unlock events c

## Changelog

- fix for missing prefab reference [#18](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/18)
- README.md updated with new guides [#18](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/18)
- scripting define symbol `RPM_DISABLE_WEBVIEW_PERMISSIONS` can now be used to disable Android permissions override @harrisonhough in [#26](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/26)

2 changes: 1 addition & 1 deletion .github/workflows/pr-test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- playmode
- editmode
unityVersion:
- 2020.3.0f1
- 2020.3.16f1
steps:
- name: Checkout Unity-SDK Repository
uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ sysinfo.txt
# Crashlytics generated file
crashlytics-build.properties

# Samples meta files
**/Samples~.meta
**/Samples.meta
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.0] - 2024.04.01

### Added
- scripting define symbol `RPM_DISABLE_WEBVIEW_PERMISSIONS` can now be used to disable Android permissions override @harrisonhough in [#26](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/26)

## [2.0.0] - 2023.20.04

### Updated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#if UNITY_EDITOR
#if UNITY_EDITOR && !RPM_DISABLE_WEBVIEW_PERMISSIONS
using System.IO;
using System.Xml;
using UnityEditor;
using System.Text;
using UnityEditor.Android;
using UnityEditor.Callbacks;

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif

namespace ReadyPlayerMe.WebView
{
/// <summary>
/// Receives a callback after the Android Gradle project is generated,
/// and the callback is used for generating a manifest file with required permissions.
/// </summary>
public class WebViewBuildPostprocessor : IPostGenerateGradleAndroidProject
public class AndroidBuildProcessor : IPostGenerateGradleAndroidProject
{
public int callbackOrder => 1;

Expand Down Expand Up @@ -44,20 +40,6 @@ private string GetManifestPath(string basePath)
pathBuilder.Append(Path.DirectorySeparatorChar).Append("AndroidManifest.xml");
return pathBuilder.ToString();
}

[PostProcessBuild(100)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
#if UNITY_IOS
if (buildTarget == BuildTarget.iOS) {
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
proj.AddFrameworkToProject(proj.GetUnityFrameworkTargetGuid(), "WebKit.framework", false);
File.WriteAllText(projPath, proj.WriteToString());
}
#endif
}
}

/// <summary>
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ 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`

## Project setup (Android and iOS)

Creating a Scene with a WebView in your Unity project is the same for Android and iOS.
Expand Down
16 changes: 6 additions & 10 deletions Runtime/WebViewPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ public class WebViewPanel : MonoBehaviour

[SerializeField] private ScreenPadding screenPadding;

[SerializeField] private UrlConfig urlConfig;
public UrlConfig UrlConfig
{
get
{
urlConfig ??= new UrlConfig();
return urlConfig;
}
}
[SerializeField] private UrlConfig urlConfig = new UrlConfig();

[Space, SerializeField] public WebViewEvent OnAvatarCreated = new WebViewEvent();
[SerializeField] public WebViewEvent OnUserSet = new WebViewEvent();
Expand All @@ -36,6 +28,11 @@ public UrlConfig UrlConfig

public bool Loaded { get; private set; }

public UrlConfig GetUrlConfig()
{
return urlConfig;
}

/// <summary>
/// Create WebView object attached to this <see cref="GameObject"/>.
/// </summary>
Expand Down Expand Up @@ -70,7 +67,6 @@ private void InitializeAndShowWebView(string loginToken = "")

var options = new WebViewOptions();
webViewObject.Init(options);
urlConfig ??= new UrlConfig();
var url = urlConfig.BuildUrl(loginToken);
webViewObject.LoadURL(url);
webViewObject.IsVisible = true;
Expand Down
2 changes: 1 addition & 1 deletion Samples~/WebView/WebView.unity
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ MonoBehaviour:
clearCache: 0
quickStart: 0
gender: 0
bodyType: 0
bodyTypeOption: 0
OnAvatarCreated:
m_PersistentCalls:
m_Calls:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.readyplayerme.webview",
"version": "2.0.0",
"version": "2.1.0",
"displayName": "Ready Player Me WebView",
"description": "Ready Player Me WebView helps you display an in-engine browser that helps you load RPM website where you can create avatars and receive avatar URL at the end of the process.\nWebView is mobile only and works in Android and IOS builds.",
"category": "tool",
Expand Down
Loading