How can I add a DynamicBuffer to a SystemHandle?
The EntityManager has
public DynamicBuffer<T> AddBuffer<T>(Entity entity)
and
public DynamicBuffer<T> GetBuffer<T>(SystemHandle system, bool isReadOnly = false)
I haven’t found a way to add a DynamicBuffer to a SystemHandle.
funcku1117:
How can I add a DynamicBuffer to a SystemHandle?
The EntityManager has
public DynamicBuffer<T> AddBuffer<T>(Entity entity)
and
public DynamicBuffer<T> GetBuffer<T>(SystemHandle system, bool isReadOnly = false)
I haven’t found a way to add a DynamicBuffer to a SystemHandle.
https://docs.unity3d.com/Packages/com.unity.entities@1.3/api/Unity.Entities.EntityManager.AddComponent.html#Unity_Entities_EntityManager_AddComponent_Unity_Entities_SystemHandle_Unity_Entities_ComponentType_
Are you suggesting to use
EntityManager.AddComponent<DynamicBuffer<T>>(state.SystemHandle)
like this?
em.AddComponent(systemHandle, ComponentType.ReadWrite<BufferElement>());
Have a error: ArgumentException: Type BufferElement is an IBufferElementData type, however it has no fields and is thus invalid; this will waste chunk space for no benefit. If you want an empty component, consider using IComponentData instead.
funcku1117:
Have a error: ArgumentException: Type BufferElement is an IBufferElementData type, however it has no fields and is thus invalid; this will waste chunk space for no benefit. If you want an empty component, consider using IComponentData instead.
General user error. Makes no sense to have a buffer element type with no fields. Add something to it.