hi everyone
i just start working with vuforia i write a code to get value of "3D text" component that was assigned to image target and send value to another software ( via UDP ) my problem is the code that i wrote send the value after run unity but i want it work after detecting object by camera. so plz help to correct my code. the code is :
using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading;
public class UDPContinousBoxes90 : MonoBehaviour {
private string IP; public int port; public string Hamed = "25"; GameObject TextMesh; public string myText; // "connection" things IPEndPoint remoteEndPoint; UdpClient client;
// Use this for initialization void Start() {
IP = "127.0.0.1"; port = 8052; string myText = GetComponent<TextMesh>().ToString();
remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port); client = new UdpClient();
sendString(myText); // status print("Sending to " + IP + " : " + port); }
// a funtion to send data via UDP private void sendString(string myText) { try {
// encode string to UTF8-coded bytes byte[] data = Encoding.UTF8.GetBytes(myText);
// send the data client.Send(data, data.Length, remoteEndPoint);
} catch (Exception err) { print(err.ToString()); } } }