NativeQuadtree icon indicating copy to clipboard operation
NativeQuadtree copied to clipboard

Newer version of Unity (2019 LTS) throws NativeArray not allocated exception when trying to draw tree

Open VergilUa opened this issue 4 years ago • 1 comments

This happens because of NativeQuadTree<T>.Draw tries to GetEnumerator from results, which does not exist. Can be simply fixed by checking if results list exist like so:

if (results.IsCreated) {
	foreach (var element in results) {
		texture[(int) ((element.pos.x + widthAdd) * widthMult)][(int) ((element.pos.y + heightAdd) * heightMult)]	= Color.green;
	}
}

VergilUa avatar Feb 13 '21 12:02 VergilUa

That makes sense. You could create a PR for this if you like.

marijnz avatar Feb 15 '21 08:02 marijnz