Networking - How do i spawn an object with client authority?
So, i'm trying to learn basic online functionality. But i've ran into a brick wall in my progress; i can spawn objects on the server, but they don't seem to have client authority. I know you can have player objects spawned with client authority automatically when the server / client starts, but that's not quite what i want. I want to spawn a player or other object some time after the server starts or client connects. I know there's a method along the lines of NetworkServer.SpawnWithClientAuthority(prefab, connection), but no matter how i try to get the information for the network connection parameter, i get an error. Be it using the simple variable connectionToClient, using (networkmanager object).client.connection, or using a few other methods that i can't remember right now.
What should i do to get that information? Or should i not be using this method at all? None of the basic networking tutorials i've read seem to cover this exact subject. Any help would be appreciated.
Answer by Newbhope · Nov 18, 2018 at 08:38 PM
https://docs.unity3d.com/ScriptReference/Networking.NetworkServer.SpawnWithClientAuthority.html
https://forum.unity.com/threads/assign-authority-to-local-client-gameobject.371113/
,https://docs.unity3d.com/ScriptReference/Networking.NetworkServer.SpawnWithClientAuthority.html
https://forum.unity.com/threads/assign-authority-to-local-client-gameobject.371113/
Your answer
Follow this Question
Related Questions
Problem with instantiating and declaring objects in Netcode on client 0 Answers
[UNET] Spawn object on server BUT delete on your client 1 Answer
How can i Spawn a different prefab for client? 0 Answers
Networking - Host can spawn objects but client cant 0 Answers
MLAPI Client Character Spawning Problem 0 Answers