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:
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:
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:
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();
}
}
