Hi,
just made the first test switching to 2021 and entities 0.51. Seems to run fine so far, however I have one problem:
ArgumentException: Object contains non-primitive or non-blittable data.
at Unity.Collections.NativeArray`1[T].Copy (Unity.Collections.NativeArray`1[T] src, System.Int32 srcIndex, T[] dst, System.Int32 dstIndex, System.Int32 length) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Collections.NativeArray`1[T].Copy (Unity.Collections.NativeArray`1[T] src, T[] dst, System.Int32 length) [0x00000] in <00000000000000000000000000000000>:0
at Unity.Collections.NativeArray`1[T].ToArray () [0x00000] in <00000000000000000000000000000000>:0
at VisitorDetailPanel+<periodicRefresh>d__27.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
at VisitorDetailPanel.SetupPanelFor (Unity.Entities.EntityManager entityManager, Unity.Entities.Entity currentSelectedPerson, VisitorClicker+AvatarPerson avatarPerson) [0x00000] in <00000000000000000000000000000000>:0
at VisitorClicker.Update () [0x00000] in <00000000000000000000000000000000>:0
VisitorDetailPanel:SetupPanelFor(EntityManager, Entity, AvatarPerson)
VisitorClicker:Update()
The exceptional .ToArray() call accesses happens here:
var optionalIdNeeds = em.GetBuffer<OptionalIdNeed>(currentSelectedPerson);
[...]
visitorStats.optionals = optionalIdNeeds.ToNativeArray(Allocator.Temp).ToArray();
Changing this code:
public struct OptionalIdNeed : IBufferElementData
{
public FixedString64Bytes id;
public bool satisfied;
}
To:
public struct OptionalIdNeed : IBufferElementData
{
public FixedString64Bytes id;
public byte satisfied;
public bool Satisfied => satisfied == 1;
}
Fixes it. I guess another workaround would be to getting rid of the .ToArray() call.
I think this is some sort of regression. I know bools were problematic pre-0.17, but hadn’t had a problem since then. Now it seems to be back.
Anyone else having issues in this direction? Known?
Best regards,
Bennet