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

How to use [SyncVar] on NetworkBehaviour subclasses?

$
0
0
I would like to sync up a class member that contains a reference to another game object of the same NetworkBehaviour subclass. Usually, it's for keeping track of where the enemy is, and I want to keep a reference to it.

Here's the following code:

Code (CSharp):
  1. public class Foo : NetworkBehaviour {
  2.     [SyncVar]
  3.     public Foo enemy;
  4. }
But just that code itself crashes Unity editor. Does that mean you can't keep track of an enemy unit in a multiplayer game? Are there any other...

How to use [SyncVar] on NetworkBehaviour subclasses?

Viewing all articles
Browse latest Browse all 16796

Trending Articles



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