Search Unity

A collection of extensions, systems etc

Discussion in 'Entity Component System' started by tertle, Dec 30, 2018.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    I've posted a bunch of code over time and I finally got around to separating it out from my project into its own package that I can keep updated rather than having to post the actual source code

    https://github.com/tertle/com.bovinelabs.entities

    Install

    To add it to your own project, simply add it to your manifest.json like so

    Code (CSharp):
    1. "dependencies": {
    2.     "com.bovinelabs.entities": "https://github.com/tertle/com.bovinelabs.entities.git",
    3.     "com.unity.entities": "0.0.12-preview.21",
    4.     "com.unity.mathematics": "0.0.12-preview.19",
    5.     ...
    Or just pull the repo into [Project]/Packages/com.bovinelabs.entities/

    To update, delete the lock that'll appear in the manifest. I don't believe the unity package manager will detect updates at the moment.

    Notes

    I give no promises maintaining backwards compatibility when I make updates.
    Do with it what you will, you might find something of interest and use in it. Feel free to ask questions.
    There's no overall documentation at the moment but the actual source is generally documented.

    There's not a huge amount here at the moment but it's part of my main project and I intent to move code across as I get around to it and will be updated regularly. I do have some unit tests but it's not completely covered, they will come eventually. This is some of the stuff the repo currently contains.

    Systems
    Containers
    • NativeUnit<T> - Let's you effectively pass a 'reference' of a struct between jobs.
    Extensions
    • EntityManager - SetComponentObject(Entity, ComponentType, object)
    • World - AddManager for creating your own managers dynamically (dependency injection etc)
    • List<T> - AddRange(NativeArray), AddRange(NativeList), AddRange(DynamicBuffer), AddRange(NativeSlice), AddRange(void*, int), Resize(int), EnsureLength(int, T)
    • DynamicBuffer - Contains(T), IndexOf(T), Remove(T), Reverse(), ResizeInitialized(int), CopyTo(NativeArray<T>)
    • NativeList - Reverse(), Insert(T, int), Remove(T), RemoveAt(int), RemoveRange(int, int)
    These are designed to be fast with no allocations.
     
    Last edited: Dec 30, 2018
  2. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,940
    There should be a pinned topic of community resources including this one, so its easier to find such gems.
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    This is a bit dated as I moved my repos to gitlab and should probably get around to releasing my common library again, but I update it frequently at the moment and break stuff all the time.
    Most of it still probably works but some of it is a bit irrelevant as unity has added support (hashmap stuff).
     
    MNNoxMortem and jGate99 like this.