Mirror
Mirror copied to clipboard
[SyncVar] NetworkBehaviours would be cleared if client runs out of visibilty range
GameObject, NetworkIdentity are stored by netId internally for that reason.
fix is in https://github.com/vis2k/Mirror/pull/2957
@vis2k - Is there more to do for this, or not?
fix is in #2957
let's see. adding all the sycnvars to Tanks.cs:
[SyncVar] public GameObject go;
[SyncVar] public NetworkIdentity ni;
[SyncVar] public NetworkBehaviour nb;
[SyncVar] public Tank tn;
generated getters:
public GameObject Networkgo
{
get
{
return GetSyncVarGameObject(___goNetId, ref go);
}
[param: In]
set
{
GeneratedSyncVarSetter_GameObject(value, ref go, 2uL, null, ref ___goNetId);
}
}
public NetworkIdentity Networkni
{
get
{
return GetSyncVarNetworkIdentity(___niNetId, ref ni);
}
[param: In]
set
{
GeneratedSyncVarSetter_NetworkIdentity(value, ref ni, 4uL, null, ref ___niNetId);
}
}
public NetworkBehaviour Networknb
{
get
{
return nb;
}
[param: In]
set
{
GeneratedSyncVarSetter(value, ref nb, 8uL, null);
}
}
public Tank Networktn
{
get
{
return GetSyncVarNetworkBehaviour(___tnNetId, ref tn);
}
[param: In]
set
{
GeneratedSyncVarSetter_NetworkBehaviour(value, ref tn, 16uL, null, ref ___tnNetId);
}
}
=> GO, NI, classes inheriting NB already get looked up by id. => just need to do the same for NetworkBehaviour itself