After upgrade to 0.1.0 packages,burst throw exception in first frame after loading scene where I build nodes graph and rebuild invalid nodes in locations with obstaces. In Bursted IJob on trying call Remove for NativeMultiHashMap: Code (CSharp): bool initialNodeHasConnection = graph.TryGetFirstValue(node, out var connectedNode, out var connectedIt); while (initialNodeHasConnection) { if (connectedNode.Location != node.Location) { ... } else { graph.Remove(connectedNode, node); // <---- Here } initialNodeHasConnection = graph.TryGetNextValue(out connectedNode, ref connectedIt); } Where graph is NativeMultiHashMap<PortalNode, PortalNode>. Error: Code (CSharp): E:\GAMEDEV\REPOSITORY\Elinor\Packages\com.unity.collections@0.1.0-preview\Unity.Collections\NativeHashMap.cs(1013,13): error: Accessing the type `MM.CrowdPathFinding.PortalNode` is not supported by burst at Unity.Collections.NativeMultiHashMap`2<MM.CrowdPathFinding.PortalNode,MM.CrowdPathFinding.PortalNode>.Remove(Unity.Collections.NativeMultiHashMap`2<MM.CrowdPathFinding.PortalNode,MM.CrowdPathFinding.PortalNode>* this, MM.CrowdPathFinding.PortalNode* key, MM.CrowdPathFinding.PortalNode* value) (at E:\GAMEDEV\REPOSITORY\Elinor\Packages\com.unity.collections@0.1.0-preview\Unity.Collections\NativeHashMap.cs:1013) at MM.CrowdPathFinding.RemoveNodesForInvalidLocations.Execute(MM.CrowdPathFinding.RemoveNodesForInvalidLocations* this) (at E:\GAMEDEV\REPOSITORY\Elinor\Assets\Scripts\Managers\Pathfinding\CrowdPathFindingJobs.cs:81) at Unity.Jobs.IJobExtensions.JobStruct`1<MM.CrowdPathFinding.RemoveNodesForInvalidLocations>.Execute(ref MM.CrowdPathFinding.RemoveNodesForInvalidLocations data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\buildslave\unity\build\Runtime\Jobs\Managed\IJob.cs:30) While compiling job: System.Void Unity.Jobs.IJobExtensions/JobStruct`1<MM.CrowdPathFinding.RemoveNodesForInvalidLocations>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32) It happens only once. Before 0.1.0 all works without any problems. In Burst Inspector it happens too: It drops on if (typeof(TValueEQ) != typeof(TValue)) on 1013 row of NativeMultiHashMap in NativeHashMap.cs in Collections package, previously I used TryRemove here but after upgrate it's not exists (cause WorldDiff removed). Type: Code (CSharp): public struct PortalNode : IEquatable<PortalNode>, IEquatable<int2> { public int2 Coords; public int Cost; public int Location; public int Width; public LocationSide Side; public static bool operator ==(PortalNode n1, PortalNode n2) { return math.all(n1.Coords == n2.Coords); } public static bool operator !=(PortalNode n1, PortalNode n2) { return !math.all(n1.Coords == n2.Coords); } public bool Equals(PortalNode other) { return Coords.Equals(other.Coords); } public bool Equals(int2 other) { return Coords.Equals(other); } public override int GetHashCode() { return Coords.GetHashCode(); } }
Meh my bad, cause previously I used TryRemove from WorldDiff HashMapUtility and it's used iterator for removing without type comparsion (which of course not work in Burst) and it works in burst.
Hi eizenhorn, just confirming you are correct, the overload you initially used is not burstable as the actual Types are compared in the collection check (the implementation you posted where the instances are compared is fine). We'll fix that. The other overloads are burstable (a workaround would be to get the iterator to that element and call Remove on that, e.g. through TryGetFirstValue). Sorry for the inconvenience!
The message is not clear enough, it should be instead "Accessing `typeof(MM.CrowdPathFinding.PortalNode)` is not supported by burst" But actually, we need to support this scenario (comparing typeof for example with generics) so we will try to bring this in a near future release
It’s not about ECB it’s about NMHM. Yep like I did before, I used extension from WorldDiff and just forgot that, and after update to 0.1 WorldDiff removed, thus TryRemove removed Anyway it’s easy to implement Agree my first thought was “Hey my type now not burstable!” Only after source looking I found real reason.
Alexandre, I am sorry for the off topic, but would not you mind to answer this quick question? https://forum.unity.com/threads/burst-1-1-1-new-release.709280/#post-4794989