NullReferenceException:对象引用未设置为对象的实例-SpatialUnderstandingDllTopology

时间:2018-12-07 05:59:05

标签: c# unity3d mapping spatial hololens

不了解为什么会出现此错误。我已经调试了它直到这一行,但不确定如何获取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;
    }

0 个答案:

没有答案