27 lines
711 B
C#
27 lines
711 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Unity.Netcode;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class NetworkManagerUI : MonoBehaviour
|
|
{
|
|
[SerializeField] private Button hostBtn;
|
|
[SerializeField] private Button serverBtn;
|
|
[SerializeField] private Button clientBtn;
|
|
|
|
private void Start()
|
|
{
|
|
hostBtn.onClick.AddListener(() => {
|
|
NetworkManager.Singleton.StartHost();
|
|
});
|
|
serverBtn.onClick.AddListener(() => {
|
|
NetworkManager.Singleton.StartServer();
|
|
});
|
|
clientBtn.onClick.AddListener(() => {
|
|
NetworkManager.Singleton.StartClient();
|
|
});
|
|
}
|
|
}
|