Skip to content

Commit 5562a09

Browse files
committed
Fill empty sprites in Prefab_ConnectWallet
1 parent e26c680 commit 5562a09

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Assets/Thirdweb/Examples/Scripts/Prefabs/Prefab_ConnectWallet.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ private void Start()
125125
walletUI.Value.connectButton.onClick.AddListener(() => ValidateConnection(walletUI.Key));
126126
}
127127

128+
foreach (var chain in ThirdwebManager.Instance.supportedChains)
129+
{
130+
if (NetworkIcons.Find(x => x.chain == chain.identifier) == null)
131+
NetworkIcons.Add(new NetworkIcon() { chain = chain.identifier, sprite = null });
132+
}
133+
134+
for (int i = 0; i < NetworkIcons.Count; i++)
135+
{
136+
if (NetworkIcons[i].sprite == null)
137+
NetworkIcons[i].sprite = NetworkIcons[0].sprite;
138+
}
139+
128140
bool usingEmailWallet = SupportedWallets.Contains(WalletProvider.MagicLink) || SupportedWallets.Contains(WalletProvider.Paper);
129141
bool usingNormalWallet =
130142
SupportedWallets.Contains(WalletProvider.Metamask)
@@ -267,7 +279,7 @@ private async void ShowConnectedState()
267279
{
268280
Debug.Log($"Connected to: {_address}");
269281

270-
var chainSprite = NetworkIcons.Find(x => x.chain == _currentChainData.identifier)?.sprite;
282+
var chainSprite = NetworkIcons.Find(x => x.chain == _currentChainData.identifier).sprite;
271283
var walletSprite = SupportedWalletsUI[_walletProvider].sprite;
272284
var balance = await ThirdwebManager.Instance.SDK.wallet.GetBalance();
273285

0 commit comments

Comments
 (0)