Example #1
0
        public EntityWrapper AddElementToBuffer <T>(T element) where T : struct, IBufferElementData
        {
            var buffer = EntityManagerWrapper.GetOrCreateBuffer <T>(Entity);

            buffer.Add(element);
            return(this);
        }
Example #2
0
        public EntityWrapper ReplaceElementsInBuffer <T>(params T[] elements) where T : struct, IBufferElementData
        {
            if (Entity.Index < 0)
            {
                return(AddElementsToBuffer(elements));
            }

            var buffer = EntityManagerWrapper.GetOrCreateBuffer <T>(Entity);

            buffer.Clear();
            foreach (var element in elements)
            {
                buffer.Add(element);
            }
            return(this);
        }