Skip to content

Commit

Permalink
[SDK-697] Feature/remove permission override (#26)
Browse files Browse the repository at this point in the history
- added optional define symbol to disable automatic permissions add to build postprocessor
  • Loading branch information
HarrisonHough authored Jan 3, 2024
1 parent ead0b7c commit eafcd1b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Editor/WebViewBuildPostprocessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UNITY_EDITOR
#if UNITY_EDITOR && !RPM_DISABLE_WEBVIEW_PERMISSIONS
using System.IO;
using System.Xml;
using UnityEditor;
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 called WebViewBuildPostprocessor.cs which is is enabled by default.
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.
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

0 comments on commit eafcd1b

Please sign in to comment.