#Hi, is there any way to switch the Unity
1 messages · Page 1 of 1 (latest)
I've spent the last hour doing some reflection magic to allow us to uninitialize services, so we can initialize them again. And it seems like it works at first glance (at least, after reinitializing services with a different environment, it correctly fetches the Remote Config settings of a new environment). However, there are concerns about some unexpected behavior that might occur. And it's too hacky to be considered "safe".
That's an interesting use of environments!
Unfortunately there's no way to change environment after initialization is done right now.
This way of doing it is indeed risky and we cannot guarantee that it will work across features
@lyric coral thanks for your answer!
Are there any better ways of handling crossplay, while keeping the possibility to restrict communication with other platforms using Unity's tools?
We have only 2 ideas:
-
Leave only one environment across all platforms and make the host responsible for filtering users based on global cross-play toggle for his platform and his local settings. As we don't use matchmaking and only join code + platform invites, anyone can try to connect to any platform even if cross-play is not allowed currently. So the main concern here is that this can be considered as "network communication with other platforms" and it's not always allowed, especially on more closed platforms. Well, it's kinda gray area, tbh. The answer depends on who you ask.
-
Never switch environment at runtime, but ask a user to restart the game when the setting is changed (either a global one or a local one). The main concern here is that it's not user-friendly for our players.
Asking for some opinions around
A few options to consider
- You could set a platform property on the lobby. Upon joining with the code/invite, you could validate this and leave if it's not the appropriate platform and cross play is off.
- You could wrap the code, also including the platform as part of what is shared in the invite so that you can parse that from the client and validate before attempting to join