Frage

I'm trying to keep my connection between the server and my clients, when the clients are switching the scene. How it could be possible?

War es hilfreich?

Lösung

If the connection is tied to a MonoBehaviour you can just call DontDestroyOnLoad on that object.

Something like this

DontDestroyOnLoad( connectionObject );

You can read more about it here.

Note: you need to destroy the object by hand by calling Destroy when don't need it any more.

If the connection is not tied to a MonoBehaviour you need to keep a reference to it from an object that is not destroyed, for instance a Singleton.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top