Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to use System.IO.Stream in unity tiny wasm?

Discussion in 'Project Tiny' started by Thaina, Dec 30, 2019.

  1. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    398
    Try to build unity tiny with wasm throw this error

    error CS0234: The type or namespace name 'IO' does not exist in the namespace 'System' (are you missing an assembly reference?)​

    It seem like whole `System.IO` was exclude from wasm build, while it understandable for `File` and other low level API, `Stream` and related reader/writer should be accessible anywhere
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,504
    At the moment, nothing from System.IO is in the Tiny profile. We are taking the approach of including the absolute minimum at first, then trying to see what is necessary to add.

    Can you explain more about the use cases you have for code in System.IO? I'd like to better understand what we might need to add to support your use case.
     
  3. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    398
    It simply because many 3rd party library, especially what related to reading data such as parser, require `Stream` as its dependencies

    `Stream` is very basic component that people relying in their API

    Right now I am making DSL parser library and try to make it work in Tiny. Missing of `Stream` is blocking issue that cannot be avoided
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,504
    Can you provide details about which library you are trying to use? Do you know if it requires only System.IO.Stream (the abstract class), or does it use one of the classes derived from Stream?
     
  5. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    398
    If it was a sample library, I am trying to use this library at first

    https://github.com/grownith/jmespath.upm

    There was some API that use that base `Stream` for receiving any kind of stream. But there was also API that use `StringWriter` and `StringReader` which might use some kind of inherited stream underlyingly. And surerly there might also use `MemoryStream`

    Actually what I expect is, except native or hardware like `File` and `Port`. All other functionality in `System.IO` should be included. Because it was utilized as commonly as collection
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,504
    Thanks for the details. We will take a look at this and see what we can do.
     
    Thaina likes this.
  7. SINePrime

    SINePrime

    Joined:
    Jan 24, 2019
    Posts:
    31
    I'd like to add that Unity's low-level networking API (here) also depends on `System.IO` and `Stream`.

    Seems necessary to add these if Project Tiny is going to support networking.
     
  8. EdRowlett-Barbu

    EdRowlett-Barbu

    Joined:
    Mar 16, 2015
    Posts:
    88
    I think I also needed System.IO.Stream for using the SimpleJSON parser. I went through a lot of parser implementations online, all relying on System.IO.Stream. I ended up implementing System.IO.Stream myself in a rudimentary way, to get those libraries to compile., would have been nice to have it available in Tiny. JSON is essential for browser apps if you're communicating with a server API.
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,504
    Note that System.IO.Stream will be in the base class library for the 0.26 release of Project Tiny.
     
    tonialatalo, newguy123 and Thaina like this.
  10. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    398
    Really great news
     
  11. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    89
    We plan to have a lightweight JSON implementation for basic parse/write. Planned for this summer.
    It will come after the HTTP Client work completed. We are making good progress there and should be able to share a more precise landing schedule soon.
    Thanks for the feedback.
     
unityunity