Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dead replacement after Network.Destroy

Discussion in 'Multiplayer' started by Rachan, Sep 6, 2014.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    759
    Hi everyone!

    I'm tried to figure it out How to make a players die on multiplayer
    and How to call any function on Client after Network.Destroy on the Server.

    Basically when players got killed the scripts should be like this

    Code (CSharp):
    1. void Dead(){
    2.         GameObject deadbody = (GameObject)GameObject.Instantiate (Ragdoll, this.transform.position, Quaternion.identity);
    3.         CopyTransformsRecurse (this.transform, deadbody);
    4.  
    5.         Network.Destroy(this.gameObject);
    6.         Network.RemoveRPCs (networkView.viewID);
    7. }
    The problem is... when some players got killed
    (on Server)
    they do whatever under Dead(); function

    But.. (on Client)
    they just Disappear! ...maybe server has removed it already...

    any ideas?
    Thanks in advanced.