문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top