hi.
i have a networked game that characters should get a gun on start (when they join the game).
i have wrote this script and attached it to the characters game object and it seem to work fine but there is one problem : new players that join the game don’t see others guns. and i have no idea why is this happening?
here is my activation script:
void Start()
{
ActivateSimpleGun();
}
public void ActivateSimpleGun()
{
StartCoroutine(ActiveSGRoutine());
}
IEnumerator ActiveSGRoutine()
{
//this waits for the diactivation to complete
//(in case a new gun was equipped and we want to change it
NetworkWeaponDiactivate();
yield return new WaitUntil(() => AllGunsDiactive == true);
if (isServer) RpcActiveSG();
else CmdActiveSG();
}
[Command]
void CmdActiveSG()
{
SimpleGun.SetActive(true);
WhichGunisOn = 1;
AllGunsDiactive = false;
RpcActiveSG();
}
[ClientRpc]
void RpcActiveSG()
{
SimpleGun.SetActive(true);
WhichGunisOn = 1;
AllGunsDiactive = false;
}