Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thirdweb-dev/unity
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.13.1
Choose a base ref
...
head repository: thirdweb-dev/unity
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5
Choose a head ref

Commits on Jan 6, 2025

  1. Copy the full SHA
    082b7ec View commit details
  2. Copy the full SHA
    a0ac7bd View commit details
  3. Expose WC Included Wallet IDs in ThirdwebManager

    Also add tooltips
    0xFirekeeper committed Jan 6, 2025
    Copy the full SHA
    f5f85ac View commit details
  4. ver

    0xFirekeeper committed Jan 6, 2025
    Copy the full SHA
    c728323 View commit details

Commits on Jan 7, 2025

  1. Copy the full SHA
    28e6508 View commit details
  2. ver

    0xFirekeeper committed Jan 7, 2025
    Copy the full SHA
    e0330ba View commit details

Commits on Jan 10, 2025

  1. Copy the full SHA
    40df1f3 View commit details
  2. Copy the full SHA
    ded83a7 View commit details
  3. ver

    0xFirekeeper committed Jan 10, 2025
    Copy the full SHA
    ba74311 View commit details
  4. fix: walletSecret not passed down correctly

    repackaging 5.15.0 with patch
    0xFirekeeper committed Jan 10, 2025
    Copy the full SHA
    e03948f View commit details

Commits on Jan 15, 2025

  1. Update README.md

    Signed-off-by: Firekeeper <0xFirekeeper@gmail.com>
    0xFirekeeper authored Jan 15, 2025
    Copy the full SHA
    7aa8665 View commit details
  2. fix 2021 compile error

    0xFirekeeper committed Jan 15, 2025
    Copy the full SHA
    368e5a7 View commit details
  3. Copy the full SHA
    056f436 View commit details
  4. Copy the full SHA
    f1179d8 View commit details
  5. ver

    0xFirekeeper committed Jan 15, 2025
    Copy the full SHA
    a4da750 View commit details

Commits on Jan 17, 2025

  1. Copy the full SHA
    e620559 View commit details
  2. Copy the full SHA
    0f10ab3 View commit details
  3. Copy the full SHA
    1d5b969 View commit details
  4. ver

    0xFirekeeper committed Jan 17, 2025
    Copy the full SHA
    554a14d View commit details

Commits on Jan 24, 2025

  1. Copy the full SHA
    9f21e1c View commit details
  2. Copy the full SHA
    8701289 View commit details
  3. Update README.md

    Signed-off-by: Firekeeper <0xFirekeeper@gmail.com>
    0xFirekeeper authored Jan 24, 2025
    Copy the full SHA
    5a55d4e View commit details
  4. Update README.md

    Signed-off-by: Firekeeper <0xFirekeeper@gmail.com>
    0xFirekeeper authored Jan 24, 2025
    Copy the full SHA
    2bc32ad View commit details
  5. ver

    0xFirekeeper committed Jan 24, 2025
    Copy the full SHA
    c9b81e3 View commit details

Commits on Feb 7, 2025

  1. Copy the full SHA
    3758028 View commit details
  2. ver

    0xFirekeeper committed Feb 7, 2025
    Copy the full SHA
    b7ae06e View commit details

Commits on Feb 13, 2025

  1. Copy the full SHA
    c23633e View commit details
  2. ver

    0xFirekeeper committed Feb 13, 2025
    Copy the full SHA
    994c22b View commit details

Commits on Feb 21, 2025

  1. Copy the full SHA
    45fbb1d View commit details
  2. ver

    0xFirekeeper committed Feb 21, 2025
    Copy the full SHA
    9a1a87d View commit details
  3. Copy the full SHA
    f62729d View commit details
  4. ver

    0xFirekeeper committed Feb 21, 2025
    Copy the full SHA
    cfc0941 View commit details

Commits on Feb 28, 2025

  1. Copy the full SHA
    c8fb417 View commit details
  2. ver

    0xFirekeeper committed Feb 28, 2025
    Copy the full SHA
    c29b84b View commit details

Commits on Mar 11, 2025

  1. Copy the full SHA
    f88f81f View commit details
  2. ver

    0xFirekeeper committed Mar 11, 2025
    Copy the full SHA
    94812c8 View commit details

Commits on Mar 12, 2025

  1. Copy the full SHA
    a118cc5 View commit details
  2. ver

    0xFirekeeper committed Mar 12, 2025
    Copy the full SHA
    24fdc20 View commit details
  3. Copy the full SHA
    d0fc0c4 View commit details
  4. ver

    0xFirekeeper committed Mar 12, 2025
    Copy the full SHA
    c312d65 View commit details

Commits on Mar 13, 2025

  1. Copy the full SHA
    312475a View commit details
  2. ver

    0xFirekeeper committed Mar 13, 2025
    Copy the full SHA
    ce2a2f9 View commit details
  3. cleanup test

    0xFirekeeper committed Mar 13, 2025
    Copy the full SHA
    6ab283e View commit details
  4. Copy the full SHA
    a4ebd59 View commit details
  5. ver

    0xFirekeeper committed Mar 13, 2025
    Copy the full SHA
    2c7cb36 View commit details

Commits on Mar 19, 2025

  1. Copy the full SHA
    552402e View commit details
  2. ver

    0xFirekeeper committed Mar 19, 2025
    Copy the full SHA
    cfe3d5b View commit details

Commits on Mar 21, 2025

  1. Copy the full SHA
    7d2c3a3 View commit details

Commits on Mar 22, 2025

  1. ver

    0xFirekeeper committed Mar 22, 2025
    Copy the full SHA
    b372d0a View commit details

Commits on Mar 26, 2025

  1. Support for other injected wallets when using MetaMaskWallet

    Tested with Rabby + WalletProvider.MetaMaskWallet
    0xFirekeeper committed Mar 26, 2025
    Copy the full SHA
    a2e8c8f View commit details
Showing with 1,172 additions and 736 deletions.
  1. +151 −119 Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs
  2. +1 −0 Assets/Thirdweb/Examples/Scripts/PlaygroundManager.cs
  3. +4 −0 Assets/Thirdweb/Plugins/ThreadingPatcher/Editor/WebGLThreadingPatcher.cs
  4. +1 −1 Assets/Thirdweb/Plugins/ThreadingPatcher/Plugins/SystemThreadingTimer.jslib
  5. +5 −5 ...lugins/WalletConnectUnity/com.walletconnect.core/Runtime/External/NativeWebSocket/WebSocket.jslib
  6. +2 −2 Assets/Thirdweb/Plugins/WebGLInputCopy/WebGLInput/Mobile/WebGLInputMobile.jslib
  7. +6 −19 Assets/Thirdweb/Plugins/WebGLInputCopy/WebGLInput/WebGLInput.jslib
  8. +7 −16 Assets/Thirdweb/Plugins/WebGLInputCopy/WebGLWindow/WebGLWindow.jslib
  9. BIN Assets/Thirdweb/Runtime/NET/Thirdweb.dll
  10. +14 −3 Assets/Thirdweb/Runtime/Unity/Browser/CrossPlatformUnityBrowser.cs
  11. +2 −0 Assets/Thirdweb/Runtime/Unity/Prefabs/ThirdwebManager.prefab
  12. +55 −0 Assets/Thirdweb/Runtime/Unity/Prefabs/ThirdwebManagerServer.prefab
  13. +7 −0 Assets/Thirdweb/Runtime/Unity/Prefabs/ThirdwebManagerServer.prefab.meta
  14. +16 −482 Assets/Thirdweb/Runtime/Unity/ThirdwebManager.cs
  15. +639 −0 Assets/Thirdweb/Runtime/Unity/ThirdwebManagerBase.cs
  16. +11 −0 Assets/Thirdweb/Runtime/Unity/ThirdwebManagerBase.cs.meta
  17. +40 −0 Assets/Thirdweb/Runtime/Unity/ThirdwebManagerServer.cs
  18. +11 −0 Assets/Thirdweb/Runtime/Unity/ThirdwebManagerServer.cs.meta
  19. +32 −1 Assets/Thirdweb/Runtime/Unity/ThirdwebUnityExtensions.cs
  20. +44 −20 Assets/Thirdweb/Runtime/Unity/Wallets/Core/MetaMaskWallet.cs
  21. +9 −4 Assets/Thirdweb/Runtime/Unity/Wallets/Core/WalletConnectWallet.cs
  22. +2 −1 Assets/Thirdweb/Runtime/Unity/Wallets/Core/WebGLMetaMask.cs
  23. +31 −0 Assets/Thirdweb/Runtime/Unity/WebGL/WebGLCopyBuffer.jslib
  24. +32 −0 Assets/Thirdweb/Runtime/Unity/WebGL/WebGLCopyBuffer.jslib.meta
  25. +1 −1 ProjectSettings/ProjectSettings.asset
  26. +49 −62 README.md
270 changes: 151 additions & 119 deletions Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -5,119 +5,59 @@

namespace Thirdweb.Editor
{
[CustomEditor(typeof(ThirdwebManager))]
public class ThirdwebManagerEditor : UnityEditor.Editor
public abstract class ThirdwebManagerBaseEditor<T> : UnityEditor.Editor
where T : MonoBehaviour
{
private SerializedProperty clientIdProp;
private SerializedProperty bundleIdProp;
private SerializedProperty initializeOnAwakeProp;
private SerializedProperty showDebugLogsProp;
private SerializedProperty optOutUsageAnalyticsProp;
private SerializedProperty supportedChainsProp;
private SerializedProperty redirectPageHtmlOverrideProp;

private int selectedTab = 0;
private readonly string[] tabTitles = { "Client", "Preferences", "Misc", "Debug" };
protected SerializedProperty initializeOnAwakeProp;
protected SerializedProperty showDebugLogsProp;
protected SerializedProperty autoConnectLastWalletProp;
protected SerializedProperty supportedChainsProp;
protected SerializedProperty includedWalletIdsProp;
protected SerializedProperty redirectPageHtmlOverrideProp;
protected SerializedProperty rpcOverridesProp;

private GUIStyle headerStyle;
private GUIStyle buttonStyle;
protected int selectedTab;
protected GUIStyle buttonStyle;
protected Texture2D bannerImage;

private Texture2D bannerImage;
protected virtual string[] TabTitles => new string[] { "Client/Server", "Preferences", "Misc", "Debug" };

private void OnEnable()
protected virtual void OnEnable()
{
clientIdProp = FindProperty("ClientId");
bundleIdProp = FindProperty("BundleId");
initializeOnAwakeProp = FindProperty("InitializeOnAwake");
showDebugLogsProp = FindProperty("ShowDebugLogs");
optOutUsageAnalyticsProp = FindProperty("OptOutUsageAnalytics");
supportedChainsProp = FindProperty("SupportedChains");
redirectPageHtmlOverrideProp = FindProperty("RedirectPageHtmlOverride");
initializeOnAwakeProp = FindProp("InitializeOnAwake");
showDebugLogsProp = FindProp("ShowDebugLogs");
autoConnectLastWalletProp = FindProp("AutoConnectLastWallet");
supportedChainsProp = FindProp("SupportedChains");
includedWalletIdsProp = FindProp("IncludedWalletIds");
redirectPageHtmlOverrideProp = FindProp("RedirectPageHtmlOverride");
rpcOverridesProp = FindProp("RpcOverrides");

bannerImage = Resources.Load<Texture2D>("EditorBanner");
}

private void InitializeStyles()
{
buttonStyle = new GUIStyle(GUI.skin.button)
{
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleLeft,
padding = new RectOffset(10, 10, 10, 10)
};
}

private SerializedProperty FindProperty(string propertyName)
{
var targetType = target.GetType();
var property = targetType.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
if (property == null)
return null;

var backingFieldName = $"<{propertyName}>k__BackingField";
return serializedObject.FindProperty(backingFieldName);
}

public override void OnInspectorGUI()
{
serializedObject.Update();

if (headerStyle == null || buttonStyle == null)
if (buttonStyle == null)
{
InitializeStyles();
}

// Draw Banner and Title
DrawBannerAndTitle();

// Draw Tab Bar
DrawTabs();

// Draw Selected Tab Content
GUILayout.Space(10);
DrawSelectedTabContent();

serializedObject.ApplyModifiedProperties();
}

private void DrawBannerAndTitle()
{
GUILayout.BeginVertical();
GUILayout.Space(10);

GUILayout.BeginHorizontal();

if (bannerImage != null)
{
GUILayout.Label(bannerImage, GUILayout.Width(64), GUILayout.Height(64));
}

GUILayout.Space(10);

GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.Label("Thirdweb Configuration", EditorStyles.boldLabel);
GUILayout.Label("Configure your settings and preferences.\nYou can access ThirdwebManager.Instance from anywhere.", EditorStyles.miniLabel);
GUILayout.EndVertical();

GUILayout.EndHorizontal();

GUILayout.Space(10);

GUILayout.EndVertical();
}

private void DrawTabs()
{
selectedTab = GUILayout.Toolbar(selectedTab, tabTitles, GUILayout.Height(25));
}

private void DrawSelectedTabContent()
protected virtual void DrawSelectedTabContent()
{
switch (selectedTab)
{
case 0:
DrawClientTab();
DrawClientOrServerTab();
break;
case 1:
DrawPreferencesTab();
@@ -134,62 +74,54 @@ private void DrawSelectedTabContent()
}
}

private void DrawClientTab()
{
EditorGUILayout.HelpBox("Configure your client settings here.", MessageType.Info);
DrawProperty(clientIdProp, "Client ID");
DrawProperty(bundleIdProp, "Bundle ID");
DrawButton(
"Create API Key",
() =>
{
Application.OpenURL("https://thirdweb.com/create-api-key");
}
);
}
protected abstract void DrawClientOrServerTab();

private void DrawPreferencesTab()
protected virtual void DrawPreferencesTab()
{
EditorGUILayout.HelpBox("Set your preferences and initialization options here.", MessageType.Info);
DrawProperty(initializeOnAwakeProp, "Initialize On Awake");
DrawProperty(showDebugLogsProp, "Show Debug Logs");
DrawProperty(optOutUsageAnalyticsProp, "Opt-Out of Usage Analytics");
DrawProperty(autoConnectLastWalletProp, "Auto-Connect Last Wallet");
}

private void DrawMiscTab()
protected virtual void DrawMiscTab()
{
EditorGUILayout.HelpBox("Configure other settings here.", MessageType.Info);

// Wallet Connect Settings
GUILayout.Label("Wallet Connect Settings", EditorStyles.boldLabel);
DrawProperty(supportedChainsProp, "Supported Chains");

DrawProperty(rpcOverridesProp, "RPC Overrides");
GUILayout.Space(10);

// Desktop OAuth Settings
GUILayout.Label("Desktop OAuth Settings", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Redirect Page HTML Override", EditorStyles.boldLabel);
EditorGUILayout.LabelField("OAuth Redirect Page HTML Override", EditorStyles.boldLabel);
redirectPageHtmlOverrideProp.stringValue = EditorGUILayout.TextArea(redirectPageHtmlOverrideProp.stringValue, GUILayout.MinHeight(75));
GUILayout.Space(10);
DrawProperty(supportedChainsProp, "WalletConnect Supported Chains");
DrawProperty(includedWalletIdsProp, "WalletConnect Included Wallet IDs");
}

private void DrawDebugTab()
protected virtual void DrawDebugTab()
{
EditorGUILayout.HelpBox("Debug your settings here.", MessageType.Info);

DrawButton(
"Log Active Wallet Info",
() =>
{
if (Application.isPlaying)
{
var wallet = ((ThirdwebManager)target).GetActiveWallet();
if (wallet != null)
var mgr = target as T;
var method = mgr.GetType().GetMethod("GetActiveWallet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
Debug.Log($"Active Wallet ({wallet.GetType().Name}) Address: {wallet.GetAddress().Result}");
var wallet = method.Invoke(mgr, null) as IThirdwebWallet;
if (wallet != null)
{
Debug.Log($"Active Wallet ({wallet.GetType().Name}) Address: {wallet.GetAddress().Result}");
}
else
{
Debug.LogWarning("No active wallet found.");
}
}
else
{
Debug.LogWarning("No active wallet found.");
Debug.LogWarning("GetActiveWallet() not found.");
}
}
else
@@ -198,7 +130,6 @@ private void DrawDebugTab()
}
}
);

DrawButton(
"Open Documentation",
() =>
@@ -208,7 +139,42 @@ private void DrawDebugTab()
);
}

private void DrawProperty(SerializedProperty property, string label)
protected void DrawBannerAndTitle()
{
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
if (bannerImage != null)
{
GUILayout.Label(bannerImage, GUILayout.Width(64), GUILayout.Height(64));
}
GUILayout.Space(10);
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.Label("Thirdweb Configuration", EditorStyles.boldLabel);
GUILayout.Label("Configure your settings and preferences.\nYou can access ThirdwebManager.Instance from anywhere.", EditorStyles.miniLabel);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.EndVertical();
}

protected void DrawTabs()
{
selectedTab = GUILayout.Toolbar(selectedTab, TabTitles, GUILayout.Height(25));
}

protected void InitializeStyles()
{
buttonStyle = new GUIStyle(GUI.skin.button)
{
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleLeft,
padding = new RectOffset(10, 10, 10, 10)
};
}

protected void DrawProperty(SerializedProperty property, string label)
{
if (property != null)
{
@@ -220,15 +186,81 @@ private void DrawProperty(SerializedProperty property, string label)
}
}

private void DrawButton(string label, System.Action action)
protected void DrawButton(string label, System.Action action)
{
GUILayout.FlexibleSpace();
// center label
if (GUILayout.Button(label, buttonStyle, GUILayout.Height(35), GUILayout.ExpandWidth(true)))
{
action.Invoke();
}
GUILayout.FlexibleSpace();
}

protected SerializedProperty FindProp(string propName)
{
var targetType = target.GetType();
var property = targetType.GetProperty(propName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
if (property == null)
return null;
var backingFieldName = $"<{propName}>k__BackingField";
return serializedObject.FindProperty(backingFieldName);
}
}

[CustomEditor(typeof(ThirdwebManager))]
public class ThirdwebManagerEditor : ThirdwebManagerBaseEditor<ThirdwebManager>
{
SerializedProperty clientIdProp;
SerializedProperty bundleIdProp;

protected override void OnEnable()
{
base.OnEnable();
clientIdProp = FindProp("ClientId");
bundleIdProp = FindProp("BundleId");
}

protected override string[] TabTitles => new string[] { "Client", "Preferences", "Misc", "Debug" };

protected override void DrawClientOrServerTab()
{
EditorGUILayout.HelpBox("Configure your client settings here.", MessageType.Info);
DrawProperty(clientIdProp, "Client ID");
DrawProperty(bundleIdProp, "Bundle ID");
DrawButton(
"Create API Key",
() =>
{
Application.OpenURL("https://thirdweb.com/create-api-key");
}
);
}
}

[CustomEditor(typeof(ThirdwebManagerServer))]
public class ThirdwebManagerServerEditor : ThirdwebManagerBaseEditor<ThirdwebManagerServer>
{
SerializedProperty secretKeyProp;

protected override void OnEnable()
{
base.OnEnable();
secretKeyProp = FindProp("SecretKey");
}

protected override string[] TabTitles => new string[] { "Client", "Preferences", "Misc", "Debug" };

protected override void DrawClientOrServerTab()
{
EditorGUILayout.HelpBox("Configure your client settings here.", MessageType.Info);
DrawProperty(secretKeyProp, "Secret Key");
DrawButton(
"Create API Key",
() =>
{
Application.OpenURL("https://thirdweb.com/create-api-key");
}
);
}
}
}
1 change: 1 addition & 0 deletions Assets/Thirdweb/Examples/Scripts/PlaygroundManager.cs
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ private async void ConnectWallet(WalletOptions options)
currentPanel.Action1Button.onClick.AddListener(async () =>
{
var address = await wallet.GetAddress();
address.CopyToClipboard();
Log(currentPanel.LogText, $"Address: {address}");
});

Original file line number Diff line number Diff line change
@@ -18,7 +18,11 @@ public void OnPostBuildPlayerScriptDLLs(BuildReport report)
if (report.summary.platform != BuildTarget.WebGL)
return;

#if UNITY_2022_1_OR_NEWER
var mscorLibDll = report.GetFiles().FirstOrDefault(f => f.path.EndsWith("mscorlib.dll")).path;
#else
var mscorLibDll = report.files.FirstOrDefault(f => f.path.EndsWith("mscorlib.dll")).path;
#endif
if (mscorLibDll == null)
{
Debug.LogError("Can't find mscorlib.dll in build dll files");
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ var SystemThreadingTimerLib = {
setTimeout(function()
{
if (id === vars.currentCallbackId)
Runtime.dynCall('v', vars.callback);
{{{ makeDynCall("v", "vars.callback") }}}();
},
interval);
}
Loading