ColorRpc









How do I use Color Rpc
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: OnClickRequestOwnership.cs Copy
8     public void OnClick()
9     {
10         if( Input.GetKey( KeyCode.LeftShift ) || Input.GetKey( KeyCode.RightShift ) )
11         {
12             Vector3 colVector = new Vector3( Random.Range( 0.0f, 1.0f ), Random.Range( 0.0f, 1.0f ), Random.Range( 0.0f, 1.0f ) );
13             this.photonView.RPC( "ColorRpc", PhotonTargets.AllBufferedViaServer, colVector );
14         }
15         else
16         {
17             if( this.photonView.ownerId == PhotonNetwork.player.ID )
18             {
19                 Debug.Log( "Not requesting ownership. Already mine." );
20                 return;
21             }
22
23             this.photonView.RequestOwnership();
24         }
25     }
File name: OnClickRequestOwnership.cs Copy
28     public void ColorRpc( Vector3 col )
29     {
30         Color color = new Color( col.x, col.y, col.z );
31         this.gameObject.GetComponent().material.color = color;
32     }

ColorRpc 118 lượt xem

Gõ tìm kiếm nhanh...