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

How do I control non-player clientAuthority objects?

Discussion in 'Scripting' started by Twanner, Jul 8, 2018.

  1. Twanner

    Twanner

    Joined:
    Dec 6, 2014
    Posts:
    33
    I am working on a networked board game in which each player controls multiple game pieces. Here is the simple break down of what I have going and what I want to achieve:

    I have a matchmaking scene in which players spawn into via the network manager. Players then select several game pieces that they wish to use and they are instantiated via NetworkServer.SpawnWithClientAuthority(prefab).

    I have a Nav Mesh set up and if I run a non-networked scene the game pieces use the nav mesh just fine.

    How can I send a command or call a function on one of the non player objects that are spawned with client authority?

    I have tried daisy chaining the command through the player controller (which is on the local client) but I get a null reference error. If I try to run functions directly from the non player object I get no response whatsoever. It is as if that object is still completely ignoring every input regardless of client authority.

    I'm new to networking and I know that I must be missing a step somewhere, please send help...and booze!