Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

photon

public class Launcher : MonoBehaviourPunCallbacks
{
Comment

photon

// #Critical: The first we try to do is to join a potential existing room. If there is, good, else, we'll be called back with OnJoinRandomFailed()
PhotonNetwork.JoinRandomRoom();
Comment

photon

public override void OnJoinRandomFailed(short returnCode, string message)
{
    Debug.Log("PUN Basics Tutorial/Launcher:OnJoinRandomFailed() was called by PUN. No random room available, so we create one.
Calling: PhotonNetwork.CreateRoom");

    // #Critical: we failed to join a random room, maybe none exists or they are all full. No worries, we create a new room.
    PhotonNetwork.CreateRoom(null, new RoomOptions());
}

public override void OnJoinedRoom()
{
    Debug.Log("PUN Basics Tutorial/Launcher: OnJoinedRoom() called by PUN. Now this client is in a room.");
}
Comment

photon

/// <summary>
/// The maximum number of players per room. When a room is full, it can't be joined by new players, and so new room will be created.
/// </summary>
[Tooltip("The maximum number of players per room. When a room is full, it can't be joined by new players, and so new room will be created")]
[SerializeField]
private byte maxPlayersPerRoom = 4;
Comment

photon

// #Critical: we failed to join a random room, maybe none exists or they are all full. No worries, we create a new room.
PhotonNetwork.CreateRoom(null, new RoomOptions { MaxPlayers = maxPlayersPerRoom });
Comment

PREVIOUS NEXT
Code Example
Csharp :: entity framework dynamic search solution 1 
Csharp :: sortdescriptions wpf 
Csharp :: c# check value at design time 
Csharp :: mongodb truncation exception c# 
Csharp :: Bitwise Left Shift C# 
Csharp :: copy file image in c# 
Csharp :: conditional middleware .net core 
Csharp :: delay a function on winform 
Csharp :: mailkit send email c# 
Csharp :: generate poco from db efcore 
Csharp :: unity update not called 
Csharp :: générer un nombre aléatoire en c# 
Csharp :: lista generica como parametro de un metodo en c# 
Csharp :: linqkit predicatebuilder or and nested combined predicates 
Csharp :: c# convert float to string 
Csharp :: How to execute a script after the c# function executed 
Csharp :: c# order of initialization 
Csharp :: linq cheat sheet 
Csharp :: Derived classes of abstract class share property 
Csharp :: c# class where T : enum 
Csharp :: c# rotate sum array 
Csharp :: c# parsing datetime from string irrespctive of culture 
Csharp :: get the next letter after specific character in c# 
Csharp :: list of countries in .net mvc 5 
Csharp :: remote webdriver dotnet 
Csharp :: c# find the smallest string in an array of strings 
Csharp :: two question marks together mean in C# 
Csharp :: How Many Vowels 
Csharp :: unity convert pixels to units 
Csharp :: how to execute a function in every object of list c# 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =