#so i have been trying to use netcode but im encountering three errors
1 messages · Page 1 of 1 (latest)
uhm
let me send u the scropts
First Script
using UnityEngine;
using Unity.Netcode;
public class PlayerUIManager : MonoBehaviour
{
public static PlayerUIManager instance;
[SerializeField] bool startGameAsClient;
private void Start()
{
DontDestroyOnLoad(gameObject);
}
private void Awake()
{
if(instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
}
private void Update()
{
if(startGameAsClient)
{
startGameAsClient = false;
NetworkManager.Singleton.Shutdown();
NetworkManager.Singleton.StartClient();
}
}
}
Second Script
using UnityEngine;
using Unity.Netcode;
using System.Collections;
public class TitleScreenManager : MonoBehaviour
{
public void StartNetworkAsHost()
{
NetworkManager.Singleton.StartHost();
}
public void StartNewGame()
{
StartCoroutine(DelayedStartNewGame());
}
private IEnumerator DelayedStartNewGame()
{
yield return new WaitForSeconds(3f);
StartCoroutine(WorldSaveGameManager.instance.LoadNewGame());
}
}
i am also using parrelSync
help someone
Perhaps both of your parrel-synchronized projects start as host.