Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

GameObject.Destroy = NetworkServer.Destroy

Discussion in 'Connected Games' started by SteamPunkPro2, Jun 16, 2017.

  1. SteamPunkPro2

    SteamPunkPro2

    Joined:
    Jun 8, 2013
    Posts:
    29
    After much experimenting its become clear to me that calling GameObject.Destroy on a networked object on the host is the same thing as calling NetworkServer.Destroy; for some very complex reasons I really dont want to go into explaining right now I dont want this. I want to be able to destroy the objects when I want, where I want, not when unity decides to send the message to the clients. Is there a way to prevent this event from being sent when calling GameObject.Destroy? Also its pretty annoying this is undocumented behavior I lost three days debugging this.
     
  2. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    3
    Random necroanswer: UNET source hints that NetworkServer.Destroy() is called by NetworkIdentity in the OnDestroy handler[1]. NetworkIdentity is a sealed class so there's little hope in overriding that behavior. One thing to try could be removing the NetworkIdentity component on the clients, which should stop them from being destroyed by the server.

    [1] https://bitbucket.org/Unity-Technol...ewer=file-view-default#NetworkIdentity.cs-282