Log in or register to post comments

want to run code work after detecting object

September 27, 2019 - 2:33pm #1

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 = "";

        port = 8052;

        string myText = GetComponent<TextMesh>().ToString();

        remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);

        client = new UdpClient();


        // status

        print("Sending to " + IP + " : " + port);


    // a funtion to send data via UDP

    private void sendString(string myText)




            // encode string to UTF8-coded bytes

            byte[] data = Encoding.UTF8.GetBytes(myText);

            // send the data

            client.Send(data, data.Length, remoteEndPoint);


        catch (Exception err)






Log in or register to post comments