{"id":13663278,"url":"https://github.com/tertle/com.bovinelabs.entities","last_synced_at":"2025-04-25T13:32:39.762Z","repository":{"id":101060803,"uuid":"163400137","full_name":"tertle/com.bovinelabs.entities","owner":"tertle","description":"A collection of extensions, systems and jobs for Unity ECS.","archived":false,"fork":false,"pushed_at":"2019-09-04T03:00:17.000Z","size":94,"stargazers_count":126,"open_issues_count":2,"forks_count":8,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-10T19:35:02.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tertle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-12-28T10:55:27.000Z","updated_at":"2024-09-30T12:24:36.000Z","dependencies_parsed_at":"2023-07-11T05:15:35.574Z","dependency_job_id":null,"html_url":"https://github.com/tertle/com.bovinelabs.entities","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tertle%2Fcom.bovinelabs.entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tertle%2Fcom.bovinelabs.entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tertle%2Fcom.bovinelabs.entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tertle%2Fcom.bovinelabs.entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tertle","download_url":"https://codeload.github.com/tertle/com.bovinelabs.entities/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250825140,"owners_count":21493397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:02:23.234Z","updated_at":"2025-04-25T13:32:34.727Z","avatar_url":"https://github.com/tertle.png","language":"C#","funding_links":[],"categories":["C\\#","ECS"],"sub_categories":[],"readme":"# com.bovinelabs.entities\n\n## Systems\n### EntityEventSystem\nhttps://forum.unity.com/threads/batch-entitycommandbuffer.593569/\n\nEasily create lots of events extremely efficiently.\n\n#### How to use\n\nInstead of using a EntityCommandBuffer, we get a NativeQueue\u003cT\u003e from CreateEventQueue where T is IComponentData, the event data. \n```c#\nNativeQueue\u003cT\u003e EntityEventSystem.CreateEventQueue\u003cT\u003e(JobComponentSystem componentSystem)\n```\nIt is safe to pass this queue to Jobs, using ToConcurrent() for parallal jobs. Once you have this queue, to create an event simply create, set and add a new type of T to the queue and the EntityEventSystem will handle the rest for you.\n\nThe EntityEventSystem will batch create create entities for all these components and then set the component data.\n\n#### Things to know\n* Events live exactly 1 frame. They will be created in EntityEventSystem and 1 frame later destroyed in EntityEventSystem.\n* Use of event will be delayed till the next frame. EntityEventSystem executes just before EndFrameBarrier.\n* You can use CreateEventQueue for the same type from different systems or even multiple times from the same system.\n  * In the case of the same system, it's slightly faster to reuse the same queue if systems have correct dependencies.\n* The system calling CreateEventQueue passes a reference to itself to the EntityEventSystem and this is used to ensure dependencies are completed before EntityEventSystem is updated.\n\n#### CreateBufferEvent\n```c#\nvoid CreateBufferEvent\u003cT, TB\u003e(T component, NativeArray\u003cTB\u003e buffer)\n```\nWorks similar to CreateEventQueue except it will add a component T and BufferArray\u003cTB\u003e to the entity.\n \n**Note:** you do not need to worry about disposing the NativeArray\u003cTB\u003e as this will be done for you.\n\n## Containers\n* NativeUnit\u003cT\u003e - Let's you effectively pass a 'reference' of a struct between jobs.\n\n## Extensions\n* EntityManager - SetComponentObject(Entity, ComponentType, object)\n* World - AddManager for creating your own managers dynamically (dependency injection etc)\n* List\u003cT\u003e - AddRange(NativeArray), AddRange(NativeList), AddRange(DynamicBuffer), AddRange(NativeSlice), AddRange(void*, int), Resize(int), EnsureLength(int, T)\n* DynamicBuffer - Contains(T), IndexOf(T), Remove(T), Reverse(), ResizeInitialized(int), CopyTo(NativeArray\u003cT\u003e)\n* NativeList - Reverse(), Insert(T, int), Remove(T), RemoveAt(int), RemoveRange(int, int)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftertle%2Fcom.bovinelabs.entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftertle%2Fcom.bovinelabs.entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftertle%2Fcom.bovinelabs.entities/lists"}