Skip to content

Commit 25010f9

Browse files
chore: remove forked unity web broswer and make it optional
1 parent d39a895 commit 25010f9

File tree

363 files changed

+1224
-15527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+1224
-15527
lines changed

sample/Packages/manifest.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"com.unity.textmeshpro": "3.0.9",
1616
"com.unity.uiextensions": "2.2.4",
1717
"com.unity.visualscripting": "1.9.1",
18+
"dev.voltstro.unitywebbrowser": "2.2.7",
19+
"dev.voltstro.unitywebbrowser.engine.cef": "2.2.7",
20+
"dev.voltstro.unitywebbrowser.engine.cef.win.x64": "2.2.7",
1821
"com.unity.modules.ai": "1.0.0",
1922
"com.unity.modules.androidjni": "1.0.0",
2023
"com.unity.modules.animation": "1.0.0",
@@ -68,6 +71,14 @@
6871
"scopes": [
6972
"com.unity.uiextensions"
7073
]
74+
},
75+
{
76+
"name": "VoltUPR",
77+
"url": "https://upr.voltstro.dev",
78+
"scopes": [
79+
"dev.voltstro",
80+
"org.nuget"
81+
]
7182
}
7283
]
7384
}

sample/Packages/packages-lock.json

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"url": "https://package.openupm.com"
1313
},
1414
"com.cysharp.unitask": {
15-
"version": "2.3.3",
16-
"depth": 0,
15+
"version": "2.5.10",
16+
"depth": 1,
1717
"source": "registry",
1818
"dependencies": {},
1919
"url": "https://package.openupm.com"
@@ -92,7 +92,7 @@
9292
"url": "https://packages.unity.com"
9393
},
9494
"com.unity.nuget.newtonsoft-json": {
95-
"version": "3.2.0",
95+
"version": "3.2.1",
9696
"depth": 1,
9797
"source": "registry",
9898
"dependencies": {},
@@ -161,6 +161,50 @@
161161
},
162162
"url": "https://packages.unity.com"
163163
},
164+
"dev.voltstro.nativearrayspanextensions": {
165+
"version": "1.0.1",
166+
"depth": 1,
167+
"source": "registry",
168+
"dependencies": {},
169+
"url": "https://upr.voltstro.dev"
170+
},
171+
"dev.voltstro.unitywebbrowser": {
172+
"version": "2.2.7",
173+
"depth": 0,
174+
"source": "registry",
175+
"dependencies": {
176+
"dev.voltstro.nativearrayspanextensions": "1.0.1",
177+
"com.unity.nuget.newtonsoft-json": "3.2.1",
178+
"com.cysharp.unitask": "2.5.10",
179+
"org.nuget.voltrpc": "3.2.1"
180+
},
181+
"url": "https://upr.voltstro.dev"
182+
},
183+
"dev.voltstro.unitywebbrowser.engine.cef": {
184+
"version": "2.2.7",
185+
"depth": 0,
186+
"source": "registry",
187+
"dependencies": {
188+
"dev.voltstro.unitywebbrowser": "2.2.7"
189+
},
190+
"url": "https://upr.voltstro.dev"
191+
},
192+
"dev.voltstro.unitywebbrowser.engine.cef.win.x64": {
193+
"version": "2.2.7",
194+
"depth": 0,
195+
"source": "registry",
196+
"dependencies": {
197+
"dev.voltstro.unitywebbrowser.engine.cef": "2.2.7"
198+
},
199+
"url": "https://upr.voltstro.dev"
200+
},
201+
"org.nuget.voltrpc": {
202+
"version": "3.2.1",
203+
"depth": 1,
204+
"source": "registry",
205+
"dependencies": {},
206+
"url": "https://upr.voltstro.dev"
207+
},
164208
"com.unity.modules.ai": {
165209
"version": "1.0.0",
166210
"depth": 0,

sample/ProjectSettings/PackageManagerSettings.asset

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,20 @@ MonoBehaviour:
5050
m_IsDefault: 0
5151
m_Capabilities: 0
5252
m_ConfigSource: 4
53-
m_UserSelectedRegistryName: npmjs
53+
- m_Id: scoped:project:VoltUPR
54+
m_Name: VoltUPR
55+
m_Url: https://upr.voltstro.dev
56+
m_Scopes:
57+
- dev.voltstro
58+
- org.nuget
59+
m_IsDefault: 0
60+
m_Capabilities: 0
61+
m_ConfigSource: 4
62+
m_UserSelectedRegistryName: VoltUPR
5463
m_UserAddingNewScopedRegistry: 0
5564
m_RegistryInfoDraft:
5665
m_Modified: 0
5766
m_ErrorMessage:
58-
m_UserModificationsInstanceId: -842
59-
m_OriginalInstanceId: -846
67+
m_UserModificationsInstanceId: -828
68+
m_OriginalInstanceId: -832
6069
m_LoadAssets: 0
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
using UnityEngine;
2+
using UnityEditor;
3+
using System.Linq;
4+
5+
namespace Immutable.Passport.Editor
6+
{
7+
/// <summary>
8+
/// Automatically manages UWB_WEBVIEW scripting define symbol
9+
/// based on whether UnityWebBrowser is present in the project.
10+
/// </summary>
11+
[InitializeOnLoad]
12+
public static class UwbSymbolManager
13+
{
14+
private const string UWB_SYMBOL = "UWB_WEBVIEW";
15+
16+
static UwbSymbolManager()
17+
{
18+
// Run on editor startup and after assembly reload
19+
EditorApplication.delayCall += CheckAndUpdateUwbSymbol;
20+
}
21+
22+
private static void CheckAndUpdateUwbSymbol()
23+
{
24+
try
25+
{
26+
// Check if UnityWebBrowser assembly exists
27+
bool uwbExists = DoesUwbAssemblyExist();
28+
29+
// Get current build target group
30+
var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
31+
32+
// Get current scripting define symbols
33+
var currentSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
34+
var symbolList = currentSymbols.Split(';').Where(s => !string.IsNullOrEmpty(s)).ToList();
35+
36+
bool symbolExists = symbolList.Contains(UWB_SYMBOL);
37+
38+
// Update symbol if needed
39+
if (uwbExists && !symbolExists)
40+
{
41+
// Add symbol
42+
symbolList.Add(UWB_SYMBOL);
43+
var newSymbols = string.Join(";", symbolList);
44+
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, newSymbols);
45+
Debug.Log($"[UwbSymbolManager] Added {UWB_SYMBOL} symbol - UnityWebBrowser detected");
46+
}
47+
else if (!uwbExists && symbolExists)
48+
{
49+
// Remove symbol
50+
symbolList.Remove(UWB_SYMBOL);
51+
var newSymbols = string.Join(";", symbolList);
52+
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, newSymbols);
53+
Debug.Log($"[UwbSymbolManager] Removed {UWB_SYMBOL} symbol - UnityWebBrowser not found");
54+
}
55+
56+
// Log current status (only once per session to avoid spam)
57+
if (!SessionState.GetBool("UwbSymbolManager.LoggedStatus", false))
58+
{
59+
if (uwbExists)
60+
{
61+
Debug.Log($"[UwbSymbolManager] UnityWebBrowser available, {UWB_SYMBOL} symbol active");
62+
}
63+
else
64+
{
65+
Debug.Log($"[UwbSymbolManager] UnityWebBrowser not found");
66+
}
67+
68+
SessionState.SetBool("UwbSymbolManager.LoggedStatus", true);
69+
}
70+
}
71+
catch (System.Exception ex)
72+
{
73+
Debug.LogError($"[UwbSymbolManager] Error managing UWB symbol: {ex.Message}");
74+
}
75+
}
76+
77+
private static bool DoesUwbAssemblyExist()
78+
{
79+
// Check for UnityWebBrowser in multiple ways
80+
81+
// Method 1: Check compiled assemblies by name
82+
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
83+
if (assemblies.Any(a => a.GetName().Name == "VoltstroStudios.UnityWebBrowser"))
84+
{
85+
return true;
86+
}
87+
88+
// Method 2: Check for a well-known UWB type
89+
var uwbType = System.Type.GetType("VoltstroStudios.UnityWebBrowser.Core.WebBrowserClient, VoltstroStudios.UnityWebBrowser");
90+
if (uwbType != null)
91+
{
92+
return true;
93+
}
94+
95+
// Method 3: Check for UWB assets in project (by name hint)
96+
var uwbAssets = AssetDatabase.FindAssets("UnityWebBrowser t:ScriptableObject");
97+
foreach (var guid in uwbAssets)
98+
{
99+
var path = AssetDatabase.GUIDToAssetPath(guid);
100+
if (path.Contains("UnityWebBrowser"))
101+
{
102+
return true;
103+
}
104+
}
105+
106+
return false;
107+
}
108+
}
109+
}
110+
111+
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Packages/Passport/Runtime/Scripts/Private/Immutable.Passport.Runtime.Private.asmdef

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "Immutable.Passport.Runtime.Private",
33
"rootNamespace": "Immutable.Passport",
44
"references": [
5-
"VoltstroStudios.UnityWebBrowser",
65
"UniTask",
76
"Immutable.Browser.Core",
87
"Immutable.Browser.Gree",
@@ -22,8 +21,7 @@
2221
"allowUnsafeCode": false,
2322
"overrideReferences": true,
2423
"precompiledReferences": [
25-
"Newtonsoft.Json.dll",
26-
"VoltstroStudios.UnityWebBrowser.Shared.dll"
24+
"Newtonsoft.Json.dll"
2725
],
2826
"autoReferenced": true,
2927
"defineConstraints": [],

src/Packages/Passport/Runtime/Scripts/Private/UI/IPassportWebView.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ public interface IPassportWebView
105105
void Dispose();
106106
}
107107

108+
/// <summary>
109+
/// Optional capability for WebViews that support updating their internal rendering resolution.
110+
/// Used by PassportUI to keep the underlying WebView resolution in sync with the UI.
111+
/// </summary>
112+
public interface IResizablePassportWebView : IPassportWebView
113+
{
114+
/// <summary>
115+
/// Update the internal resolution of the WebView.
116+
/// </summary>
117+
/// <param name="width">New width in pixels.</param>
118+
/// <param name="height">New height in pixels.</param>
119+
void UpdateInternalResolution(int width, int height);
120+
121+
/// <summary>
122+
/// Apply any pending resolution updates (intended to be called from the main thread per frame).
123+
/// </summary>
124+
void UpdatePendingResolution();
125+
}
126+
108127
/// <summary>
109128
/// Configuration options for PassportUI WebView
110129
/// </summary>
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Immutable.Passport.Runtime.Uwb",
3+
"rootNamespace": "Immutable.Passport",
4+
"references": [
5+
"Immutable.Passport.Runtime.Private",
6+
"Immutable.Browser.Core",
7+
"Immutable.Passport.Core.Logging",
8+
"UniTask",
9+
"VoltstroStudios.UnityWebBrowser"
10+
],
11+
"includePlatforms": [
12+
"Android",
13+
"Editor",
14+
"iOS",
15+
"macOSStandalone",
16+
"WindowsStandalone64",
17+
"WebGL"
18+
],
19+
"excludePlatforms": [],
20+
"allowUnsafeCode": false,
21+
"overrideReferences": true,
22+
"precompiledReferences": [
23+
"VoltstroStudios.UnityWebBrowser.Shared.dll"
24+
],
25+
"autoReferenced": true,
26+
"defineConstraints": [
27+
"UWB_WEBVIEW"
28+
],
29+
"versionDefines": [],
30+
"noEngineReferences": false
31+
}
32+
33+
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)