我创建了一个Cube对象并附加了这个脚本.
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour {
void Start () {
}
void Update () {
}
public void Move () {
Vector3 moveVector = new Vector3(10, 0, 0);
transform.Translate(moveVector);
}
}
Run Code Online (Sandbox Code Playgroud)
我想使用UDP来控制多维数据集移动,所以我创建了UDPManager.
using UnityEngine;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
public class UDPManager : MonoBehaviour
{
static UdpClient udp;
Thread thread;
public GameObject cube;
public CubeMove cubemove;
void Start ()
{
udp = new UdpClient(12345);
cubemove = cube.GetComponent<CubeMove>();
thread = new …Run Code Online (Sandbox Code Playgroud)