AderKonstantin fef4e25ebf feat: update menu scene to use TextMeshPro components
Replace legacy UI components with TextMeshPro for improved text 
rendering and flexibility. Update component references and 
properties to ensure compatibility with the new text system. 
This change enhances visual quality and performance in the 
menu scene.
2025-02-09 01:00:00 +03:00

34 lines
804 B
C#

using UnityEngine;
using Unity.Netcode;
public class HostTestingEnv : MonoBehaviour
{
void Start()
{
StartHost();
}
void StartHost()
{
// Ensure NetworkManager is initialized
if (NetworkManager.Singleton == null)
{
Debug.Log("NetworkManager is not initialized. Cannot start host.");
return;
}
// Subscribe to the client connected event
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
// Start the host (server + client)
NetworkManager.Singleton.StartHost();
Debug.Log("Host started!");
}
void OnClientConnected(ulong clientId)
{
string message = $"Player with Client ID {clientId} connected.";
Debug.Log(message);
}
}