Exemplo n.º 1
0
        public InstantiateCommandBuffer <T0, T1> CreateInstantiateCommandBuffer <T0, T1>() where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData
        {
            //Todo: We use Persistent allocator here for consistency, though I suspect it might be possible to improve this.
            var icb      = new InstantiateCommandBuffer <T0, T1>(Allocator.Persistent);
            var instance = new PlaybackInstance
            {
                type = PlaybackType.InstantiateUntyped,
                requestingSystemType = World.ExecutingSystemType(),
            };

            m_playbackInstances.Add(instance);
            m_instantiateCommandBuffersUntyped.Add(icb.m_instantiateCommandBufferUntyped);
            return(icb);
        }
Exemplo n.º 2
0
        public InstantiateCommandBuffer CreateInstantiateCommandBuffer()
        {
            //Todo: We use Persistent allocator here for consistency, though I suspect it might be possible to improve this.
            var icb      = new InstantiateCommandBuffer(Allocator.Persistent);
            var instance = new PlaybackInstance
            {
                type = PlaybackType.InstantiateNoData,
                requestingSystemType = World.ExecutingSystemType(),
            };

            m_playbackInstances.Add(instance);
            m_instantiateCommandBuffersWithoutData.Add(icb);
            return(icb);
        }
Exemplo n.º 3
0
        public EntityCommandBuffer CreateEntityCommandBuffer()
        {
            //Todo: Expose variant of ECB constructor which allows us to set DisposeSentinal stack depth to -1 and use TempJob.
            var ecb      = new EntityCommandBuffer(Allocator.Persistent, PlaybackPolicy.SinglePlayback);
            var instance = new PlaybackInstance
            {
                type = PlaybackType.Entity,
                requestingSystemType = World.ExecutingSystemType(),
            };

            m_playbackInstances.Add(instance);
            m_entityCommandBuffers.Add(ecb);
            return(ecb);
        }
Exemplo n.º 4
0
        public DestroyCommandBuffer CreateDestroyCommandBuffer()
        {
            //Todo: We use Persistent allocator here because of the NativeReference. This recreates the DisposeSentinal stuff except with the slower allocator.
            var dcb      = new DestroyCommandBuffer(Allocator.Persistent);
            var instance = new PlaybackInstance
            {
                type = PlaybackType.Destroy,
                requestingSystemType = World.ExecutingSystemType(),
            };

            m_playbackInstances.Add(instance);
            m_destroyCommandBuffers.Add(dcb);
            return(dcb);
        }
Exemplo n.º 5
0
        public EnableCommandBuffer CreateEnableCommandBuffer()
        {
            //Todo: We use Persistent allocator here because of the NativeReference. This recreates the DisposeSentinal stuff except with the slower allocator.
            var ecb      = new EnableCommandBuffer(Allocator.Persistent);
            var instance = new PlaybackInstance
            {
                type = PlaybackType.Enable,
                requestingSystemType = ExecutingSystemType,
            };

            m_playbackInstances.Add(instance);
            m_enableCommandBuffers.Add(ecb);
            return(ecb);
        }