Hi.
I am just starting with Unity and C# and I am not sure if I maybe learn to do something the wrong way.
I created one c# script, which I called tcpclient (this is an own implementation of a tcp framework).
I created a second script, which I called myGUI (for testing).
Both scripts are attached to the main camera. The myGUI script just creates a simple GUI.Label containing the ping to the testing server. The ping value should been taken from the tcpclient script, which “exported” the variable pingInMs.
It still throws an error message and myGUI won’t compile. Am I doing everything wrong here and I should better put everything in one script? Please help ![]()
#myGUI.cs
using UnityEngine;
using System.Collections;
using System;
public class myGUI:MonoBehaviour {
void OnGUI() {
tcpclient c = GetComponent();
long a = tcpclient.pingInMs;
}
}
#tcpclient.cs
using UnityEngine;
using System.Collections;
using System;
using System.IO;
using System.Net.Sockets;
using System.Globalization;
using System.Text.RegularExpressions;
public class tcpclient:MonoBehaviour {
internal Boolean socketReady = false;
public long pingInMs = 0;
}