- Home /
How to transfer an TCPClient trough a different scene?
I am trying to transfer, my TCPClient (client socket connection) from a login scene to a play scene. I dont want to close and reopen it again. What would be the best approch?
Comment
Answer by shopguy · Apr 15, 2015 at 01:39 AM
You can make it a static variable, for C#:
public class MyClass : MonoBehaviour
{
public static TCPClient *MyClient;
}
That way it doesn't get destroyed with the object. Or you can use this: http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
Or some other variations/combinations of the above.