This commit is contained in:
2026-02-11 20:50:03 +05:30
parent df77848ca5
commit 614c38bdaf
2303 changed files with 256620 additions and 4 deletions
@@ -0,0 +1,48 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
using UnityEngine.UI;
namespace Mirror.Examples.AutoLANClientController
{
public class NetworkSceneScript : NetworkBehaviour
{
public Button clientButton;
public Text textResult;
public GameObject panelClient, panelServer;
void Start()
{
clientButton.onClick.AddListener(ClientButton);
panelServer.SetActive(false);
panelClient.SetActive(false);
if (isServer)
{
panelServer.SetActive(true);
}
if (isClient)
{
panelClient.SetActive(true);
}
}
void ClientButton()
{
if (isClient)
{
CmdSendText("Text: " + Random.Range(0, 999));
}
}
[Command(requiresAuthority = false)]
public void CmdSendText(string _value)
{
textResult.text = _value;
}
}
}