Hi,
I’m trying to rewrite an online game client in Unity. I’m also looking into building it for Android. The client-server protocol was established long ago, so I want to use something simple like a TcpClient because it’s just a few bytes of data being exchanged at a time.
Using the TcpClient works flawlessly on Windows, but on Android I get:
System.IO.DirectoryNotFoundException: Could not find a part of the path "/tmp/CASESENSITIVETESTde5c0245f8f948d68645249fbf37be3c".
This happens at the TcpClient constructor with or without arguments supplied. Based on the stack trace, it appears that the constructor is checking if IPv6 is enabled, which it does by loading a config file, and checking if that file exists calls System.IO.PathInternal:GetIsCaseSensitive()
which attempts to create the temp file mentioned in the exception.
I’m trying to think of some ways around this, but my understanding of Mono/.NET/Unity interactions is limited. I found a couple of commits in [Android] Assume file system is case sensitive · Issue #54339 · dotnet/runtime · GitHub which appear to address this issue but I’m not sure how to go about incorporating those changes in my Unity project.
Would I simply build a new System.IO.dll and put it in my build directory somewhere? Or would I have to come up with an equivalent change for Mono? Is there some way to change the /tmp/ folder to something that exists and that I have access to?
EDIT: Forgot some important details. I’m running Unity 2021.2.11f1 but the project was originally made in some older version of Unity (2019 ish). I’ve tried both Unity and IL2CPP as the backend, as well as both “.NET Standard 2.1” and “.NET Framework” for the API compatibility level. The phone is running Android 10.
Thanks!