Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.Networking;
- public class Scores : MonoBehaviour
- {
- NetworkClient myClient;
- public void SetupClient()
- {
- myClient = new NetworkClient();
- myClient.RegisterHandler(MsgType.Connect, OnConnected);
- myClient.Connect("127.0.0.1", 4444);
- }
- public void OnConnected(NetworkMessage netMsg)
- {
- Debug.Log("Connected to server");
- }
- public void OnPlayerConnectMessage(NetworkMessage netMsg)
- {
- Debug.Log("New player connected!");
- }
- void Start ()
- {
- NetworkServer.Listen (4444);
- NetworkServer.RegisterHandler (MsgType.Connect, OnPlayerConnectMessage);
- SetupClient ();
- }
- void Update ()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement