heroiclabs / nakama-unity

Unity client for Nakama server.
https://heroiclabs.com/docs/unity-client-guide
Other
411 stars 75 forks source link

NotSupportedException on iOS with Unity LTS 2019 #104

Closed ernesernesto closed 3 years ago

ernesernesto commented 3 years ago

Hi, When updating to Unity LTS 2019.4 we got this issue when trying to call nakama methods

Method body replaced by UnityLinker.exe with a NotSupportedException

I'm not sure whether this is because we updated Unity or because of the way unity change they ios flow with Unity-iPhone and Unity Framework to accommodate unity as library https://docs.unity3d.com/Manual/StructureOfXcodeProject.html

Contents of Link.xml of nakama

<!--
 Copyright 2019 The Nakama Authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
<linker>
    <assembly fullname="Nakama" ignoreIfMissing="0" preserve="all" />

    <!-- NOTE: Do not code strip cryptographic utilities. -->
    <!--
    <assembly fullname="mscorlib">
        <namespace fullname="System.Security.Cryptography" preserve="all" />
    </assembly>
    -->
</linker>

I checked the build log and all seems normal, here are what I could find on the logs related to nakama

Mono dependencies included in the build
...
Dependency assembly - Nakama.dll
... omitted

Invoking UnityLinker with response file. response.rsp contents: -out="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/tempStrip" -x="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/../platform_native_link.xml" -x="/var/folders/q5/8qbnj_2n5j50xglj9xswh_h40000gn/T/tmp34794d79.tmp" -x="/var/folders/q5/8qbnj_2n5j50xglj9xswh_h40000gn/T/tmp2e07e88d.tmp" -x="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/TypesInScenes.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Firebase/Plugins/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Firebase/Plugins/Crashlytics/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Plugins/FacebookSDK/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Plugins/Nakama/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Plugins/Sirenix/Assemblies/link.xml" -x="/Users/ernesernesto/Documents/Repo/Assets/Plugins/UnityPurchasing/script/link.xml" -d="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/MaxSdk.Scripts.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Unity.RenderPipelines.Core.Runtime.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Coffee.UnmaskForUGUI.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Unity.RenderPipelines.Universal.Runtime.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Unity.Timeline.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/MeshBakerCore.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Coffee.UIParticle.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Unity.TextMeshPro.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Sirenix.OdinInspector.CompatibilityLayer.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Opencoding.Console.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Facebook.Unity.Settings.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/Sirenix.Serialization.Config.dll" --include-unity-root-assembly="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/DOTween.dll" --dotnetruntime=il2cpp --dotnetprofile=unityaot --use-editor-options --include-directory="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed" --rule-set=Conservative --editor-data-file="/Users/ernesernesto/Documents/Repo/Temp/StagingArea/Data/Managed/EditorToUnityLinkerData.json" --platform=iOS --engine-modules-asset-file="/Applications/Unity/Hub/Editor/2019.4.18f1/PlaybackEngines/iOSSupport/Whitelists/../modules.asset"

Nakama Version 2.7.0 Xcode 12.0.1

Thanks

ernesernesto commented 3 years ago

Strangely this was because we moved our nakama folder into under Plugins/

Pre assemblydef files and 2019 lts, unity was still having problems with non game code also gets recompiled everytime a code changes. We move it into under Plugins folder to mitigate that problem https://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html

Moving nakama files back to root Assets/ folder will clear this problem