Reputation: 83
I am making a multiplayer scene for my dodgeball game and once I have a host and a client running, it spazzes and forces me to control both the host and the client in one window. Here is what I mean:
This is my code managing the network:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class Script4Network : NetworkBehaviour
{
// Use this for initialization
void Start() {
}
void Update()
{
if (!isLocalPlayer)
{
return;
}
}
}
It might have something to do with my lack of understanding LocalAuthority.
Upvotes: 0
Views: 69
Reputation: 10571
You should use isLocalPlayer in Update
// Update is called once per frame
void Update()
{
if (!isLocalPlayer)
{
return;
}
if(lives == 0)
{
SceneManager.LoadScene("Lose");
}
livesText.text = "Lives: " + lives;
}
Upvotes: 1