colyseus / colyseus-unity-sdk

⚔ Colyseus Multiplayer SDK for Unity
https://docs.colyseus.io/getting-started/unity-sdk/
MIT License
371 stars 102 forks source link

Added precompiler directives before using declaration #171

Closed mitchLucid closed 3 years ago

mitchLucid commented 3 years ago

"using" was throwing errors in Unity versions prior to 2020.2, when C# 8.0 was introduced

Vidski commented 3 years ago

Hey @mitchLucid! You don't need to use precompiler directives. C# < 8.0 doesn't support using without brackets, the solution would be using (UnityWebRequest req = new UnityWebRequest()) { ... return json; }, which is supported in every C# version.

Edit: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-statement#example for more information

mitchLucid commented 3 years ago

Thank you @Vidski great catch!