#Interesting seems like one I fixed

1 messages · Page 1 of 1 (latest)

naive gull
#
    {
    }```
#
        where T : EntityCommandBufferSystem<T>
    {
        protected override void OnCreate()
        {
            base.OnCreate();
            this.RegisterSingleton<Singleton>(ref *this.m_PendingBuffers, this.World.Unmanaged, $"{typeof(T).Name} {nameof(Singleton)}");
        }

        public struct Singleton : IComponentData, IECBSingleton
        {
            private UnsafeList<EntityCommandBuffer>* pendingBuffers;
            private Allocator allocator;

            public EntityCommandBuffer CreateCommandBuffer(WorldUnmanaged world)
            {
                return EntityCommandBufferSystem.CreateCommandBuffer(ref *this.pendingBuffers, this.allocator, world);
            }

            /// <inheritdoc/>
            void IECBSingleton.SetPendingBufferList(ref UnsafeList<EntityCommandBuffer> buffers)
            {
                this.pendingBuffers = (UnsafeList<EntityCommandBuffer>*)UnsafeUtility.AddressOf(ref buffers);
            }

            /// <inheritdoc/>
            void IECBSingleton.SetAllocator(Allocator allocatorIn)
            {
                this.allocator = allocatorIn;
            }
        }
    }```
bright monolith
#

And the SystemAPI.GetSingleton schedule site?

naive gull
#
        public void OnUpdate(ref SystemState state)
        {
            if (this.query.IsEmptyIgnoreFilter)
            {
                return;
            }

            this.entityHandle.Update(ref state);
            this.effectTargetHandle.Update(ref state);
            this.effectDestroyHandle.Update(ref state);
            this.effectSetupHandle.Update(ref state);
            this.effectMetaHandle.Update(ref state);

            var commandBufferSystem = SystemAPI.GetSingleton<BeginEffectEntityCommandBufferSystem.Singleton>();
            var commandBuffer = commandBufferSystem.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter();

            state.Dependency = new NewSubscriptionsJob
                {
                    EntityHandle = this.entityHandle,
                    EffectTargetHandle = this.effectTargetHandle,
                    EffectDestroyHandle = this.effectDestroyHandle,
                    EffectMetaHandle = this.effectMetaHandle,
                    EffectSetupHandle = this.effectSetupHandle,
                    CommandBuffer = commandBuffer,
                    GlobalEntities = this.globalEntities,
                    SystemVersion = state.LastSystemVersion,
                }
                .ScheduleParallel(this.query, state.Dependency);
        }```
#

just in a regular ISystem

    [UpdateInGroup(typeof(EffectInitializeSystemGroup))]
    [UpdateAfter(typeof(EffectDestroySystem))]
    public partial struct EffectSetupSystem : ISystem, ISystemStartStop```