#Hey, i am trying to get the local player
1 messages · Page 1 of 1 (latest)
If this is code that's being run on the player object, why do you need NetworkManager.Singleton.LocalClient?
The host is spawing an nother object and in that object as well, the PlayerObject is null
so that is why i am saving the local player to a static variable
Also, how is the best method to spawn list of objects in batches? rn i am spawing them in a forloop and i get a warning cause of that
also should be accessible like this:
NetworkManager.Singleton.SpawnManager.GetLocalPlayerObject();
hmm, i will try that
I would also run base.OnNetworkSpawn() first.
I'm not sure if there's any actual setup in it, but there could be. So best to run it first.
Usually you want to pool objects if you're spawning batches of the same thing often.
wdym pool?
What object are you trying to spawn in batches for your game?
when the host joins he spawns the map, cause is random chosen and the enemies
and i get that warning when spawing the enemies
i was thinking maybe doing a QUEUE and spawn x number on the update method
instead of all of them
If you're going to be spawning enemies every single game, it would make sense to just have them placed in scene already. Then just randomly change their type or any customization at runtime
There are a different enemy prefabs depending on the map and so on, so that will be kind of complicated 😅
If there are more similarities than differences between your enemy prefabs, it's something I would recommend doing