Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[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.