Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to use NativeStream?

Discussion in 'Entity Component System' started by Mr-Mechanical, Dec 9, 2019.

  1. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    I've been checking out the source for Unity Physics and I see this new NativeStream NativeContainer... I am new to this container so I looking to understand how to use it.

    Thanks, input is appreciated.
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
  4. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    In the Collections package folder, under the tests folder there's a set of tests for NativeStream in NativeStreamTests.cs. It demonstrates usage. There's not really any proper documentation for it yet but the tests should make everything clear.

    As for what it's used for, from the package manual seems pretty clear:
    A deterministic data stream supporting parallel reading and parallel writing. Allows you to write different types or arrays into a single stream.

    You use it when you need to write then read data in parallel.
     
    frankfringe and MaxEden like this.