Started getting this error on creation of World, no idea what it refers to.
ArgumentException: All component types containing pointers must use a [StructLayout(LayoutKind.Explicit, Size = <multiple of 8>)] attribute such that the type's size is the same on both 32-bit and 64-bit platforms. Type 'Unity.Collections.NativeArray`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is missing a this attribute due to pointer field 'm_Buffer'
I only have one StructLayout in my code, and even removing it doesn’t help.
Any ideas where this could be coming from?
I’m using latest 2019.1.3f1 unity version
Marking this answer as deprecated cause of the following post by Joachim.
So I had this problem too but this is on my old deprecated code which I eventually switched just recently.
If you have a struct which contains pointer based elements, in my case:
public struct SomeStruct : ISharedComponentData {
public NativeArray<int> Values;
}
You’ll have to include the StructLayout attribute and define the size of that struct. For me, I eventually got rid of the ISharedComponentData’s with the NativeArray and replaced it with IBufferElementData.
I’d start looking at structs which use pointer based structures/values and go from there.
This is a regression in p32, i suggest downgrading to p31 for the time being.
3 Likes