The only thing i can think of is that you check if your “link.xml” is propperly configured?
<linker>
<assembly fullname="ASSEMBLY_NAME">
<type fullname="YOUTYPENAME" preserve="all"/> <!-- Ensure a full typename, namespace included -->
</assembly>
</linker>
Also maybe try using IUnityLinkerProcessor to provide the path to your “link.xml” file when building (Full absolute path does work for sure, i dont know if a relative path works)
PD: Ah, i can see your type is a Nested type from here
If this doesnt work, try extracting your type outside of its parent class (and rewrite the link.xml). Maybe it has a problem with preserving Nested types.
PD2: also, on a side note, i would recommend that you always write Types within Namespaces, and that your types should not contain strange characters like underscore. Also NEVER start with underscore (compiler-generated types often start with underscore to differentiate themselves)
If you carefully read your error, you will see this (relevant lines in bold):
‘System.Collections.Generic.List1[[_MainScript+Helper_TransformStruct, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::.cctor’ for which no ahead of time (AOT) code was generated.
…
…
2024/09/17 14:05:00.044 26338 26362 Error Unity at Newtonsoft.Json.Serialization.JsonArrayContract.CreateTemporaryCollection () [0x00000] in <00000000000000000000000000000000>:0
What seems to be happening, is that when deserializing, Newtonsoft is generating a temporary List<T> for your array. It cannot create the List because the type List<_MainScript.Helper_TransformStruct> does not exist because of stripping.
This is why i’ve told you to ensure you have both List and List<YourStruct> in the link.xml. Please test this before you complain.
Thanks for testing It, the only other thing that i can think off is this:
Also maybe try using IUnityLinkerProcessor to provide the path to your “link.xml” file when building (Full absolute path does work for sure, i dont know if a relative path works)
As i dont know if Unity automatically picks-up the link.xml file, or if It should be explicitly provided through that interface (for my use cases i’ve always used the interface)
I saw you message yesterday about the Adapter, but couldnt respond. I see that you deleted it so i dont know if it ended up being a solution for you or not.
Anyways i remembered this other info from the official documentation . There, they recommend that you generate “somewhere” a method like this (it’s not to be called, it’s just for the stripper to find it and assume these types are not to be stripped):
public void UsedOnlyForAOTCodeGeneration()
{
// call any type/method that you want to ensure it is not stripped for IL2CPP
// eg:
new _MainScript.Helper_TransformStruct();
new List<_MainScript.Helper_TransformStruct()>();
// ... etc for every type that gives you a "No AOT code was generated" error
}
i dont know if just having a method with this name will work, or if maybe you need to [Preserve] this method. But seems easier to setup than the link.xml in case you want to give it a try