using System; using UnityEngine; using UnityEngine.UI; namespace Script { public class test : MonoBehaviour { public Texture2D ttt; public void HHHH() { } private ModbusTcpClient client; public RawImage raw; private void Start() { hh(); } async void hh() { // 使用 client = new ModbusTcpClient(); await client.ConnectToServer(); Debug.Log("123"); } private void OnDestroy() { client.CloseConnection(); } } }