This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Dynamic Gist Embedding</title> | |
</head> | |
<body> | |
<div id="gistZone"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using BeardedManStudios.Network; | |
public class StartServer : MonoBehaviour | |
{ | |
public ushort port = 15937; // Port number | |
public Networking.TransportationProtocolType protocolType = Networking.TransportationProtocolType.UDP; // Communication method | |
public int playerCount = 31; // Maximum player count -- excluding this server | |
private void Start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using BeardedManStudios.Network; | |
public class StartServer : MonoBehaviour | |
{ | |
public string host = "127.0.0.1"; // IP address | |
public ushort port = 15937; // Port number | |
public Networking.TransportationProtocolType protocolType = Networking.TransportationProtocolType.UDP; // Communication method | |
private void Start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using BeardedManStudios.Network; | |
public class StartGame : MonoBehaviour | |
{ | |
public string host = "127.0.0.1"; // IP address | |
public ushort port = 15937; // Port number | |
public Networking.TransportationProtocolType protocolType = Networking.TransportationProtocolType.UDP; // Communication protocol | |
public int playerCount = 31; // Maximum player count -- excluding this server | |
public string sceneName = "Game"; // Scene to load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arguments: | |
// ushort <PORT_NUMBER> | |
// Networking.TransportationProtocolType <PROTOCOL_TYPE> | |
// int <MAX_PLAYERS> | |
Networking.Host((ushort)15937, Networking.TransportationProtocolType.UDP, 31); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Networking.Connected) | |
{ | |
// TODO: Fancy stuff | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: 15937 is the port number of the socket you started the connection on | |
Networking.Sockets[15937].connected += MyMethod; | |
void MyMethod() | |
{ | |
Debug.Log("Connection Established"); | |
} | |
// Or you can in-line if you wish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: 15937 is the port number of the socket you started the connection on | |
Networking.Sockets[15937].disconnected += MyMethod; | |
void MyMethod() | |
{ | |
Debug.Log("Connection Closed or Lost"); | |
} | |
// Or you can in-line if you wish | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arguments: | |
// string <IP_ADDRESS> | |
// ushort <PORT_NUMBER> | |
// Networking.TransportationProtocolType <PROTOCOL_TYPE> | |
// optional bool <IS_WIN_RT> [default false] | |
Networking.Connect("127.0.0.1", 15937, Networking.TransportationProtocolType.UDP, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: 15937 is the port number of the socket you started the connection on | |
Networking.Sockets[15937].serverDisconnected += ByeBye; | |
void ByeBye(string reason) | |
{ | |
Debug.Log("The server has disconnected you because of: " + reason); | |
} | |
// Or you can in-line if you wish | |
Networking.Sockets[15937].serverDisconnected += delegate(string reason) |
OlderNewer