Search Unity

UnityScript 2 CSharp conversion tool

Discussion in 'Experimental Scripting Previews' started by AdrianoVerona_Unity, Aug 11, 2017.

  1. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    [Edited]

    Thanks

    The problem is that the integration code is resolving the Unity installation folder to a wrong path:

    > Found assemblies root folder at '/Applications/Unity/PlaybackEngines/WebGLSupport/Variations/development/Data/Managed'

    but it should not resolve to that path (I've tested locally and the code looks correct). I checked on git and that code indeed had a bug but it was fixed in Aug/2017.

    Which version of the converter are you using? If you are not sure download the latest one and try again)

    As a workaround you may temporarily rename /Applications/Unity/PlaybackEngines/WebGLSupport/Variations/development/Data/Managed to something else (for instance you may add an _ in the name Managed. (you need to do this to all folders that follow the pattern Data/Managed inside the PlaybackEngines).

    [Edited 2]

    Actually there were a bug in the code that would cause that problem. I've fixed and released a new version of the converter (with some other fixes)

    Adriano
     
    Last edited: Jun 5, 2019
  2. lasco

    lasco

    Joined:
    Nov 12, 2009
    Posts:
    101
    Thank you so much Adriano

    Your workaround worked fine !!
     
    AdrianoVerona_Unity likes this.
  3. lasco

    lasco

    Joined:
    Nov 12, 2009
    Posts:
    101
    I'm really impressed. The converter worked pretty well, my js are all replaced by cs and even floating values are kept.

    Very good job !! Thanks !!
     
    AdrianoVerona_Unity likes this.
  4. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    293
    Hi Guys,
    I've just bumped into a project that uses boo, will this converter also support that?

    Cheers,

    Stefan
     
  5. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi, sorry, not without changes.

    That being said, depending on the amount of Boo code you have it may worth giving it a try. Basically you'd need to replace the UnityScript compiler with the Boo compiler. Since UnityScript compiler is based on the Boo compiler it may work with some changes.

    Adriano
     
  6. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    293
    Cool, I was hoping that it would be something along those lines. I'll review the codebase a little further to see if it's reasonably straight forward to do a manual conversion.

    Thanks for your quick reply!

    Stefan
     
  7. powpowbing

    powpowbing

    Joined:
    Mar 15, 2017
    Posts:
    3
    Hi,I have a problem for this tool on here.
    Can anybody help me?

    Thanks!
     
  8. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi @powpowbing

    In your post you sad that "But soon, the problem arose:" ; That is odd.

    Basically that message means the converter was running for more than 1 minute.

    Can you replace UnityScript2CSharp\Editor\UnityScript2CSharpRunner.cs (after importer the converter to your project) with this one?

    Basically it increases the time limit in line 193 (changing it from 60000 to 300000; this represents the amount of time, in ms, that we wait for the converter to finish; after that time we deem the process as being locked and kill it).

    If it still fails please send me your Editor.log

    Adriano
     
  9. powpowbing

    powpowbing

    Joined:
    Mar 15, 2017
    Posts:
    3
    Hi Adriano,
    When I replaced your updated script with the original script and ran it again, the whole transformation process went smoothly and I finally got the C# script I wanted.
    That's great!
    Thank you very much!
    powpowping
     
    AdrianoVerona_Unity likes this.
  10. RHare

    RHare

    Joined:
    Nov 20, 2018
    Posts:
    2
    Hello,
    I've been trying to convert a project with this program. The project seems to work fine and builds successfully, but when I try to convert it, I run into this error. I've tried running it within Unity and via the command line:

    Code (CSharp):
    1. UnityScript2CSharp was not able to convert your project:.
    2.  
    3. UnityScript2CSharp 1.0.7095.26335
    4. Converting 'Runtime' (126 scripts)
    5. Object reference not set to an instance of an object
    6. Consider running converter with '-i' option.
    7.  
    8. UnityEngine.Debug:LogError(Object)
    9. UnityScript2CSharpRunner:ShowConversionResultsInConsole(Int32) (at Assets/UnityScript2CSharp/Editor/UnityScript2CSharpRunner.cs:236)
    10. UnityScript2CSharpRunner:RunConverter(String) (at Assets/UnityScript2CSharp/Editor/UnityScript2CSharpRunner.cs:215)
    11. UnityScript2CSharpRunner:Convert() (at Assets/UnityScript2CSharp/Editor/UnityScript2CSharpRunner.cs:97)
    This may be an issue within the project itself, as I'm not too familiar with the project. I tried running it in unity 2017.4.30f1 and ran into the same error.

    I've attached the full editor.log file as well as the generated response file.
     

    Attached Files:

  11. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Hi. Based on your Editor.log the converter is hitting some issue while trying to collect information about the comments in your sources:

    You may try to change the integration code to add an extra command line argument (--SkipComments) to tell the converter to not try to preserve comments.

    Adriano
     
  12. RHare

    RHare

    Joined:
    Nov 20, 2018
    Posts:
    2
    Hi Adriano,

    That seems to have fixed the issue. Thanks!
     
    AdrianoVerona_Unity likes this.
  13. dadyjoon

    dadyjoon

    Joined:
    Jul 14, 2019
    Posts:
    1
    Hi Adriano
    is there any for 2019.1 version of unity?
     
  14. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    231
    Unfortunately no. We have removed UnityScript support completely in 2018.2.

    That being said, you may try running it from command line (as explained in the readme file: https://github.com/Unity-Technologies/unityscript2csharp/blob/master/readme.md) and pass the path of Unity 2019 installation, but there's no guarantee it will work.

    Adriano