Search Unity

can one call a Rpc directly after NetworkServer.Spawn ?

Discussion in 'Multiplayer' started by craig4android, Nov 8, 2020.

  1. craig4android

    craig4android

    Joined:
    May 8, 2019
    Posts:
    124
    like so?

    Code (CSharp):
    1.  GameObject bull = GameObject.Instantiate(bullet, this.transform.position, this.transform.rotation);
    2.             NetworkServer.Spawn(bull);
    3.             bull.GetComponent<Bullet>.RpcHit();
     
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Yes, as long as your transport channel is ordered.
    Not sure which transport you use or if you use Mirror/UNET, but most likely yes.