Hello. I need to sync 2 values:
public Vector3[] actSkillTrg = new Vector3[4]; //active skill target(s)
public int skillCD = 0; //active skill cooldown
I can’t sych GameObjects, so I use Vector3 to define targets. So I use OnPhotonSerializeView to synh both. Then I have this in OnDisable():
if (bGoldGet) {
gameObject.GetComponent<stats>().actSkillTrg[0] = new Vector3(3f,3f,3f); //3rd player himself
gameObject.GetComponent<stats>().skillCD = 3;
}
bGoldGet = false;
and this in GoldControl():
public void p3GoldGet()
{
if (pl3.GetComponent<stats>().actSkillTrg[0] != Vector3.down)
{
print("pl3 gets gold!");
pl3.GetComponent<stats>().gold++;
pl3.GetComponent<stats>().actSkillTrg[0] = Vector3.down;
}
if (movEnd && pl3.GetComponent<stats>().skillCD!=0) { pl3.GetComponent<stats>().skillCD--; }
}
Problem is: int skillCD works fine, but Vector3 actSkillTrg isn’t synchronizing. Like if I put “print(pl3.GetComponent().actSkillTrg[0]);” in Update() it always prints “(0,-1.0,0)” on Host’s pc, but prints (3.0,3.0,3.0) on Client’s. Why could it be??
I use some invoke delay between OnDisable() and GoldControl().