Following is my code, and there i have marked two different positions where iTween is working and not working. And in the end you can find the error given.
public class guestListener{
private bool mRunning;
string msg = "";
Thread mThread;
TcpListener tcp_Listener = null;
public GameObject point;
public int ponit_x, point_y;
public void Begin(GameObject go){
point = go;
mRunning = true;
mThread = new Thread (()=>SayHello(point));
mThread.Start();
Debug.Log("Thread done...");
iTween.MoveTo(point,iTween.Hash("x",1)); // <<<<-- THIS WORKS
}
public void stopListening(){
mRunning = false;
}
void SayHello(GameObject point){
try{
tcp_Listener = new TcpListener(54321);
tcp_Listener.Start();
System.Console.WriteLine("Server Start");
Debug.Log("Server Start");
while (mRunning) {
if (!tcp_Listener.Pending())
{
Thread.Sleep(100);
}
else
{
Debug.Log("1");
TcpClient client = tcp_Listener.AcceptTcpClient();
Debug.Log("2");
NetworkStream ns = client.GetStream();
Debug.Log("3");
StreamReader reader = new StreamReader(ns);
Debug.Log("4");
msg = "Woo";
while (msg!=""){
msg = reader.ReadLine();
Debug.Log(msg);
iTween.MoveTo(point,iTween.Hash("x",2)); //<< THIS IS NOT WORKING
Debug.Log("5");
}
reader.Close();
client.Close();
}
}
}
catch (ThreadAbortException)
{
//print("exception");
}
finally
{
mRunning = false;
tcp_Listener.Stop();
}
}
void OnApplicationQuit()
{
// stop listening thread
stopListening();
// wait fpr listening thread to terminate (max. 500ms)
mThread.Join(500);
}
}
//=========== Error Report ==================
UnityEngine.Random:RandomRangeInt(Int32, Int32)
UnityEngine.Random:Range(Int32, Int32) (at C:\BuildAgent\work\842f9557127e852\Runtime\ExportGenerated\Editor\UnityEngineRandom.cs:22)
iTween:GenerateID() (at Assets\Standard Assets\Plugins\iTween.cs:6783)
iTween:Launch(GameObject, Hashtable) (at Assets\Standard Assets\Plugins\iTween.cs:6734)
iTween:MoveTo(GameObject, Hashtable) (at Assets\Standard Assets\Plugins\iTween.cs:1448)
guestListener:SayHello(GameObject) (at Assets\Scripts\guestListener.cs:71)
guestListener:m__0() (at Assets\Scripts\guestListener.cs:22)