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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

NativeSlice of a NativeList.AsArray() that resized before the NativeSlice was accessed?

Discussion in 'Entity Component System' started by Guedez, Mar 25, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    825
    Would a
    NativeSlice 
    created from
    NativeList.AsArray().Slice(from, total)
    before said
    NativeList
    resized would still be valid after the
    NativeList 
    resized?
     
  2. AnthonyReddan

    AnthonyReddan

    Joined:
    Feb 27, 2018
    Posts:
    39
    Bumping because I'm asking myself the same question right now.
     
  3. s_schoener

    s_schoener

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    81
    No, it will be invalid, and the safety system actually gives you an error about this.
     
    AnthonyReddan likes this.