Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top