I have been working with the .NET SDK within Unity3D for some time now, which seems to be working just fine within the editor. However, it seems that the last version of the Unity package (from .NET-SDK/Projects/BackendlessUnitySDK/UnityPackage at master · Backendless/.NET-SDK · GitHub) does not seem to work with the latest LTS version of Unity (2020.3.25f1) or any version after that.
The latest version I got working is 2019.4.34f1
I know the github page mentions the latest version has been tested against 2018.2.1f1 so I am wondering if support is coming for later versions?
The issue can easily be reproduced by creating a clean project and simply import the latest unitypackage from the link above. You might need to remove some packages from the Unity Package Manager due to conflicts with a NewtownSoft JSON dll.
Settings I am using (that might be relevant):
Build Target: Android
Scripting Backend: IL2CPP
Api Compatibility level: .NET 4.x
The error I am getting after being stuck in the Build Prompt for 5 minutes:
UnityEditor.BuildPlayerWindow+BuildMethodException: Error building player because script class layout might be incompatible between the editor and the player.
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <7ac35247888b44f4a7e290f1f6bb33f3>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <7ac35247888b44f4a7e290f1f6bb33f3>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Additionally (not sure if this is a Unity thing or could be fix by Backendless) I am getting the following errors/issues in 2021.2.x versions of Unity3D:
Loading assembly failed: "Assets/BackendlessSDK/System.Runtime.InteropServices.RuntimeInformation.dll" reason: File does not contain a valid CIL image
Loading assembly failed: "Assets/BackendlessSDK/System.IO.Compression.dll" reason: File does not contain a valid CIL image
Loading assembly failed: "Assets/BackendlessSDK/System.Threading.Overlapped.dll" reason: File does not contain a valid CIL image
Loading assembly failed: "Assets/BackendlessSDK/System.Globalization.Extensions.dll" reason: File does not contain a valid CIL image
Hope this gives some information in case of updating the SDK. I can make do with downgrading, but would love to keep working on the latest version of Unity as well as Backendless.
Thank you for reporting this issue and clear steps to reproduce it!
I have created an internal ticket (BKNDLSS-27395) in order to investigate it.
We will keep you updated here on any progress.
We are having the same issue with Unity 2020.3.30f1 on Android. Is there an ETA on a solution for this problem? It’s critical for our project to use Unity 2020.3.x
Thank you for the expedited feature and for the notice. We’ll add it to our task list this week and will let you know if we experience any difficulties.
Just updated to Unity 2021.3.0f1 with the latest Backendless SDK and it seems to be working as expected!
We’re still in the process of fully integrating all functionality we require from Backendless, but at least I was able to compile the app and log in from the app on a tablet.
Thanks for the fast response. The full error message is just “Error building player because script class layout might be incompatible between the editor and the player.”
This is followed by: “Build completed with a result of ‘Failed’ in 324 seconds (323947 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)”
And finally: “UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <55729f52d042492e9efc384182ae2feb>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <55729f52d042492e9efc384182ae2feb>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)”
This problem is still happening on Android. I also tried a clean project with just the new version of Backendless on iOS in 2021.3.0f1 (the new LTS version) and the same problem happened.
I’m fairly confident @Joey_Fladderak is correct that this problem is happening because you have a serialized field inside a preprocessor directive.
It’s odd that it is working on our project though.
Though I have to add that we have removed the TestDataService scripts and the BackendlessPlugin.cs file to make it compatible with our codebase (though we did move over the logic from the plugin script).
Nothing obvious in the removed scripts though that would indicate this behaviour.