Search Unity

How do I disable a component on a non-player object for everyone?

Discussion in 'Multiplayer' started by UnityUser9860, Aug 31, 2017.

  1. UnityUser9860

    UnityUser9860

    Joined:
    Dec 8, 2015
    Posts:
    179
    Hello!

    I am making a survival game in which the player can "destroy" / mine a tree but all im really do is disable the collider and mesh renderer howether how would I disable the component for everyone on the server? because right now it only happens localy.

    Thank you!
     
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Tell the clients to disable it? Since you don't know this. Im assuming you're using HLAPI. If that's the case. Check out Command and RPCs
     
    xVergilx likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What TwoTen said. Have the server call a ClientRpc, and in that rpc you disable those components. The ClientRpc will be called on every client.