Getting namespace name 'Multiplay' does not exits error during android build


To achieve functionality as shown in image, I was able to use matchmaker to allocate and join player to a running session or a new server session but I found the matchmaking process to be unreliable (maybe i did it wrong). When I matchmake in Game1, matchmaker sometimes creates a new server even though there is enough available slots in running session (I have backfill enabled) and sometimes it joins a session for game2 even when i clearly selected game1 (i think it has something to do with relaxations but i get error when i remove it so idk what else to do). So how do I properly implement matchmaker to get the result as shown in the image?

I also want to know if it is possible to join players to the server when they start the game and create/join the lobby for each game session to achieve this functionality?

My game also builds fine when i build in windows but when i try to build with android, i get this error: error CS0234: The type or namespace name ‘Multiplay’ does not exist in the namespace ‘Unity.Services’ (are you missing an assembly reference?).
I have tried re-installing multiplay package and also tried regenerating project files with git packages enabled in external tools.

1 Like

the solution on this link might be helpful.
it’s the same problem.

TL;DR: Multiplay module isn’t exported into android builds, wrap your Multiplay code with #if UNITY_SERVER #endif to only be present when compiling game servers

1 Like

i try that but not fixed

1 Like

Yo u need to wrap your multiplay code in #if UNITY_SERVER #endif tags. ANd also you need to wrap the imports refering to Multiplay (as I mentioned, those libraries are not imported into the android buld, so you have to keep that to you serve’r’s code.