Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request BlobArray without Explicit <T>

Discussion in 'Entity Component System' started by ShiftyCo, Feb 18, 2023.

  1. ShiftyCo

    ShiftyCo

    Joined:
    Nov 19, 2015
    Posts:
    3
    I want to create a BlobArray<BlobArray> where the internal blobArray can have a number of different types.
    However, BlobArrays require <T> information so I would have to do BlobArray<BlobArray<T>>, which prevents different types from being used.
    As far as I know, the only reason BlobArray requires <T> info is for correct sizing. A BlobArray without an explicit <T> but an input data size should therefore be sufficient to build a blob without error. And since the blob arrays themselves are pointers, there shouldn't be a size issue with the outer BlobArray.

    My current alternative is just to have an wrapper struct with a BlobArray for every possible allowable <T> type and then only allocate the one with the correct typing, which seems like overkill.