Skip to content

Commit 1a77f77

Browse files
committed
Post Android tests
1 parent c74a600 commit 1a77f77

File tree

5 files changed

+18
-73
lines changed

5 files changed

+18
-73
lines changed

Assets/Thirdweb/Examples/Scenes/Scene_Playground.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9987,7 +9987,7 @@ MonoBehaviour:
99879987
m_ScaleFactor: 1
99889988
m_ReferenceResolution: {x: 1920, y: 1080}
99899989
m_ScreenMatchMode: 0
9990-
m_MatchWidthOrHeight: 0
9990+
m_MatchWidthOrHeight: 1
99919991
m_PhysicalUnit: 3
99929992
m_FallbackScreenDPI: 96
99939993
m_DefaultSpriteDPI: 96

Assets/Thirdweb/Runtime/Unity/ThirdwebManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void Initialize()
132132
{
133133
if (string.IsNullOrEmpty(ClientId) || string.IsNullOrEmpty(BundleId))
134134
{
135-
ThirdwebDebug.LogError("ClientId and BundleId must be set in order to initialize ThirdwebManager.");
135+
ThirdwebDebug.LogError("ClientId and BundleId must be set in order to initialize ThirdwebManager. Get your API key from https://thirdweb.com/create-api-key");
136136
return;
137137
}
138138

Assets/Thirdweb/Runtime/Unity/Wallets/Core/WebGLMetaMask.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ namespace Thirdweb.Unity
1010
{
1111
public class WebGLMetaMask : MonoBehaviour
1212
{
13-
#region WebGL Imports
14-
13+
#if UNITY_WEBGL && !UNITY_EDITOR
1514
[DllImport("__Internal")]
1615
private static extern void EnableEthereum(string gameObjectName, string callback, string fallback);
1716

@@ -30,7 +29,7 @@ public class WebGLMetaMask : MonoBehaviour
3029
[DllImport("__Internal")]
3130
private static extern void Request(string rpcRequestMessage, string gameObjectName, string callback, string fallback);
3231

33-
#endregion
32+
#endif
3433

3534
private static WebGLMetaMask _instance;
3635
private BigInteger _activeChainId;
@@ -72,7 +71,9 @@ public async Task<bool> EnableEthereumAsync()
7271
{
7372
_enableEthereumTaskCompletionSource = new TaskCompletionSource<bool>();
7473

74+
#if UNITY_WEBGL && !UNITY_EDITOR
7575
EnableEthereum(gameObject.name, nameof(OnEnableEthereum), nameof(OnEnableEthereumFallback));
76+
#endif
7677

7778
return await _enableEthereumTaskCompletionSource.Task;
7879
}
@@ -82,7 +83,9 @@ public void OnEnableEthereum(string result)
8283
ThirdwebDebug.Log($"OnEnableEthereum: {result}");
8384
_selectedAddress = result;
8485
_isConnected = true;
86+
#if UNITY_WEBGL && !UNITY_EDITOR
8587
EthereumInit(gameObject.name, nameof(OnAccountChange), nameof(OnChainChange));
88+
#endif
8689
_enableEthereumTaskCompletionSource.SetResult(true);
8790
}
8891

@@ -96,13 +99,17 @@ public void OnEnableEthereumFallback(string result)
9699
public void OnAccountChange(string result)
97100
{
98101
ThirdwebDebug.Log($"OnAccountChange: {result}");
102+
#if UNITY_WEBGL && !UNITY_EDITOR
99103
_selectedAddress = GetSelectedAddress();
104+
#endif
100105
}
101106

102107
public void OnChainChange(string result)
103108
{
104109
ThirdwebDebug.Log($"OnChainChange: {result}");
110+
#if UNITY_WEBGL && !UNITY_EDITOR
105111
GetChainId(gameObject.name, nameof(OnChainId), nameof(OnChainIdFallback));
112+
#endif
106113
}
107114

108115
public void OnChainId(string result)
@@ -121,7 +128,9 @@ public async Task<T> RequestAsync<T>(RpcRequest rpcRequest)
121128
var rpcRequestMessage = JsonConvert.SerializeObject(rpcRequest);
122129
_rpcResponseCompletionSource = new TaskCompletionSource<string>();
123130

131+
#if UNITY_WEBGL && !UNITY_EDITOR
124132
Request(rpcRequestMessage, gameObject.name, nameof(OnRequestCallback), nameof(OnRequestFallback));
133+
#endif
125134

126135
var response = await _rpcResponseCompletionSource.Task;
127136
var rpcResponseRaw = JsonConvert.DeserializeObject<RpcResponse<T>>(response);
@@ -144,7 +153,11 @@ public void OnRequestFallback(string result)
144153

145154
public bool IsMetaMaskAvailable()
146155
{
156+
#if UNITY_WEBGL && !UNITY_EDITOR
147157
return IsMetamaskAvailable();
158+
#else
159+
return false;
160+
#endif
148161
}
149162

150163
public string GetAddress()

Assets/link.xml

Lines changed: 0 additions & 61 deletions
This file was deleted.

Assets/link.xml.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)