Example #1
0
        protected override void OnCreate()
        {
            var settings     = navSystem.Settings;
            var pointerArray = new NavMeshQueryPointer[JobsUtility.MaxJobThreadCount];

            for (var i = 0; i < JobsUtility.MaxJobThreadCount; ++i)
            {
                pointerArray[i] = new NavMeshQueryPointer
                {
                    Value = UnsafeUtility.Malloc(
                        UnsafeUtility.SizeOf <NavMeshQuery>(),
                        UnsafeUtility.AlignOf <NavMeshQuery>(),
                        Allocator.Persistent
                        )
                };

                var query = new NavMeshQuery(
                    NavMeshWorld.GetDefaultWorld(),
                    Allocator.Persistent,
                    settings.NavMeshQueryNodeMax
                    );

                queryList.Add(query);

                UnsafeUtility.CopyStructureToPtr(ref query, pointerArray[i].Value);
            }

            PointerArray = new NativeArray <NavMeshQueryPointer>(pointerArray, Allocator.Persistent);
        }
        protected override void OnCreate()
        {
            var pointerArray = new NavMeshQueryPointer[JobsUtility.MaxJobThreadCount];

            for (int i = 0; i < JobsUtility.MaxJobThreadCount; ++i)
            {
                pointerArray[i] = new NavMeshQueryPointer
                {
                    Value = UnsafeUtility.Malloc(
                        UnsafeUtility.SizeOf <NavMeshQuery>(),
                        UnsafeUtility.AlignOf <NavMeshQuery>(),
                        Allocator.Persistent
                        )
                };

                var query = new NavMeshQuery(
                    NavMeshWorld.GetDefaultWorld(),
                    Allocator.Persistent,
                    NavConstants.PATH_NODE_MAX
                    );

                queryList.Add(query);

                UnsafeUtility.CopyStructureToPtr(ref query, pointerArray[i].Value);
            }

            PointerArray = new NativeArray <NavMeshQueryPointer>(pointerArray, Allocator.Persistent);
        }