public WebSocket(string address)
 {
     if (WebSocketReceiver.instance == null)
     {
         WebSocketReceiver.AutoCreateInstance();
     }
     this.address = address;
 }
Beispiel #2
0
        public static void AutoCreateInstance()
        {
            GameObject go = GameObject.Find("/[WebSocketReceiver]");

            if (go == null)
            {
                go = new GameObject("[WebSocketReceiver]");
            }

            if (go.GetComponent <WebSocketReceiver>() == null)
            {
                go.AddComponent <WebSocketReceiver>();
            }

            instance = go.GetComponent <WebSocketReceiver>();
        }
Beispiel #3
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     instance = this;
 }