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

NullRef inside NetworkScene

Discussion in 'Multiplayer' started by glitchers, Jul 10, 2015.

  1. glitchers

    glitchers

    Joined:
    Apr 29, 2014
    Posts:
    64
    Hi,

    We are having this issue with ClientScene.FindLocalObject causing a NullReferenceException. The NetworkInstanceId passed is checked to verify if it is valid.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Networking.NetworkScene.FindLocalObject (NetworkInstanceId netId) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkScene.cs:57)
    3. UnityEngine.Networking.ClientScene.FindLocalObject (NetworkInstanceId netId) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:354)
     
  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    yeah, you are looking up a GameObject that has been deleted. It should just return null.

    I filed bug 711271 on this.
     
    glitchers likes this.
  3. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    You could put a try/catch block around that lookup as a workaround.