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

SyncVar with networked gameobject works partially

$
0
0
Hi,

according to a post (somewhere around here) from an unity member SyncVars should work with networked gameobjects (with networkidentity on them).

I describe the problem in the following code snippet:

Code (CSharp):
  1. [SyncVar(hook="MyHook")] protected GameObject myObject;
  2.  
  3. protected void MyHook (GameObject go){
  4.     Debug.Log(go.name); // Works, gameobject is successfully synced to client
  5.     myObject = go;
  6.     Debug.Log(myObject.name); // Does not work! NullReferenceException: Object...
SyncVar with networked gameobject works partially

Viewing all articles
Browse latest Browse all 16796

Trending Articles



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