From d085c9a510c7c26d1e6e449702020baf198682b6 Mon Sep 17 00:00:00 2001 From: Kornei Dontsov Date: Mon, 16 Jan 2023 17:18:50 +0300 Subject: [PATCH] [Unity3D-sdk] Remove null propagation for C# 4.0 Null propagation operator was released in C# 6.0. Older versions of Unity use C# 4.0 which doesn't have null propagation operator. This leads to errors like this: `Assets/PocoSDK/PocoManager.cs(155,16): error CS1525: Unexpected symbol `.', expecting `[', or `identifier'`; `\Assets\PocoSDK\PocoManager.cs:5345 Feature 'null propagating operator' is not available. Please use language version 6.0 or greater.` Documentation in README says that Poco-SDK supports Unity3D version 4 & 5 and above. To do this we should replace null propagation operator with the equivalent C# 4.0 code. This commit does it. --- Unity3D/PocoManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Unity3D/PocoManager.cs b/Unity3D/PocoManager.cs index c2c46f8..01398f5 100644 --- a/Unity3D/PocoManager.cs +++ b/Unity3D/PocoManager.cs @@ -152,7 +152,11 @@ private object GetScreenSize(List param) public void stopListening() { mRunning = false; - server?.Stop(); + var server = this.server; + if (server != null) + { + server.Stop(); + } } [RPC]