Unity: How to destroy a gameobject through network?









up vote
4
down vote

favorite
1












We are building a real time strategy game on Unity and trying to destroy gameobjects on the server and the clients via network.
Currently a player can always destroy his own objects and the server can destroy all objects. But when a client tries to destroy objects of the server (or other clients) it only gets destroyed on this client. (As the client neither hasAuthority nor the object isLocalPlayer)



We tried different approaches:



1. Using Destroy(gameObject)



This will obviously not work as it gets only destroyed locally.



2. Using NetworkServer.Destroy(gameObject)



This fails as we don't have the authority.



3. Using a command to destroy the object



The moment we try to call a command on the server in which we destroy the object fails as well. Due to the authority check:




Trying to send command for object without authority.




4. First assigning the authority



We tried to assign the authority via
GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
but get the Error Message:




AssignClientAuthority can only be call on the server for spawned objects.




Trying to do this in a Command will fail due to Point 3.



Are there other possibilities to destroy gameObjects?
What is the way to go for destroying the gameObjects?



Edit: We spawned most of the objects during runtime (in a Command) via NetworkServer.SpawnWithClientAuthority or NetworkServer.Spawn










share|improve this question























  • Are you using NetworkServer.Spawn to create the object you're trying to delete?
    – Ruzihm
    Nov 6 at 16:25






  • 1




    Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
    – Draco18s
    Nov 6 at 17:06






  • 1




    @Draco18s Unity really deprecating uNet?
    – Programmer
    Nov 6 at 17:15






  • 1




    @Programmer Yes. support.unity3d.com/hc/en-us/articles/…
    – Draco18s
    Nov 6 at 18:25






  • 2




    Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
    – Programmer
    Nov 6 at 19:01















up vote
4
down vote

favorite
1












We are building a real time strategy game on Unity and trying to destroy gameobjects on the server and the clients via network.
Currently a player can always destroy his own objects and the server can destroy all objects. But when a client tries to destroy objects of the server (or other clients) it only gets destroyed on this client. (As the client neither hasAuthority nor the object isLocalPlayer)



We tried different approaches:



1. Using Destroy(gameObject)



This will obviously not work as it gets only destroyed locally.



2. Using NetworkServer.Destroy(gameObject)



This fails as we don't have the authority.



3. Using a command to destroy the object



The moment we try to call a command on the server in which we destroy the object fails as well. Due to the authority check:




Trying to send command for object without authority.




4. First assigning the authority



We tried to assign the authority via
GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
but get the Error Message:




AssignClientAuthority can only be call on the server for spawned objects.




Trying to do this in a Command will fail due to Point 3.



Are there other possibilities to destroy gameObjects?
What is the way to go for destroying the gameObjects?



Edit: We spawned most of the objects during runtime (in a Command) via NetworkServer.SpawnWithClientAuthority or NetworkServer.Spawn










share|improve this question























  • Are you using NetworkServer.Spawn to create the object you're trying to delete?
    – Ruzihm
    Nov 6 at 16:25






  • 1




    Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
    – Draco18s
    Nov 6 at 17:06






  • 1




    @Draco18s Unity really deprecating uNet?
    – Programmer
    Nov 6 at 17:15






  • 1




    @Programmer Yes. support.unity3d.com/hc/en-us/articles/…
    – Draco18s
    Nov 6 at 18:25






  • 2




    Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
    – Programmer
    Nov 6 at 19:01













up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





We are building a real time strategy game on Unity and trying to destroy gameobjects on the server and the clients via network.
Currently a player can always destroy his own objects and the server can destroy all objects. But when a client tries to destroy objects of the server (or other clients) it only gets destroyed on this client. (As the client neither hasAuthority nor the object isLocalPlayer)



We tried different approaches:



1. Using Destroy(gameObject)



This will obviously not work as it gets only destroyed locally.



2. Using NetworkServer.Destroy(gameObject)



This fails as we don't have the authority.



3. Using a command to destroy the object



The moment we try to call a command on the server in which we destroy the object fails as well. Due to the authority check:




Trying to send command for object without authority.




4. First assigning the authority



We tried to assign the authority via
GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
but get the Error Message:




AssignClientAuthority can only be call on the server for spawned objects.




Trying to do this in a Command will fail due to Point 3.



Are there other possibilities to destroy gameObjects?
What is the way to go for destroying the gameObjects?



Edit: We spawned most of the objects during runtime (in a Command) via NetworkServer.SpawnWithClientAuthority or NetworkServer.Spawn










share|improve this question















We are building a real time strategy game on Unity and trying to destroy gameobjects on the server and the clients via network.
Currently a player can always destroy his own objects and the server can destroy all objects. But when a client tries to destroy objects of the server (or other clients) it only gets destroyed on this client. (As the client neither hasAuthority nor the object isLocalPlayer)



We tried different approaches:



1. Using Destroy(gameObject)



This will obviously not work as it gets only destroyed locally.



2. Using NetworkServer.Destroy(gameObject)



This fails as we don't have the authority.



3. Using a command to destroy the object



The moment we try to call a command on the server in which we destroy the object fails as well. Due to the authority check:




Trying to send command for object without authority.




4. First assigning the authority



We tried to assign the authority via
GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
but get the Error Message:




AssignClientAuthority can only be call on the server for spawned objects.




Trying to do this in a Command will fail due to Point 3.



Are there other possibilities to destroy gameObjects?
What is the way to go for destroying the gameObjects?



Edit: We spawned most of the objects during runtime (in a Command) via NetworkServer.SpawnWithClientAuthority or NetworkServer.Spawn







unity3d multiplayer game-development






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 6 at 16:58

























asked Nov 6 at 15:22









hochreutenerl

295




295











  • Are you using NetworkServer.Spawn to create the object you're trying to delete?
    – Ruzihm
    Nov 6 at 16:25






  • 1




    Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
    – Draco18s
    Nov 6 at 17:06






  • 1




    @Draco18s Unity really deprecating uNet?
    – Programmer
    Nov 6 at 17:15






  • 1




    @Programmer Yes. support.unity3d.com/hc/en-us/articles/…
    – Draco18s
    Nov 6 at 18:25






  • 2




    Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
    – Programmer
    Nov 6 at 19:01

















  • Are you using NetworkServer.Spawn to create the object you're trying to delete?
    – Ruzihm
    Nov 6 at 16:25






  • 1




    Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
    – Draco18s
    Nov 6 at 17:06






  • 1




    @Draco18s Unity really deprecating uNet?
    – Programmer
    Nov 6 at 17:15






  • 1




    @Programmer Yes. support.unity3d.com/hc/en-us/articles/…
    – Draco18s
    Nov 6 at 18:25






  • 2




    Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
    – Programmer
    Nov 6 at 19:01
















Are you using NetworkServer.Spawn to create the object you're trying to delete?
– Ruzihm
Nov 6 at 16:25




Are you using NetworkServer.Spawn to create the object you're trying to delete?
– Ruzihm
Nov 6 at 16:25




1




1




Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
– Draco18s
Nov 6 at 17:06




Tell the server to destroy the whatever. Actually, this problem is one of the reasons I don't like UNet and why Unity is deprecating it and starting over.
– Draco18s
Nov 6 at 17:06




1




1




@Draco18s Unity really deprecating uNet?
– Programmer
Nov 6 at 17:15




@Draco18s Unity really deprecating uNet?
– Programmer
Nov 6 at 17:15




1




1




@Programmer Yes. support.unity3d.com/hc/en-us/articles/…
– Draco18s
Nov 6 at 18:25




@Programmer Yes. support.unity3d.com/hc/en-us/articles/…
– Draco18s
Nov 6 at 18:25




2




2




Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
– Programmer
Nov 6 at 19:01





Didn't know that. It got deprecated just when I was in the process of really learning it...To OP, I suggest you use Photon. It's been here to for a long time and I don't think it's going anywhere anytime soon.
– Programmer
Nov 6 at 19:01













3 Answers
3






active

oldest

votes

















up vote
1
down vote













Despite the fact UNet is going to end soon (as already mentioned by Draco18s) so far I would have done this:



  1. Add a NetworkIdentity to the GameObject you want to be able to destroy/identify over the network.


  2. If it is a prefab you spawn make sure it is added to the spawnable prefabs in the NetworkManager



  3. Since the local player object always has the authority over itself and components attached to it add the [Command] call to a component on the local player object (not on the target GameObjects) and use NetworkServer.Destroy e.g. something like





    public class NetworkObjectDestroyer : NetworkBehaviour

    // Called by the Player
    [Client]
    public void TellServerToDestroyObject(GameObject obj)

    CmdDestroyObject(obj);


    // Executed only on the server
    [Command]
    private void CmdDestroyObject(GameObject obj)

    // It is very unlikely but due to the network delay
    // possisble that the other player also tries to
    // destroy exactly the same object beofre the server
    // can tell him that this object was already destroyed.
    // So in that case just do nothing.
    if(!obj) return;

    NetworkServer.Destroy(obj);




    Hint: You also could add this for easier access since you are sure that you only need access to exactly one of those components (namely the one of your local player):



    public static NetworkObjectDestroyer Instance;

    private void Awake()

    // skip if not the local player
    if(!isLocalPlayer) return;

    // set the static instance
    Instance = this;




  4. Than later somewhere in your other script that needs to execute the destroy you do something like



    // that you would have to get somewhere if not anyway 
    // calling from a component of the local player object
    GameObject playerObject;

    // wherever you get your target object from
    GameObject targetObject;

    playerObject.GetComponent<NetworkObjectDestroyer>().TellServerToDestroyObject(targetObject);


    It is easier if you added the static Instance before. Than you can simply use



    NetworkObjectDestroyer.Instance.TellServerToDestroyObject(targetObject);


    without having to get the references first.







share|improve this answer





























    up vote
    0
    down vote













    How about using (1) and set up each client to have authority over their own game objects? Then all you need to ensure is to have each client be notified by the server on particular events.



    Here is a more open-ended question regarding multiplayer that describes how it would work manually. by having the clients listen to server messages/RPCs.






    share|improve this answer



























      up vote
      0
      down vote













      straight from the unity docs:



      Local authority
      Local authority (sometimes referred to as client authority) means the local client has authoritative control over a particular networked GameObject. This is in contrast to the default state which is that the server has authoritative control over networked GameObjects.



      In addition to isLocalPlayer****, you can choose to make the player GameObjects have “local authority”. This means that the player GameObject on its owner’s client is responsible for (or has authority over) itself. This is particularly useful for controlling movement; it means that each client has authority over how their own player GameObject is being controlled.



      To enable local player authority on a GameObject, tick the Network Identity component
      ’s Local Player Authority checkbox. The Network Transform component uses this “authority” setting, and sends movement information from the client to the other clients if this is set.



      See Scripting API Reference documentation on NetworkIdentity
      and localPlayerAuthority for information on implementing local player authority via script.



      see here



      you just need to set up a few things and youll be good to go!






      share|improve this answer




















        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53174872%2funity-how-to-destroy-a-gameobject-through-network%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote













        Despite the fact UNet is going to end soon (as already mentioned by Draco18s) so far I would have done this:



        1. Add a NetworkIdentity to the GameObject you want to be able to destroy/identify over the network.


        2. If it is a prefab you spawn make sure it is added to the spawnable prefabs in the NetworkManager



        3. Since the local player object always has the authority over itself and components attached to it add the [Command] call to a component on the local player object (not on the target GameObjects) and use NetworkServer.Destroy e.g. something like





          public class NetworkObjectDestroyer : NetworkBehaviour

          // Called by the Player
          [Client]
          public void TellServerToDestroyObject(GameObject obj)

          CmdDestroyObject(obj);


          // Executed only on the server
          [Command]
          private void CmdDestroyObject(GameObject obj)

          // It is very unlikely but due to the network delay
          // possisble that the other player also tries to
          // destroy exactly the same object beofre the server
          // can tell him that this object was already destroyed.
          // So in that case just do nothing.
          if(!obj) return;

          NetworkServer.Destroy(obj);




          Hint: You also could add this for easier access since you are sure that you only need access to exactly one of those components (namely the one of your local player):



          public static NetworkObjectDestroyer Instance;

          private void Awake()

          // skip if not the local player
          if(!isLocalPlayer) return;

          // set the static instance
          Instance = this;




        4. Than later somewhere in your other script that needs to execute the destroy you do something like



          // that you would have to get somewhere if not anyway 
          // calling from a component of the local player object
          GameObject playerObject;

          // wherever you get your target object from
          GameObject targetObject;

          playerObject.GetComponent<NetworkObjectDestroyer>().TellServerToDestroyObject(targetObject);


          It is easier if you added the static Instance before. Than you can simply use



          NetworkObjectDestroyer.Instance.TellServerToDestroyObject(targetObject);


          without having to get the references first.







        share|improve this answer


























          up vote
          1
          down vote













          Despite the fact UNet is going to end soon (as already mentioned by Draco18s) so far I would have done this:



          1. Add a NetworkIdentity to the GameObject you want to be able to destroy/identify over the network.


          2. If it is a prefab you spawn make sure it is added to the spawnable prefabs in the NetworkManager



          3. Since the local player object always has the authority over itself and components attached to it add the [Command] call to a component on the local player object (not on the target GameObjects) and use NetworkServer.Destroy e.g. something like





            public class NetworkObjectDestroyer : NetworkBehaviour

            // Called by the Player
            [Client]
            public void TellServerToDestroyObject(GameObject obj)

            CmdDestroyObject(obj);


            // Executed only on the server
            [Command]
            private void CmdDestroyObject(GameObject obj)

            // It is very unlikely but due to the network delay
            // possisble that the other player also tries to
            // destroy exactly the same object beofre the server
            // can tell him that this object was already destroyed.
            // So in that case just do nothing.
            if(!obj) return;

            NetworkServer.Destroy(obj);




            Hint: You also could add this for easier access since you are sure that you only need access to exactly one of those components (namely the one of your local player):



            public static NetworkObjectDestroyer Instance;

            private void Awake()

            // skip if not the local player
            if(!isLocalPlayer) return;

            // set the static instance
            Instance = this;




          4. Than later somewhere in your other script that needs to execute the destroy you do something like



            // that you would have to get somewhere if not anyway 
            // calling from a component of the local player object
            GameObject playerObject;

            // wherever you get your target object from
            GameObject targetObject;

            playerObject.GetComponent<NetworkObjectDestroyer>().TellServerToDestroyObject(targetObject);


            It is easier if you added the static Instance before. Than you can simply use



            NetworkObjectDestroyer.Instance.TellServerToDestroyObject(targetObject);


            without having to get the references first.







          share|improve this answer
























            up vote
            1
            down vote










            up vote
            1
            down vote









            Despite the fact UNet is going to end soon (as already mentioned by Draco18s) so far I would have done this:



            1. Add a NetworkIdentity to the GameObject you want to be able to destroy/identify over the network.


            2. If it is a prefab you spawn make sure it is added to the spawnable prefabs in the NetworkManager



            3. Since the local player object always has the authority over itself and components attached to it add the [Command] call to a component on the local player object (not on the target GameObjects) and use NetworkServer.Destroy e.g. something like





              public class NetworkObjectDestroyer : NetworkBehaviour

              // Called by the Player
              [Client]
              public void TellServerToDestroyObject(GameObject obj)

              CmdDestroyObject(obj);


              // Executed only on the server
              [Command]
              private void CmdDestroyObject(GameObject obj)

              // It is very unlikely but due to the network delay
              // possisble that the other player also tries to
              // destroy exactly the same object beofre the server
              // can tell him that this object was already destroyed.
              // So in that case just do nothing.
              if(!obj) return;

              NetworkServer.Destroy(obj);




              Hint: You also could add this for easier access since you are sure that you only need access to exactly one of those components (namely the one of your local player):



              public static NetworkObjectDestroyer Instance;

              private void Awake()

              // skip if not the local player
              if(!isLocalPlayer) return;

              // set the static instance
              Instance = this;




            4. Than later somewhere in your other script that needs to execute the destroy you do something like



              // that you would have to get somewhere if not anyway 
              // calling from a component of the local player object
              GameObject playerObject;

              // wherever you get your target object from
              GameObject targetObject;

              playerObject.GetComponent<NetworkObjectDestroyer>().TellServerToDestroyObject(targetObject);


              It is easier if you added the static Instance before. Than you can simply use



              NetworkObjectDestroyer.Instance.TellServerToDestroyObject(targetObject);


              without having to get the references first.







            share|improve this answer














            Despite the fact UNet is going to end soon (as already mentioned by Draco18s) so far I would have done this:



            1. Add a NetworkIdentity to the GameObject you want to be able to destroy/identify over the network.


            2. If it is a prefab you spawn make sure it is added to the spawnable prefabs in the NetworkManager



            3. Since the local player object always has the authority over itself and components attached to it add the [Command] call to a component on the local player object (not on the target GameObjects) and use NetworkServer.Destroy e.g. something like





              public class NetworkObjectDestroyer : NetworkBehaviour

              // Called by the Player
              [Client]
              public void TellServerToDestroyObject(GameObject obj)

              CmdDestroyObject(obj);


              // Executed only on the server
              [Command]
              private void CmdDestroyObject(GameObject obj)

              // It is very unlikely but due to the network delay
              // possisble that the other player also tries to
              // destroy exactly the same object beofre the server
              // can tell him that this object was already destroyed.
              // So in that case just do nothing.
              if(!obj) return;

              NetworkServer.Destroy(obj);




              Hint: You also could add this for easier access since you are sure that you only need access to exactly one of those components (namely the one of your local player):



              public static NetworkObjectDestroyer Instance;

              private void Awake()

              // skip if not the local player
              if(!isLocalPlayer) return;

              // set the static instance
              Instance = this;




            4. Than later somewhere in your other script that needs to execute the destroy you do something like



              // that you would have to get somewhere if not anyway 
              // calling from a component of the local player object
              GameObject playerObject;

              // wherever you get your target object from
              GameObject targetObject;

              playerObject.GetComponent<NetworkObjectDestroyer>().TellServerToDestroyObject(targetObject);


              It is easier if you added the static Instance before. Than you can simply use



              NetworkObjectDestroyer.Instance.TellServerToDestroyObject(targetObject);


              without having to get the references first.








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 13 at 8:55

























            answered Nov 9 at 18:44









            derHugo

            3,4072925




            3,4072925






















                up vote
                0
                down vote













                How about using (1) and set up each client to have authority over their own game objects? Then all you need to ensure is to have each client be notified by the server on particular events.



                Here is a more open-ended question regarding multiplayer that describes how it would work manually. by having the clients listen to server messages/RPCs.






                share|improve this answer
























                  up vote
                  0
                  down vote













                  How about using (1) and set up each client to have authority over their own game objects? Then all you need to ensure is to have each client be notified by the server on particular events.



                  Here is a more open-ended question regarding multiplayer that describes how it would work manually. by having the clients listen to server messages/RPCs.






                  share|improve this answer






















                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    How about using (1) and set up each client to have authority over their own game objects? Then all you need to ensure is to have each client be notified by the server on particular events.



                    Here is a more open-ended question regarding multiplayer that describes how it would work manually. by having the clients listen to server messages/RPCs.






                    share|improve this answer












                    How about using (1) and set up each client to have authority over their own game objects? Then all you need to ensure is to have each client be notified by the server on particular events.



                    Here is a more open-ended question regarding multiplayer that describes how it would work manually. by having the clients listen to server messages/RPCs.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 6 at 17:09









                    AngelKyriako

                    36625




                    36625




















                        up vote
                        0
                        down vote













                        straight from the unity docs:



                        Local authority
                        Local authority (sometimes referred to as client authority) means the local client has authoritative control over a particular networked GameObject. This is in contrast to the default state which is that the server has authoritative control over networked GameObjects.



                        In addition to isLocalPlayer****, you can choose to make the player GameObjects have “local authority”. This means that the player GameObject on its owner’s client is responsible for (or has authority over) itself. This is particularly useful for controlling movement; it means that each client has authority over how their own player GameObject is being controlled.



                        To enable local player authority on a GameObject, tick the Network Identity component
                        ’s Local Player Authority checkbox. The Network Transform component uses this “authority” setting, and sends movement information from the client to the other clients if this is set.



                        See Scripting API Reference documentation on NetworkIdentity
                        and localPlayerAuthority for information on implementing local player authority via script.



                        see here



                        you just need to set up a few things and youll be good to go!






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          straight from the unity docs:



                          Local authority
                          Local authority (sometimes referred to as client authority) means the local client has authoritative control over a particular networked GameObject. This is in contrast to the default state which is that the server has authoritative control over networked GameObjects.



                          In addition to isLocalPlayer****, you can choose to make the player GameObjects have “local authority”. This means that the player GameObject on its owner’s client is responsible for (or has authority over) itself. This is particularly useful for controlling movement; it means that each client has authority over how their own player GameObject is being controlled.



                          To enable local player authority on a GameObject, tick the Network Identity component
                          ’s Local Player Authority checkbox. The Network Transform component uses this “authority” setting, and sends movement information from the client to the other clients if this is set.



                          See Scripting API Reference documentation on NetworkIdentity
                          and localPlayerAuthority for information on implementing local player authority via script.



                          see here



                          you just need to set up a few things and youll be good to go!






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            straight from the unity docs:



                            Local authority
                            Local authority (sometimes referred to as client authority) means the local client has authoritative control over a particular networked GameObject. This is in contrast to the default state which is that the server has authoritative control over networked GameObjects.



                            In addition to isLocalPlayer****, you can choose to make the player GameObjects have “local authority”. This means that the player GameObject on its owner’s client is responsible for (or has authority over) itself. This is particularly useful for controlling movement; it means that each client has authority over how their own player GameObject is being controlled.



                            To enable local player authority on a GameObject, tick the Network Identity component
                            ’s Local Player Authority checkbox. The Network Transform component uses this “authority” setting, and sends movement information from the client to the other clients if this is set.



                            See Scripting API Reference documentation on NetworkIdentity
                            and localPlayerAuthority for information on implementing local player authority via script.



                            see here



                            you just need to set up a few things and youll be good to go!






                            share|improve this answer












                            straight from the unity docs:



                            Local authority
                            Local authority (sometimes referred to as client authority) means the local client has authoritative control over a particular networked GameObject. This is in contrast to the default state which is that the server has authoritative control over networked GameObjects.



                            In addition to isLocalPlayer****, you can choose to make the player GameObjects have “local authority”. This means that the player GameObject on its owner’s client is responsible for (or has authority over) itself. This is particularly useful for controlling movement; it means that each client has authority over how their own player GameObject is being controlled.



                            To enable local player authority on a GameObject, tick the Network Identity component
                            ’s Local Player Authority checkbox. The Network Transform component uses this “authority” setting, and sends movement information from the client to the other clients if this is set.



                            See Scripting API Reference documentation on NetworkIdentity
                            and localPlayerAuthority for information on implementing local player authority via script.



                            see here



                            you just need to set up a few things and youll be good to go!







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 9 at 20:08









                            PrinceOfRavens

                            1,31911021




                            1,31911021



























                                 

                                draft saved


                                draft discarded















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53174872%2funity-how-to-destroy-a-gameobject-through-network%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Darth Vader #20

                                How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                                Ondo