Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

GameObject.Find not working with OnStartLocalPlayer for LobbyManager?

Discussion in 'Connected Games' started by Nicolas-Liatti, Mar 2, 2016.

  1. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    Hi,

    When using the LobbyManager, if I put a GameObject.Find in the Override OnStartLocalPlayer, I get an error "Object Reference not set to an instance of an object", even if the object is in the scene. It looks like in the case of LobbyManager that OnStartLocalPlayer is called before the scene is loaded..

    If I use NetworkManager it works fine...

    Is this a bug?

    Thanks,
    Nicolas
     
  2. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    Ok I think I found the problem.

    Actually, it just does not find Object which have a Network identity component. Not sure how to deal with this....
     
  3. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    643
    ClientScene.FindLocalObject()
    or
    NetworkServer.FindLocalObject()
     
unityunity