Quantcast
Channel: Multiplayer
Viewing all articles
Browse latest Browse all 16796

Synchronize SyncVar property

$
0
0
Have a bit of problems to understand how i should have the property theNumber add and sync.

1) I have two players
2) When the players spawn i want theNumber to add one so each player report a different sequential number

I just do not get it to work and would appreciate some help.

Code (CSharp):
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.Networking;
  4.  
  5. public class Player : NetworkBehaviour {
  6.  
  7.     [SyncVar] public int theNumber;
  8.     private int _nr;
  9.  
  10.     public override...
Synchronize SyncVar property

Viewing all articles
Browse latest Browse all 16796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>