Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Question] How to use "await" / "async" in Tiny Unity ?

Discussion in 'Project Tiny' started by osamansr2o1oo, Mar 31, 2019.

  1. osamansr2o1oo

    osamansr2o1oo

    Joined:
    Sep 10, 2015
    Posts:
    9
    Using them without upgradnig from ES5 gives an error that I don't know how to handle!

    Error msg:
    An async function or method in ES5/ES3 requires the 'Promise' constructor.  Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.


    I tried adding "tsconfig.override.json" to the root of my Tiny Project (i.e. besides the .utproject file) with
    "target": "ES2017" OR "target": "ES6" but it didn't work, I also tried "lib": ["es2018", "dom"] and still nothing.

    By nothing I mean I get a whole punch of errors saying Array,string,number,... not defined

    example on what i write inside the tsconfig.override.json file
    Code (JavaScript):
    1. {
    2. "compilerOptions": {
    3. "target": "ES2017"
    4. }
    5. }
    Lastly, I saw some examples on the forums using them when I search before posting the thread, but it didn't help as they were answering other questions using them and not emphasizing on them!
    Thanks.