Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Transfer Ownership photon2

//With the PhotonView set as "Takeover"
// From the object that is asking for the ownership:

public void requestOwnershipExample() {
	base.photonView.RequestOwnership();
}

//With the PhotonView set as "Request"

public class OwnershipTranserExample : MonoBehaviourPun, IPunOwnershipCallbacks // NEEDED
{
	Private void Awake()
	{PhotonNetwork.AddCallbackTarget(this);}

	Private void OnDestroy()
	{PhotonNetwork.RemoveCallbackTarget(this);}

	public void OnOwnershipRequest(PhotonView targetView, Player RequestingPlayer)
	{
		if (targetView != base.photonView)
		return;

	 	//Add checks here

	 	base.photonView.TransferOwnership(requestingPlayer);
	}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get desktop path c# 
Csharp :: remove items from list c# condition 
Csharp :: object to mouse unity 
Csharp :: learn c# 
Csharp :: random unity 
Csharp :: emboss button in android app 
Csharp :: c# 2-dimensional array sort 
Csharp :: destroy gameobject unity 
Csharp :: c# keyboard enter 
Csharp :: how to get the path of the current directory in c# 
Csharp :: how to convert int to char in c# 
Csharp :: formula text and/or netsuite 
Csharp :: All SQL Server Tables in a Schema 
Csharp :: how to move mouse in c# 
Csharp :: Xamarin.Forms - How to navigate to a tabbed page child page 
Csharp :: access a local varible in a different function C# 
Csharp :: C# Console multi language 
Csharp :: remove carriage returns from string c# 
Csharp :: select a object from list based on a value csharp 
Csharp :: c# string is not null or empty 
Csharp :: how to get key value from json object in c# 
Csharp :: unity check if a animator parameter trigger is activated 
Csharp :: dotnet ef database update connection string 
Csharp :: VLC .net 
Csharp :: how to convert string to int in c# 
Csharp :: read folder c# 
Csharp :: unity assembly 
Csharp :: javascript close page after 5 seconds 
Csharp :: c# file directory selection 
Csharp :: c# day of week number 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =