Search Unity

Need help with Networking spawn error

Discussion in 'Multiplayer' started by philipwlodarczyk42, Oct 11, 2018.

  1. philipwlodarczyk42

    philipwlodarczyk42

    Joined:
    Oct 1, 2018
    Posts:
    4
    I have created a script that works for the most part, the bullets are created, client can see them and be affected by them, but I have one problem, every time I shoot it spawns 2 bullets, 1 that goes forward like it is supposed to and one that just floats there. Every time I shoot I get this error

    SpawnObject for bullet(Clone) (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server.
    UnityEngine.Networking.NetworkServer:Spawn(GameObject)
    PistolScript:Rpcshoot() (at Assets/PistolScript.cs:70)
    PistolScript:InvokeRpcRpcshoot(NetworkBehaviour, NetworkReader)
    UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()


    How can I fix this?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Looks like you are trying to spawn networked objects from the client. You can only call NetworkServer.Spawn on the server.