不了解为什么会出现此错误。我已经调试了它直到这一行,但不确定如何获取NullReferenceException。
SpatialUnderstandingDllTopology.TopologyResult[] topologyResults = PlacementAPI.Instance.Query_Topology_FindLargestPositionsOnFloor();
我在该函数的第一行添加了一条日志语句,但它甚至没有到达该位置。
public SpatialUnderstandingDllTopology.TopologyResult[] Query_Topology_FindLargestPositionsOnFloor()
{
Debug.Log("Entered FindLargest");
SpatialUnderstandingDllTopology.TopologyResult[] resultsTopology = new SpatialUnderstandingDllTopology.TopologyResult[QueryResultMaxCount];
Debug.Log("Created resultsTopology Object");
// Query
IntPtr resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
int locationCount = SpatialUnderstandingDllTopology.QueryTopology_FindLargestPositionsOnFloor(
resultsTopology.Length, resultsTopologyPtr);
if (locationCount == 0)
{
Debug.Log("Couldn't find large positions on floor");
}
if (resultsTopology == null)
{
Debug.Log("Floors results is empty");
}
Debug.Log("Found " + locationCount.ToString() + "Floors");
return resultsTopology;
}