Search Unity

Blobarray vs Dynamic Buffer vs Fixed/Pointer Array

Discussion in 'Entity Component System' started by Stroustrup, Sep 28, 2020.

  1. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    What should you use if you want to store an array on an entity?
    I mostly use blobarray since it's more convenient to access compared to dynamic buffer

    also use (byte*) cast on fixed string64 to get a 8 byte long array that can be synced with [GhostField]
     
  2. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547
    BlobArray is for persistent data, It's expected to be used as Build once and readonly afterward.
    DynamicBuffer is well... Dynamic, user is free to add or remove or sort. or whatever you want.
    They are all pointer internally. pointer is raw, and you may crash your app by just one violent access.
     
    Last edited: Sep 30, 2020
    Ghat-Smith likes this.