unsafe GetObjectsInSpaceItem.ResultItem[] GetObjectsInSpace_FromOctree_GetResult(GetObjectsInSpaceItem item, int *array, int outputCount)
        {
            var toAdd = NativeUtility.Alloc(NativeUtility.MemoryAllocationType.Utility, outputCount * 4);

            NativeUtility.ZeroMemory(toAdd, outputCount * 4);
            var toAdd2 = (int *)toAdd;

            try
            {
                int length = 0;
                for (int n = 0; n < outputCount; n++)
                {
                    var obj = octreeObjects[array[n]];

                    if (item.VisibleOnly && !obj.VisibleInHierarchy)
                    {
                        continue;
                    }
                    if (item.SelectedTypeOnly != null && !item.SelectedTypeOnly.IsAssignableFrom(obj.BaseType))
                    {
                        continue;
                    }

                    toAdd2[n] = 1;
                    length++;

                    if (item.CastType == GetObjectsInSpaceItem.CastTypeEnum.One)
                    {
                        break;
                    }
                }

                if (length != 0)
                {
                    var result  = new GetObjectsInSpaceItem.ResultItem[length];
                    int current = 0;

                    for (int n = 0; n < outputCount; n++)
                    {
                        var obj = octreeObjects[array[n]];

                        if (toAdd2[n] == 0)
                        {
                            continue;
                        }

                        ref var resultItem = ref result[current];
                        resultItem.Object = obj;
                        current++;

                        if (item.CastType == GetObjectsInSpaceItem.CastTypeEnum.One)
                        {
                            break;
                        }
                    }

                    if (length != current)
                    {
                        Log.Fatal("Component_Scene: GetObjectsInSpace_FromOctree_GetResult: length != current.");
                    }

                    return(result);
                }
                else
                {
                    return(Array.Empty <GetObjectsInSpaceItem.ResultItem>());
                }
            }
 public void GetObjectsInSpace(GetObjectsInSpaceItem item)          //, bool disableOctree = false )
 {
     GetObjectsInSpace(new GetObjectsInSpaceItem[] { item });       //, disableOctree );
 }