Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ MonoBehaviour:
rid: 5612885467593965569
m_OverrideGlobalSceneList: 0
m_Scenes: []
m_ScriptingDefines: []
m_ScriptingDefines:
- UWB_WEBVIEW
m_PlayerSettingsYaml:
m_Settings:
- line: '| PlayerSettings:'
Expand Down
11 changes: 11 additions & 0 deletions sample-unity6/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"com.unity.ugui": "2.0.0",
"com.unity.uiextensions": "2.2.4",
"com.unity.visualscripting": "1.9.7",
"dev.voltstro.unitywebbrowser": "2.2.7",
"dev.voltstro.unitywebbrowser.engine.cef": "2.2.7",
"dev.voltstro.unitywebbrowser.engine.cef.win.x64": "2.2.7",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down Expand Up @@ -71,6 +74,14 @@
"scopes": [
"com.unity.uiextensions"
]
},
{
"name": "VoltUPR",
"url": "https://upr.voltstro.dev",
"scopes": [
"dev.voltstro",
"org.nuget"
]
}
]
}
3 changes: 2 additions & 1 deletion sample-unity6/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ PlayerSettings:
webGLWebAssemblyBigInt: 0
webGLCloseOnQuit: 0
webWasm2023: 0
scriptingDefineSymbols: {}
scriptingDefineSymbols:
Standalone: UWB_WEBVIEW
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend:
Expand Down
11 changes: 11 additions & 0 deletions sample/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"com.unity.textmeshpro": "3.0.9",
"com.unity.uiextensions": "2.2.4",
"com.unity.visualscripting": "1.9.1",
"dev.voltstro.unitywebbrowser": "2.2.7",
"dev.voltstro.unitywebbrowser.engine.cef": "2.2.7",
"dev.voltstro.unitywebbrowser.engine.cef.win.x64": "2.2.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down Expand Up @@ -68,6 +71,14 @@
"scopes": [
"com.unity.uiextensions"
]
},
{
"name": "VoltUPR",
"url": "https://upr.voltstro.dev",
"scopes": [
"dev.voltstro",
"org.nuget"
]
}
]
}
50 changes: 47 additions & 3 deletions sample/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"url": "https://package.openupm.com"
},
"com.cysharp.unitask": {
"version": "2.3.3",
"depth": 0,
"version": "2.5.10",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://package.openupm.com"
Expand Down Expand Up @@ -92,7 +92,7 @@
"url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "3.2.0",
"version": "3.2.1",
"depth": 1,
"source": "registry",
"dependencies": {},
Expand Down Expand Up @@ -161,6 +161,50 @@
},
"url": "https://packages.unity.com"
},
"dev.voltstro.nativearrayspanextensions": {
"version": "1.0.1",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://upr.voltstro.dev"
},
"dev.voltstro.unitywebbrowser": {
"version": "2.2.7",
"depth": 0,
"source": "registry",
"dependencies": {
"dev.voltstro.nativearrayspanextensions": "1.0.1",
"com.unity.nuget.newtonsoft-json": "3.2.1",
"com.cysharp.unitask": "2.5.10",
"org.nuget.voltrpc": "3.2.1"
},
"url": "https://upr.voltstro.dev"
},
"dev.voltstro.unitywebbrowser.engine.cef": {
"version": "2.2.7",
"depth": 0,
"source": "registry",
"dependencies": {
"dev.voltstro.unitywebbrowser": "2.2.7"
},
"url": "https://upr.voltstro.dev"
},
"dev.voltstro.unitywebbrowser.engine.cef.win.x64": {
"version": "2.2.7",
"depth": 0,
"source": "registry",
"dependencies": {
"dev.voltstro.unitywebbrowser.engine.cef": "2.2.7"
},
"url": "https://upr.voltstro.dev"
},
"org.nuget.voltrpc": {
"version": "3.2.1",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://upr.voltstro.dev"
},
"com.unity.modules.ai": {
"version": "1.0.0",
"depth": 0,
Expand Down
15 changes: 12 additions & 3 deletions sample/ProjectSettings/PackageManagerSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,20 @@ MonoBehaviour:
m_IsDefault: 0
m_Capabilities: 0
m_ConfigSource: 4
m_UserSelectedRegistryName: npmjs
- m_Id: scoped:project:VoltUPR
m_Name: VoltUPR
m_Url: https://upr.voltstro.dev
m_Scopes:
- dev.voltstro
- org.nuget
m_IsDefault: 0
m_Capabilities: 0
m_ConfigSource: 4
m_UserSelectedRegistryName: VoltUPR
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:
m_Modified: 0
m_ErrorMessage:
m_UserModificationsInstanceId: -842
m_OriginalInstanceId: -846
m_UserModificationsInstanceId: -828
m_OriginalInstanceId: -832
m_LoadAssets: 0
2 changes: 1 addition & 1 deletion sample/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ PlayerSettings:
webGLPowerPreference: 2
scriptingDefineSymbols:
Android: VUPLEX_STANDALONE
Standalone: VUPLEX_STANDALONE
Standalone: UWB_WEBVIEW;VUPLEX_STANDALONE
iPhone:
additionalCompilerArguments:
Standalone:
Expand Down
111 changes: 111 additions & 0 deletions src/Packages/Passport/Editor/UwbSymbolManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using UnityEngine;
using UnityEditor;
using System.Linq;

namespace Immutable.Passport.Editor
{
/// <summary>
/// Automatically manages UWB_WEBVIEW scripting define symbol
/// based on whether UnityWebBrowser is present in the project.
/// </summary>
[InitializeOnLoad]
public static class UwbSymbolManager
{
private const string UWB_SYMBOL = "UWB_WEBVIEW";

static UwbSymbolManager()
{
// Run on editor startup and after assembly reload
EditorApplication.delayCall += CheckAndUpdateUwbSymbol;
}

private static void CheckAndUpdateUwbSymbol()
{
try
{
// Check if UnityWebBrowser assembly exists
bool uwbExists = DoesUwbAssemblyExist();

// Get current build target group
var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;

// Get current scripting define symbols
var currentSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
var symbolList = currentSymbols.Split(';').Where(s => !string.IsNullOrEmpty(s)).ToList();

bool symbolExists = symbolList.Contains(UWB_SYMBOL);

// Update symbol if needed
if (uwbExists && !symbolExists)
{
// Add symbol
symbolList.Add(UWB_SYMBOL);
var newSymbols = string.Join(";", symbolList);
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, newSymbols);
Debug.Log($"[UwbSymbolManager] Added {UWB_SYMBOL} symbol - UnityWebBrowser detected");
}
else if (!uwbExists && symbolExists)
{
// Remove symbol
symbolList.Remove(UWB_SYMBOL);
var newSymbols = string.Join(";", symbolList);
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, newSymbols);
Debug.Log($"[UwbSymbolManager] Removed {UWB_SYMBOL} symbol - UnityWebBrowser not found");
}

// Log current status (only once per session to avoid spam)
if (!SessionState.GetBool("UwbSymbolManager.LoggedStatus", false))
{
if (uwbExists)
{
Debug.Log($"[UwbSymbolManager] UnityWebBrowser available, {UWB_SYMBOL} symbol active");
}
else
{
Debug.Log($"[UwbSymbolManager] UnityWebBrowser not found");
}

SessionState.SetBool("UwbSymbolManager.LoggedStatus", true);
}
}
catch (System.Exception ex)
{
Debug.LogError($"[UwbSymbolManager] Error managing UWB symbol: {ex.Message}");
}
}

private static bool DoesUwbAssemblyExist()
{
// Check for UnityWebBrowser in multiple ways

// Method 1: Check compiled assemblies by name
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
if (assemblies.Any(a => a.GetName().Name == "VoltstroStudios.UnityWebBrowser"))
{
return true;
}

// Method 2: Check for a well-known UWB type
var uwbType = System.Type.GetType("VoltstroStudios.UnityWebBrowser.Core.WebBrowserClient, VoltstroStudios.UnityWebBrowser");
if (uwbType != null)
{
return true;
}

// Method 3: Check for UWB assets in project (by name hint)
var uwbAssets = AssetDatabase.FindAssets("UnityWebBrowser t:ScriptableObject");
foreach (var guid in uwbAssets)
{
var path = AssetDatabase.GUIDToAssetPath(guid);
if (path.Contains("UnityWebBrowser"))
{
return true;
}
}

return false;
}
}
}


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "Immutable.Passport.Runtime.Private",
"rootNamespace": "Immutable.Passport",
"references": [
"VoltstroStudios.UnityWebBrowser",
"UniTask",
"Immutable.Browser.Core",
"Immutable.Browser.Gree",
Expand All @@ -22,8 +21,7 @@
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll",
"VoltstroStudios.UnityWebBrowser.Shared.dll"
"Newtonsoft.Json.dll"
],
"autoReferenced": true,
"defineConstraints": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ public interface IPassportWebView
void Dispose();
}

/// <summary>
/// Optional capability for WebViews that support updating their internal rendering resolution.
/// Used by PassportUI to keep the underlying WebView resolution in sync with the UI.
/// </summary>
public interface IResizablePassportWebView : IPassportWebView
{
/// <summary>
/// Update the internal resolution of the WebView.
/// </summary>
/// <param name="width">New width in pixels.</param>
/// <param name="height">New height in pixels.</param>
void UpdateInternalResolution(int width, int height);

/// <summary>
/// Apply any pending resolution updates (intended to be called from the main thread per frame).
/// </summary>
void UpdatePendingResolution();
}

/// <summary>
/// Configuration options for PassportUI WebView
/// </summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "Immutable.Passport.Runtime.Uwb",
"rootNamespace": "Immutable.Passport",
"references": [
"Immutable.Passport.Runtime.Private",
"Immutable.Browser.Core",
"Immutable.Passport.Core.Logging",
"UniTask",
"VoltstroStudios.UnityWebBrowser"
],
"includePlatforms": [
"Android",
"Editor",
"iOS",
"macOSStandalone",
"WindowsStandalone64",
"WebGL"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"VoltstroStudios.UnityWebBrowser.Shared.dll"
],
"autoReferenced": true,
"defineConstraints": [
"UWB_WEBVIEW"
],
"versionDefines": [],
"noEngineReferences": false
}


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading