HashSet functionality for DynamicBuffer
The main idea is to create two buffers, the first for storing user elements, and the second for implementing a hash set.
Two buffers are created. One directly for the user elements and the second one is to implement a hash set functionality. The buffer with user elements is fixed in size, but the buffer for the hash set is not. Thus, the second buffer goes beyond the size of the first one and allows you to create chains of elements with the same hash key.
Add your dynamic buffer to entity
Implement IEqualityComparer interface for your dynamic buffer element
Add dynamic buffer to job system
Init hash set buffer handler
Use hash set functionality
You can add only one hash set buffer per entity.