Question by
krse22 · Feb 09, 2016 at 02:04 PM ·
networkspawning problemsnetwork.instantiate
Spawn with local authority
Im creating a MOBA game and i have to Spawn different hero for every player. This is a script for spawning
[Command]
void CmdSpawn()
{
var hero = (GameObject)Instantiate(
heroes[0],
transform.position + new Vector3(0,1,0),
Quaternion.identity) as GameObject;
NetworkServer.SpawnWithClientAuthority(heroe, base.connectionToClient);
}
On that hero i have to disable components if its not localplayer so when i use
if (!localPlayerAuthority) {
DisableComponents ();
Both clients will have the authority of both heroes if i use "hasAuthority" the host wont have authority but client will?
I can't seem to find the problem does anyone know what to do?
Comment
You mention isLocalPlayer but have you used it anywhere?
Your answer
![](https://koobas.hobune.stream/wayback/20220612063333im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Network Instantiation works on one command and does not work on another 0 Answers
Simple NetworkView Question. 1 Answer
Issue with clone not firing projectile after short time after spawn 0 Answers
How can I get AssetId for spawnable object, that came in an AssetBundle 2 Answers
Network instantiate 0 Answers