// Use this for initialization void Start() { //Sorts the Actuators/Sensors of array in ascending order according to ID actuators = GameObject.FindGameObjectsWithTag("Actuator").OrderBy(Actuator => Actuator.GetComponent <Actuator>().ID).ToArray(); sensors = GameObject.FindGameObjectsWithTag("Sensor").OrderBy(sensor => sensor.GetComponent <Sensor>().ID).ToArray(); // Sets length of data to be received to be exactly equal to number of Actuators data = new byte[256]; sdata = new byte[256]; // Start listening for client requests server.Start(); Thread connect = new Thread(Read); connect.IsBackground = true; connect.Start(); }
// Use this for initialization void Start() { //Sorts the Sensors of array in ascending order according to ID. actuators = GameObject.FindGameObjectsWithTag("Actuator").OrderBy(Actuator => Actuator.GetComponent <Actuator>().ID).ToArray(); reciever.JoinMulticastGroup(multicastaddress); recieverThread = new Thread(new ThreadStart(ReceiveData)); recieverThread.IsBackground = true; recieverThread.Start(); }