Exemplo n.º 1
0
 public WebSocket(string address)
 {
     if (WebSocketReceiver.instance == null)
     {
         WebSocketReceiver.AutoCreateInstance();
     }
     this.address = address;
 }
Exemplo n.º 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>();
        }
Exemplo n.º 3
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     instance = this;
 }