Example #1
0
        private void Awake()
        {
            // if the singleton hasn't been initialized yet
            if (instance != null && instance != this)
            {
                Destroy(this.gameObject);
            }

            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
Example #2
0
        void Start()
        {
            Client            = this.gameObject.AddComponent <ClientBehaviour>();
            Client.PlayerName = PlayerName;
            Client.Lobby      = this;
            Client.IP         = IP;
            Client.Port       = Port;
            Client.IsLocal    = IsLocal;

            LobbyUI = Instantiate(Resources.Load("ClientLobby") as GameObject);
            Button b = LobbyUI.transform.Find("Disconnect").GetComponent <Button>();

            b.onClick.AddListener(delegate() { Client.ClientDisconnect(); });

            CommandLine = LobbyUI.transform.Find("Commandline").GetComponent <Text>();
        }