44using System . Runtime . InteropServices ;
55using System . Threading . Tasks ;
66using Newtonsoft . Json ;
7+ using UnityEngine ;
78
89namespace Thirdweb
910{
@@ -45,10 +46,18 @@ private static void jsCallback(string taskId, string result, string error)
4546 }
4647
4748 public static void Initialize ( string chainOrRPC , ThirdwebSDK . Options options ) {
49+ if ( Application . isEditor ) {
50+ Debug . LogWarning ( "Initializing the thirdweb SDK is not supported in the editor. Please build and run the app instead." ) ;
51+ return ;
52+ }
4853 ThirdwebInitialize ( chainOrRPC , Utils . ToJson ( options ) ) ;
4954 }
5055
5156 public static async Task < string > Connect ( ) {
57+ if ( Application . isEditor ) {
58+ Debug . LogWarning ( "Connecting wallets is not supported in the editor. Please build and run the app instead." ) ;
59+ return "0x0000000000000000000000000000000000000000" ;
60+ }
5261 var task = new TaskCompletionSource < string > ( ) ;
5362 string taskId = Guid . NewGuid ( ) . ToString ( ) ;
5463 taskMap [ taskId ] = task ;
@@ -58,11 +67,19 @@ public static async Task<string> Connect() {
5867 }
5968
6069 public static void SwitchNetwork ( int chainId ) {
70+ if ( Application . isEditor ) {
71+ Debug . LogWarning ( "Switching networks is not supported in the editor. Please build and run the app instead." ) ;
72+ return ;
73+ }
6174 ThirdwebSwitchNetwork ( chainId ) ;
6275 }
6376
6477 public static async Task < T > InvokeRoute < T > ( string route , string [ ] body )
6578 {
79+ if ( Application . isEditor ) {
80+ Debug . LogWarning ( "Interacting with the thirdweb SDK is not supported in the editor. Please build and run the app instead." ) ;
81+ return default ( T ) ;
82+ }
6683 var msg = Utils . ToJson ( new RequestMessageBody ( body ) ) ;
6784 string taskId = Guid . NewGuid ( ) . ToString ( ) ;
6885 var task = new TaskCompletionSource < string > ( ) ;
0 commit comments