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

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:
    317
    I think I've found one issue that should have been fixed but it looks like something went wrong and the fix was not included in the binaries

    Tomorrow morning (in ~15h from now) I'll generate a new version and double-check that the fix got included.

    Adriano
     
  2. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    64
    Hello, I'm trying to convert js scripts in Unity 2018.1.9 to c# and I get a lot of errors:



    UnityScript2CSharp was not able to convert your project:.

    Converting 'Runtime' (12 scripts)
    Conversion aborted due to compilation errors:

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\Blokjescript.js(3,1): BCE0055: Internal compiler error: Boo.Lang.Compiler.TypeSystem.Ambiguous.
    System.NotSupportedException: Boo.Lang.Compiler.TypeSystem.Ambiguous
    at Boo.Lang.Compiler.TypeSystem.EntityExtensions.DisplayName (Boo.Lang.Compiler.TypeSystem.IEntity entity) [0x00065] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.CompilerErrorFactory.DisplayStringFor (System.Object o) [0x00026] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at System.Array.ConvertAll[TInput,TOutput] (TInput[] array, System.Converter`2[TInput,TOutput] converter) [0x00029] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at Boo.Lang.Compiler.CompilerErrorFactory.Instantiate (System.String code, Boo.Lang.Compiler.Ast.LexicalInfo location, System.Object[] args) [0x00001] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.CompilerErrorFactory.Instantiate (System.String code, Boo.Lang.Compiler.Ast.Node anchor, System.Object[] args) [0x00008] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.CompilerErrorFactory.NotANamespace (Boo.Lang.Compiler.Ast.Node node, Boo.Lang.Compiler.TypeSystem.IEntity entity) [0x00001] in
    <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.Steps.ResolveImports.HandledAsImportError (Boo.Lang.Compiler.Ast.Import import, Boo.Lang.Compiler.TypeSystem.IEntity entity) [0x0002a] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.Steps.ResolveImports.OnImport (Boo.Lang.Compiler.Ast.Import import) [0x00030] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.Ast.Import.Accept (Boo.Lang.Compiler.Ast.IAstVisitor visitor) [0x00001] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.Ast.DepthFirstTransformer.OnNode (Boo.Lang.Compiler.Ast.Node node) [0x00001] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    at Boo.Lang.Compiler.Ast.DepthFirstTransformer.VisitNode (Boo.Lang.Compiler.Ast.Node node) [0x0001b] in <0b39fb63e6fb4fc59d63f4c8f1f98058>:0
    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\Blokjescript.js(5,16): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\Blokjescript.js(25,21): BCE0018: The name 'Vector3' does not denote a valid type ('not found'). Did you mean 'UnityEngine.Vector3'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(11,14): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(12,26): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(18,13): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(19,13): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(20,13): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?

    C:\Users\Nico\Documents\via unity 5.5 naar 2018\pipes connect - published - 2018.1.9\Assets\scripts\GameManager.js(22,17): BCE0018: The name 'GameObject' does not denote a valid type ('not found'). Did you mean 'UnityEngine.GameObject'?




    And this list goes on for a while. Do you maybe know a solution?

    Thanks
     
  3. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi.

    These errors are strange. Basically, the converter is failing to resolve some types which indicate that the correct namespaces were not imported but in that case, I'd expect you'd also get compilation errors in Editor.

    Can you run with Verbose logging enabled and share Editor.log ?

    Adriano
     
  4. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    64
    Thanks for your help :)

    There are indeed no compilation errors. I'm upgrading from Unity 4.7 to 2018, maybe there are some things broken in the project?

    I did Verbose Logging and here is the editor.log
     

    Attached Files:

  5. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi.

    If your project built successfuly then the converter should be able to convert it.

    Can you share your project with me so I can debug ? (you can upload your project somewhere and send me a private message with the link)

    If you want, after backing up your project, you can run this script (https://gist.github.com/adrianoc/240d51bdd27cee5e153f8f6b6f7b8e41) and it will remove all assets that are not required for investigating the issue (which will make your project much smaller).

    Best

    Adriano
     
  6. celaeno

    celaeno

    Joined:
    Jan 31, 2013
    Posts:
    64
    Hello,

    Excuse me for my late reaction.

    I appreciate your help, but at this moment I cannot really share the project. The project builds succesfully. I'm using 2DToolkit, will it maybe better convert if I remove 2DToolkit and instead use Unity3d sprites?

    Thank you.
     
  7. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    No problem

    Doesn't look like to me.

    In the log I can see:

    which indicates you are missing an import but that should also cause compilation errors in your project which you said to not happen...

    One thing you can do is try to invoke UnityScript2CSharp.exe manually

    basically use the command line reported in the log:

    but add -r parameter and list explicitly all assemblies your code is referencing but use C:\Program Files\Unity 2018.1.9f2\Editor\Data\Managed\UnityEngine.dll instead of C:\Program Files\Unity 2018.1.9f2\Editor \Data\Managed\UnityEngine\UnityEngine.dll (omitting any Unity*Module.dll also). It may have something to do.


    No problem. If you did not manage to get the conversion to work and consider sharing it, just drop a line and I'll try to find some time to investigate.

    Best
     
  8. Thejipppp

    Thejipppp

    Joined:
    Aug 17, 2015
    Posts:
    1
    Hi, I'm also kinda late here :p
    I wanted to work on a project I abandoned in 2015 (I think Unity 5.5, and I want to port it to the latest version, by passing through 2018.1.9 for the conversion)

    My editor.log file showing the crash (with verbose) beneath. I started using the Unity-tool.

    The error:

    NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.Compilation.Assembly.<get_allReferences>m__0 (UnityEditor.Compilation.Assembly a) [0x00001] in C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\CompilationPipeline.cs:44
    at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[UnityEditor.Compilation.Assembly,System.String].MoveNext () [0x00000] in <filename unknown>:0
    at System.Linq.Enumerable+<CreateConcatIterator>c__Iterator1`1[System.String].MoveNext () [0x00000] in <filename unknown>:0
    at System.Collections.Generic.List`1[System.String].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128
    at System.Collections.Generic.List`1[System.String]..ctor (IEnumerable`1 collection) [0x00025] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65
    at System.Linq.Enumerable.ToArray[String] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
    at UnityEditor.Compilation.Assembly.get_allReferences () [0x00034] in C:\buildslave\unity\build\Editor\Mono\Scripting\ScriptCompilation\CompilationPipeline.cs:44
    at UnityScript2CSharpRunner.ReferencesFromAssembly (UnityEditor.Compilation.Assembly a) [0x00002] in C:\Users\jespe\Desktop\projecten\Antigravity 2018\Antigravity\Assets\UnityScript2CSharp\Editor\UnityScript2CSharpRunner.cs:294
    at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[UnityEditor.Compilation.Assembly,System.String].MoveNext () [0x00000] in <filename unknown>:0
    at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[System.String].MoveNext () [0x00000] in <filename unknown>:0
    at System.Linq.Enumerable+<CreateDistinctIterator>c__Iterator3`1[System.String].MoveNext () [0x00000] in <filename unknown>:0
    at UnityScript2CSharpRunner.ComputeConverterCommandLineArguments (Boolean verboseLogging) [0x0010a] in C:\Users\jespe\Desktop\projecten\Antigravity 2018\Antigravity\Assets\UnityScript2CSharp\Editor\UnityScript2CSharpRunner.cs:268
    at UnityScript2CSharpRunner.RunConverter (System.String converterPath) [0x00096] in C:\Users\jespe\Desktop\projecten\Antigravity 2018\Antigravity\Assets\UnityScript2CSharp\Editor\UnityScript2CSharpRunner.cs:180
    at UnityScript2CSharpRunner.Convert () [0x00084] in C:\Users\jespe\Desktop\projecten\Antigravity 2018\Antigravity\Assets\UnityScript2CSharp\Editor\UnityScript2CSharpRunner.cs:97

    (Filename: /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs Line: 128)


    (I'm a software dev myself and I really feel sorry that you have to fix backwards compatibility problems that drag on for like 3? years :p )

    Any idea what would cause this?

    UPDATE: added output of cmd

    UPDATE: I think it succeeded with this line
    UnityScript2CSharp.exe -p "C:\Users\jespe\Desktop\projecten\Antigravity 2018\Antigravity" -u "D:\Program Files\Unity\2020.2.7f1\Editor" -v -r "D:\Program Files\Unity\2020.2.7f1\Editor\Data\UnityExtensions\Unity\GUISystem\Standalone\UnityEngine.UI.dll"
    I'll leave my comment for if anyone else ever has the same problem I guess :p
     

    Attached Files:

    Last edited: Mar 7, 2021
    AdrianoVerona_Unity likes this.
  9. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
    If anyone who used this is sick of the horrible for-loop-to-while mess it made, I have made a VS extension that can reliably convert them to for loops (yes, I should have fixed the converter, but that's in the past). Let me know if you're interested and I'll publish it.
     
  10. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Hi, I'm struggling to use the conversion tool which is throwing 78 errors. It seems to be struggling on our coding structure for example:

    BCE0018: The name 'WWWPHP.Response' does not denote a valid type ('not found')

    In relation to the following line:

    Code (JavaScript):
    1. function onLoad(response : WWWPHP.Response)
    Where WWWPHP is a class we defined in a separate script entitled WWWPHP.js and response is a class within that:

    Code (JavaScript):
    1. public class WWWPHP extends MonoBehaviour{
    2.         public class Response {
    3.         public var data:String;
    4.         public var status:State;            
    5.     }
    6.     public enum State {Timeout, Fail, PHPError, PHPSuccess}
    7. }
    Is there some way of rewriting this in a way that the tool will be able to parse?


    ----------------- Update --------------------------
    I managed to move past this by ditching the Response class and passing a String[] instead then parsing the values, bit of work but managable, seems like you need to use types that Unity recognizes.
    ----------------- Update -------------------------
    It converted this to:
    Code (CSharp):
    1. [System.Serializable]
    2. public static final abstract partial class WWWPHP : MonoBehaviour
    3. {
    Not the easiest thing to work with!

    ---------------- Update --------------------------
    After fixing the initial 152 compile errors it started compiling and I thought I had done it. After a bit of lag it woke up to 999+ fresh compile errors. Trouble is I've got another project that's even more vast written in JS. Not sure if it's possible to do this, I'll keep plodding on a bit longer. How far can one update Unity if they only use it to build and do all the new script creation in Unity 2017?
     
    Last edited: May 4, 2021
  11. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Hi,

    I'm stuck with some difficult compile errors over code that worked fine in Javascript and hasn't made it through the conversion.
    We were using co-routines to send a message from the client to the server, and the server should return a callback "onMessage" with the response. However, where we now call the function PHP.SendRequest() we get the following two compile errors:

    Code (CSharp):
    1. this.StartCoroutine(PHP.SendRequest(APP_URL + "message.php", form, this.onMessage, Config.TIMEOUT));
    1. error CS1502: The best overloaded method match for
    `PHP.SendRequest(string, UnityEngine.WWWForm, System.Delegate,
    uint)' has some invalid arguments
    2. error CS1503: Argument #3 cannot convert 'method group' expression
    to type 'System.Delegate'


    The problem seems to be the callback function 'this.onMessage' casting to System.Delegate, indeed if I replace it with 'null' in the call it compiles. I don't know how to declare it correctly in C#, in our Javascript implementation it was passed to PHP.SendRequest as type : Function

    The converter has declared the callback function like this:
    public virtual void onMessage(string[] response)
    {}

    If I change virtual void to delegate as per some of the guides it complains, if I keep it as it is and try to cast it by putting (System.Delegate)this.onMessage before the call it says:

    Cannot convert method group `onMessage' to non-delegate type `System.Delegate'. Consider using parentheses to invoke the method.

    If I add () to the end of this.onMessage() I get the error:

    error CS1501: No overload for method `onMessage' takes `0'
    arguments


    Really new to C# and in deep water so any help here would be tremendously welcome.
     
  12. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi.

    1. Which verison of Unity are you using?
    2. Is the class PHP converted also? Or it is defined in some assembly?
    3 if it has been converted can you shouw the original version of the SendRequest method ?
    4. Please, show the original version (JS) of the offending line (the StartCoroutine call)
    5. Please show the original (JS) version of onMessage (only the signature is enough)

    That being said keep in mind that we are not actively working in the converter anymore (anyway, I'll try to help as much as I can).
     
  13. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Hi Adriano thanks so much for helping the behaviour is baffling. The WWWPHP class was written by a colleague who's no longer with us and I kind of depended on being able to just call it without needing to understand it for the rest of the game logic.

    Originally we did it like this:

    Press a button in any .js script to call the server:
    Code (JavaScript):
    1.  
    2. WWWPHP.SendRequest(APP_URL+"message.php", form, onMessage, TIMEOUT);
    3.  
    a script in the project called WWWPHP.js contains the following:
    Code (JavaScript):
    1.  
    2. public class WWWPHP extends MonoBehaviour{
    3.  
    4.     public static function SendRequest(url:String, form:WWWForm, responseCallback:Function, timeoutSec:uint) {
    5.         return Instance()._Send(url, form, responseCallback, timeoutSec);
    6.     }
    7.  
    8.     private function _Send(url:String, form:WWWForm, responseCallback:Function, timeoutSec:uint) {              
    9.         // create request
    10.         var request:Request = new Request();                              
    11.         // add session id to request
    12.         if (PropagateUrlSession) {
    13.             if (form == null)
    14.                 form = new WWWForm();
    15.             form.AddField(SessionName, SessionId);
    16.         }    
    17.         request.www = (form == null) ? new WWW(url) : new WWW(url, form); //yuk                              
    18.         //set timer
    19.         if (timeoutSec)
    20.             _Timeout(request, timeoutSec);          
    21.         //wait for request
    22.         yield request.www ;          
    23.         //create response
    24.         var response:Response = new Response();      
    25.         if (request.www == null) {          
    26.             //timeout          
    27.             response.data ="Request timed out";          
    28.             response.status = State.Timeout;      
    29.          
    30.         } else if (!String.IsNullOrEmpty(request.www.error)) {
    31.             //fail          
    32.             response.data = request.www.error;
    33.             response.status = State.Fail;
    34.          
    35.         } else {
    36.             //got response
    37.          
    38.             var data:String[] = ["",""];      
    39.          
    40.             if (!_ParsePHPResponse(request.www.text, data)) {
    41.                 //failed parsing ERROR/SUCCESS msg
    42.                 response.status = State.Fail;
    43.                 response.data = "Unexpected response from php";
    44.             } else {
    45.                 //successfully parsed ERROR/SUCCESS msg
    46.                 response.status = (data[0] == "SUCCESS" ? State.PHPSuccess : State.PHPError);
    47.                 response.data = data[1];              
    48.             }
    49.         }
    50.         //run callback with response
    51.         if (responseCallback != null) {
    52.             responseCallback(response);
    53.         }      
    54.         request.Destroy();
    55.     }
    56.  
    The process would ultimately end up firing a callback to this function where we parse the response and update the client:

    Code (JavaScript):
    1.  
    2. function onMessage(response:String[])
    3. // callback from php
    4. {}
    5.  

    I'm just trying to get through the remaining 390 compiler errors at this point. All of the .js files appear to have C# counterparts now and the js files are renamed to js.old so I think it successfully completed the conversion.

    The error I get when I try to rename the callback function to:

    Code (CSharp):
    1.     public delegate void onMessage(string[] response)
    2.     {
    Is as follows:

    Parser Error: The Type (name of script/class) already contains a definition for onMessage.

    Online, people are suggesting I need to delete and rebuild it but nothing works :( Is this the correct way to declare / cast a callback like we're trying to do in C#?

    Using Unity 2018.1.9f, Updated from 2017.4.35f
     
    Last edited: May 5, 2021
  14. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Indeed, I am almost certain that the conversion has finished successfully

    It looks like to me that this code is relying on some magic from UnityScript that I've never seen :(

    In like 52 of _Send() method the callback is invoked if a Response object but the callback expects an array of strings
    :
    Code (JavaScript):
    1. responseCallback(response);
    Are you sure you need this callback? If not, can you log the conents of the array inside the callback and run this code (UnityScript version) and see what gets logged?

    adding delegate here is not valid.

    My best bet is that onMessage is overloaded.
     
  15. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Hi Adriano, very sorry I forgot that I had to rewrite the response class to use an array of strings as the converter didn't like it (see previous post - type not found). In order to run the conversion tool I had to use an array of strings, so the response part of that code is out of date. If you still want to see the correct one let me know, my apologies.

    Just to clarify, would you like me to load the unityscript version and run this code and dump the contents of the string[] array here with some values populated by the actual server?

    We definitely need the ability to callback from php as that's where we materially update the client.
     
  16. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    You mentioned onMessage might be overloaded, I don't know how relevant this is but I tried renaming it to something completely unique and nothing changes (at least in terms of the error I got when adding delegate as described).

    Is there some way of casting the callback differently when we pass it to SendRequest() that can be syntactically correct?
     
  17. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    it is relevant because the C# compiler will emit that error in that scenatio :)
    You can try it here https://bit.ly/3eZnbqE (just comment one of the Do3 overloads and the error goes alway)

    you can't add delegate in that declaration (it is not valid C# syntax)

    Nothing to be sorry. I should have paied more attention to the other messages :)

    So you are passing data to the callback as bellow?:

    Code (JavaScript):
    1. responseCallback(data);
    if so, your OnMessage method in C# should look like:


    Code (CSharp):
    1. // no delegate
    2. public void onMessage(string[] response)
    3. {
    4. }
    and you should have only one OnMessage defined on your type (but I am not sure there's no OnMessage method in MonoBehaviour or one of its base classes).

    If you rename it to something else (lets say OnMessage1234) and also change that in the generated call:

    Code (CSharp):
    1.     this.StartCoroutine(PHP.SendRequest(APP_URL + "message.php", form, this.onMessage1234, Config.TIMEOUT));
    2.  
    it should work.

    That all being said, I'd say that probaly it would be better to understand why the converter is failling to find the Response type. One thing you can try is to move it to a top level type (instead of an inner type), rename it (to make sure you don't get any name clashes) and see if the converter picks it up.

    Adriano
     
  18. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Thanks Adriano, if it's a showstopper we try rerunning the converter but I put about 16 hours in yesterday to compiler bugs think I managed to get about 6000 or so down to 390 so feels like we're close. Apart from this it's just arrays and stuff which I can do with time.

    The "correct" version of WWWPHP class with the string[] approach is as follows, this is the one that actually got converted, and yes the response string[] does get passed to the callback.

    Code (JavaScript):
    1.    
    2. static var DATA   : int = 0;       // index of php response's data field (messages returned from server)
    3. static var STATUS : int = 1;    // index of Php Response's status field (fail/timeout/error/success)
    4. static var STATUS_TIMEOUT : String = "0";
    5. static var STATUS_ERROR   : String = "1";
    6. static var STATUS_FAIL    : String = "2";
    7. static var STATUS_SUCCESS : String = "3";
    8.  
    9. public static class WWWPHP extends MonoBehaviour{
    10.  
    11.     public static function SendRequest(url:String, form:WWWForm, responseCallback:Function, timeoutSec:uint) {
    12.         return Instance()._Send(url, form, responseCallback, timeoutSec);
    13.     }
    14.  
    15. private function _Send(url:String, form:WWWForm, responseCallback:Function, timeoutSec:uint) {              
    16.         // create request
    17.         var request:Request = new Request();                              
    18.         // add session id to request
    19.         if (PropagateUrlSession) {
    20.             if (form == null)
    21.                 form = new WWWForm();
    22.             form.AddField(SessionName, SessionId);
    23.         }    
    24.  
    25.         request.www = (form == null) ? new WWW(url) : new WWW(url, form); //yuk                              
    26.  
    27.         //set timer
    28.         if (timeoutSec)
    29.             _Timeout(request, timeoutSec);          
    30.  
    31.         //wait for request
    32.         yield request.www ;          
    33.  
    34.         //create response
    35.         var response : String[] = new String[2];      
    36.         if (request.www == null) {          
    37.             //timeout          
    38.             response[DATA]   = "Request timed out";          
    39.             response[STATUS] = STATUS_TIMEOUT;
    40.            
    41.         } else if (!String.IsNullOrEmpty(request.www.error)) {
    42.             //fail          
    43.             response[DATA] = request.www.error;
    44.             response[STATUS] = STATUS_FAIL;
    45.                      
    46.         } else {
    47.             //got response
    48.             var data:String[] = ["",""];      
    49.            
    50.             if (!_ParsePHPResponse(request.www.text, data)) {
    51.                 //failed parsing ERROR/SUCCESS msg
    52.                 response[STATUS] = STATUS_FAIL;
    53.                 response[DATA] = "Unexpected response from php";
    54.             } else {
    55.                 //successfully parsed ERROR/SUCCESS msg
    56.                 response[STATUS] = (data[0] == "SUCCESS" ? STATUS_SUCCESS : STATUS_ERROR);
    57.                 response[DATA] = data[1];              
    58.             }
    59.         }
    60.         //run callback with response
    61.         if (responseCallback != null) {
    62.             responseCallback(response);
    63.         }      
    64.         request.Destroy();
    65.     }    
    66.  
    67.  
    I've tried renaming onMessage (both the callback and the line which calls it) to onMessageHello and I'm getting the same errors so no luck :( I also tried removing the 'virtual' so that it became simply 'public void' and nothing.

    This is the copied and pasted callback:

    Code (CSharp):
    1.     public void onMessage(string[] response)
    2.     {
    The only other place I can think might technically have copies of these namespaces are in the js.old files as I have checked the find-in-files and can assure they are 100% unique, is there any chance they could be interfering?
     
  19. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    if it helps this is the full C# structure of what's going on in WWWPHP.cs post conversion:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. [System.Serializable]
    4. public class WWWPHP : MonoBehaviour
    5. {
    6.     // session name for propagating php session via url (can also use SetSession())
    7.     public static string SessionName;
    8.     // session id for propagating php session via url (can also use SetSession())
    9.     public static string SessionId;
    10.     // propagating php session via url set SessionId/SessionName before setting (can also use SetSession())
    11.     public static bool PropagateUrlSession;
    12.  
    13.     private static object instance;
    14.     // represents a request to the php server
    15.     [System.Serializable]
    16.     public class Request : object
    17.     {
    18.         public WWW www;
    19.         public virtual void Destroy()
    20.         {
    21.             if (!(this.www == null))
    22.             {
    23.                 this.www.Dispose();
    24.                 this.www = null;
    25.             }
    26.         }
    27.  
    28.     }
    29.  
    30.     public static IEnumerator SendRequest(string url, WWWForm form, System.Delegate responseCallback, System.UInt32 timeoutSec)
    31.     {
    32.         return WWWPHP._Send(url, form, responseCallback, timeoutSec);
    33.     }
    34.  
    35.     // set the session name and id usually passed back from the php server on login
    36.     // used for propagating php session via url
    37.     public static void SetSession(string sessionName, string sessionId)
    38.     {
    39.         WWWPHP.PropagateUrlSession = true;
    40.         WWWPHP.SessionName = sessionName;
    41.         WWWPHP.SessionId = sessionId;
    42.     }
    43.  
    44.     // private
    45.     private static WWWPHP Instance()
    46.     {
    47.         if (WWWPHP.instance == null)
    48.         {
    49.             GameObject go = new GameObject("WWWPHPGameObject");
    50.             WWWPHP.instance = (WWWPHP) go.AddComponent(typeof(WWWPHP));
    51.             UnityEngine.Object.DontDestroyOnLoad(go);
    52.         }
    53.         return WWWPHP.instance as WWWPHP;
    54.     }
    55.  
    56.     private static IEnumerator _Send(string url, WWWForm form, System.Delegate responseCallback, System.UInt32 timeoutSec)
    57.     {
    58.         // create request
    59.         WWWPHP.Request request = new Request();
    60.         // add session id to request
    61.         if (WWWPHP.PropagateUrlSession)
    62.         {
    63.             if (form == null)
    64.             {
    65.                 form = new WWWForm();
    66.             }
    67.             form.AddField(WWWPHP.SessionName, WWWPHP.SessionId);
    68.         }
    69.      
    70.         request.www = form == null ? new WWW(url) : new WWW(url, form); //yuk                              
    71.         //set timer
    72.         if (timeoutSec != 0)
    73.         {
    74.             WWWPHP._Timeout(request, timeoutSec);
    75.         }
    76.         //wait for request
    77.         yield return request.www;
    78.         //create response
    79.         string[] response = new string[2];
    80.         if (request.www == null)
    81.         {
    82.             //timeout          
    83.             response[WWWPHP.DATA] = "Request timed out";
    84.             response[WWWPHP.STATUS] = WWWPHP.STATUS_TIMEOUT;
    85.         }
    86.         else
    87.         {
    88.             //      
    89.             if (!string.IsNullOrEmpty(request.www.error))
    90.             {
    91.                 //fail          
    92.                 response[WWWPHP.DATA] = request.www.error;
    93.                 response[WWWPHP.STATUS] = WWWPHP.STATUS_FAIL;
    94.             }
    95.             else
    96.             {
    97.                 //      
    98.                 //got response
    99.                 //      
    100.                 string[] data = new string[] {"", ""};
    101.                 if (!WWWPHP._ParsePHPResponse(request.www.text, data))
    102.                 {
    103.                     //failed parsing ERROR/SUCCESS msg
    104.                     response[WWWPHP.STATUS] = WWWPHP.STATUS_FAIL;
    105.                     response[WWWPHP.DATA] = "Unexpected response from php";
    106.                 }
    107.                 else
    108.                 {
    109.                     //successfully parsed ERROR/SUCCESS msg
    110.                     response[WWWPHP.STATUS] = data[0] == "SUCCESS" ? WWWPHP.STATUS_SUCCESS : WWWPHP.STATUS_ERROR;
    111.                     response[WWWPHP.DATA] = data[1];
    112.                 }
    113.             }
    114.         }
    115.         //run callback with response
    116.         if (!(responseCallback == null))
    117.         {
    118.             responseCallback.DynamicInvoke(new object[] {response});
    119.         }
    120.         request.Destroy();
    121.     }
    122.  
    123.     private static IEnumerator _Timeout(WWWPHP.Request request, System.UInt32 timeoutSec)
    124.     {
    125.         yield return new WaitForSeconds(timeoutSec);
    126.         request.Destroy();
    127.     }
    128.  
    129.     private static bool _ParsePHPResponse(string response, string[] data)
    130.     {
    131.         int n = response.IndexOf(":");
    132.         if (n != -1)
    133.         {
    134.             data[0] = response.Substring(0, n);
    135.             data[1] = response.Substring(n + 1);
    136.         }
    137.         return (data[0] == "SUCCESS") || (data[0] == "ERROR");
    138.     }
    139.  
    140.     public static int DATA;
    141.     public static int STATUS;
    142.     public static string STATUS_TIMEOUT;
    143.     public static string STATUS_ERROR;
    144.     public static string STATUS_FAIL;
    145.     public static string STATUS_SUCCESS;
    146.     public static int NONE;
    147.     public static int clientTimeOut; // moment when the client times out if nothing comes back from the server
    148.     static WWWPHP()
    149.     {
    150.         WWWPHP.SessionName = "PHPSESSID";
    151.         WWWPHP.STATUS = 1;
    152.         WWWPHP.STATUS_TIMEOUT = "0";
    153.         WWWPHP.STATUS_ERROR = "1";
    154.         WWWPHP.STATUS_FAIL = "2";
    155.         WWWPHP.STATUS_SUCCESS = "3";
    156.         WWWPHP.NONE = -1;
    157.         WWWPHP.clientTimeOut = WWWPHP.NONE;
    158.     }
    159.  
    160. }

    Here's an example of how it's being called, for instance upon pressing a button:

    Code (CSharp):
    1.     public virtual void onAcceptDecline(bool accept, string friendName)
    2.     {
    3.         // accept or decline a friend in database
    4.         WWWForm form = new WWWForm();
    5.         form.AddField("usernameFriend", friendName);
    6.         form.AddField("op", accept ? "accept" : "decline");
    7.         this.StartCoroutine(WWWPHP.SendRequest(Config.APP_BASE_URL + "update-friend.php", form, this.onUpdateFriend, Config.LOAD_FRIEND_DATA_TIMEOUT_SEC));
    8.     }
    here's (just the first line) of the callback:

    Code (CSharp):
    1.     public virtual void onUpdateFriend(string[] response)
    2.     {
    And both onUpdateFriend() and onAcceptDecline() exist in the following namespace of a script entitled ModalDialogs.cs

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. [System.Serializable]
    4. public partial class ModalDialogs : MonoBehaviour
    5. {
    6.  
    7. }
    8.  
     
  20. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    It does help (I'd ask for it :) )

    Let me take a look and get back to you.
     
    cheesemaster likes this.
  21. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    I dunno.

    Based on the source code you have posted above, you can do the following changes:

    Code (CSharp):
    1.    public static IEnumerator SendRequest(string url, WWWForm form, System.Action<string[]> responseCallback, System.UInt32 timeoutSec)
    2.     {
    Code (CSharp):
    1.  private static IEnumerator _Send(string url, WWWForm form, System.Action<string[]> responseCallback, System.UInt32 timeoutSec)
    2.    
    Code (CSharp):
    1. responseCallback(response);
    basically, changing from System.Delegate to System.Action<string[]> and fixing the callback invocation accordingly.

    This should work
     
  22. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Perfect thank you for the kind help, I'll try this after dinner and let you know.
     
  23. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Good lord it worked, 390 -> 316 compiler errors! So happy, the rest look manageable, I'll never forget the power of System.Action<>. Thanks for everything.
     
    AdrianoVerona_Unity likes this.
  24. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Good to know it fixed some compiler errors, but keep in mind that compiling is just your first step.

    My suggestion (if you are not already doing it) is to commit every step (changes you introduce to the converted code to fix issues) so you can revisit history if you get runtime errors.

    Adriano
     
  25. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Thanks Adriano,

    We're down to 130 or so remaining so getting there.. It's a huge undertaking this, the project is about 50,000 lines of code just on the client and really you need about 100 playtime hours to experience it all in one of the many combinations of ways it can be played. If we get this to work my other project is even more nightmarish. I estimate the total number of compile errors to have been about 6000 initially so maybe too much to comment. I was quite lazy doing things like:

    if (true)
    { var i : int = 0;}
    else
    { i = 0;}

    Which was at least half of the errors, obviously in C# you need to declare the i at a higher level. Guessing it's too much work to sort that out at the level of the converter. Other thing it has done is remove a lot of breaks in my switch statements but not sure why, sometimes it does it sometimes it doesn't.

    I'm liking how fussy C# is about type casting everything to be honest and have noticed a few errors that were in the JS which I would not have been aware of otherwise. It's also forcing me to use built-in arrays for everything so expecting a performance boost which is a bonus.

    Let's just hope we can do this, wonder how many others have put this off till now for the work involved. Now we've got no choice as Google are requiring us to support API 30 and we can't figure out how to do all of that in Android Studio in a way that doesn't screw up all our plugins and such.
     
  26. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    I don't have a number, but I am sure other devs managed to convert their code using this tool.

    The amount of work required post conversion depend a lot on how your code is structured

    Just let me know if you hit other issues
     
    Last edited: May 12, 2021
  27. cheesemaster

    cheesemaster

    Joined:
    Sep 4, 2012
    Posts:
    38
    Hi, just writing to say that people shouldn't be put off converting based on my complaints, in the end I've been literally stunned how stable the entire project is at runtime despite all the changes, probably there were no more than 20 or so runtime errors to fix in order to experience the first 90% of the project. Working on the remaining pesties now. Don't think I could have done it without Adriano's expertise on System.Action<> though. If I can do it anyone can. C# is a nice language.
     
  28. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I don't know if my problem is a conversion issue or not, but that seems to be the lowest common denominator, and I've not been able to find anything else.

    I updated several older projects to Unity 2020, and now some of them have a problem with sound in WebGL. Some were updated from Unity 2018, and also translated from UnityScript to C# at the same time. Others were updated from 2018 and 2019, but were originally written in C#. They were just updated, not translated. All of the translated apps have the problem, the ones written in C# are OK.

    The problem is repeating sounds. Sounds repeat several times, lower in volume each time, like an echo. It doesn't happen all the time. Typically, the first few times a sound plays, it plays just once, as it should. But after a few times, the sound repeats every time it plays after that. The same thing happens with every sound in every translated app. Eventually, they all start repeating.

    The other odd thing is that this happens for only one of our users. They have the problem in Safari 14.1.1 on macOS 11.4. Their JS console does not show any errors when the problem pages load (just the usual requestAnimationFrame error). This user does not have the problem in Chrome or Firefox on the same machine. I can't reproduce this in macOS 10.14 on my machine, either in the Editor or in Safari. We only have a few people testing right now, but no one else can reproduce the problem in any Mac or Windows browser. Another user with the same Safari/macOS combination does not have the problem.

    I have no idea what could cause such a problem. I know the US-C# conversion tool translated some things in a way that I wouldn't have (like changing all For loops to While loops???), so I'm wondering if something else in the translation process might be the source of the problem. In this case though, Play() is translated correctly, and the AudioSource loads and has correct settings. That's about all there is to playing a sound.

    Could this have something to do with the US-C# conversion? Why does it only affect one user? Any suggestions on where to look?
     
    Last edited: Jun 13, 2021
  29. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi

    This has to do with how for/while loops are represented at AST level in UnityScript; Basically both loops are represented by a single (while) AST node so it is hard (if not impossible) to distinguish one from the other.

    It is really hard to say. It may be the case that after the conversion a coroutine is running multiple times or something like that. Or that the converted code has timing issues (like race conditions).

    Most likely due to its specific configuration; maybe he/she has a faster than average machine and that is causing timing problems?

    If you cannot reproduce it locally, you can generate a custom build with extra debug (Debug.Log()) in the code to help you figure it out (for instance, if you add a Debug.Log() in the code that plays the sound, it would be easy to spot multiple invocations of that code)

    Best

    Adriano
     
  30. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've learned a bit more about this problem, when it happens and doesn't happen.

    PROBLEM:
    • MacBook Air, 13-inch, 2020, macOS 11.4, Safari
    • iMac 2020, Safari 14.1.1/macOS 10.15.7 (a user posting in another thread having a similar problem, NOT my apps)

    NO PROBLEM:
    • MacBook Air, 13-inch, 2020, macOS 11.4, Firefox, Chrome
    • MacBook Air, 13-inch, early 2015, macOS 11.4, Safari, Firefox
    • iMac, Retina 5K, late 2015, macOS 10.14, Safari, Firefox, Unity Editor
    • All Windows browsers tested
    • All projects NOT converted from UnityScript

    We only have a few people testing the updates. This was supposed to be the kind of update users should not even notice happened.

    I did as you suggested, in one of the affected apps, I output to the console when a sound is played. On the problem machine, in the problem browser, all sounds played the proper number of times. That is, when a sound was repeating, the console output showed that it was played only once. That suggests to me that it's not a stuck coroutine or timing issues.

    I don't know where to go from here. I don't really see how the US-C# conversion could be the cause, but it's only those apps that have the problem. And if it's a Safari problem, I don't know what I could do about it. Sooner or later though, the updates must be completed and made available to our users.
     
  31. Sisso

    Sisso

    Joined:
    Sep 29, 2009
    Posts:
    196
    Hi there,

    I am trying to convert a old project and I am having a tons of errors caused by inner types. For instance on this class

    Code (JavaScript):
    1.  
    2. #pragma strict
    3.  
    4. import System.Collections.Generic;
    5.  
    6. /**
    7.    This must be reseted when a new start. But because there is no
    8.    score rule for arcade, it is not implemented.
    9. */
    10. class ScoreManager extends MonoBehaviour {
    11.    static var instance: ScoreManager;
    12.  
    13.    class Score {
    14.        var stars: int = 0;
    15.        var loseHero = false;
    16.        var buildingDamaged = false;
    17.        var acquiredItems = new List.<GameObject>();
    18.        var acquiredFame = 0;
    19.        var nextItem: GameObject;
    20.    }
    21. .
    22. .
    23. .
    24.  
    I will have many errors like:

    Code (CSharp):
    1. .../Assets/Scripts/Gui/ShowInfoPopup.js(23,17): BCE0018: The name 'ShowInfoPaper.Params' does not denote a valid type ('not found').
    2.  
    The workaround is to move the inner types to new C# classes in Plugin.

    It is some limitation of the tool? Feature request? Or maybe some problem in my project?
     
  32. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi. The converter does have some tests for nested types, so I'd expect it to work.

    Can you please:

    1. make sure you are converting with latest 2018.1.x available (as of today, 2018.1.9)
    2. run the conversion again with verbose logging and send me your Editor.log ?

    Best
     
  33. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    Must I use unity2018.1. X for conversion?
     
  34. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    I encountered a compilation error using unity2017.4.40, but my engineer compiled it
     
  35. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    I encountered the same problem. How did you deal with it
     
  36. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    After reading this post for a long time, I finally succeeded in the conversion, but as the previous user said, all c# files that have been successfully converted are empty classes and have nothing left. I used the -- skipcomments - I instruction and modified allreference. What else do I need to do to successfully convert? Please reply. Thank you. It's important to me
     
  37. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    My suggestion is to use latest 2018.1.x available.

    I am currently on vacation; should be able to take a look when I get back and catch up with a ton of other stuff :)

    Keep in mind that the converter is not supported anymore so I don't know how much bandwidth I'll have to help.

    Anyway, as a first step can you install latest 2018.1.x version and run the converter:
    1. Inside the editor, not through the command line
    2. make sure you enable Verbose Log
    3. Send me the contents of your Editor.log and the file pointed by --responseFile command line argument (you can find that path in the Editor.log)
    Best

    Adriano
     
  38. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    Hi

    I know that you may no longer support the converter, so I thank you very much for your reply. You can reply to me in your spare time. Thank you again.

    I used unity2018.19 for conversion. I put the files you need in this reply..

    I wish you every success in your work
     

    Attached Files:

    • Temp.rar
      File size:
      74.9 KB
      Views:
      277
  39. wjld1314

    wjld1314

    Joined:
    Jun 28, 2021
    Posts:
    6
    Editor log
     

    Attached Files:

  40. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    FYI: I see the translator doesn't seem to know what to do with parseInt and parseFloat. This:
    Code (JavaScript):
    1. parseFloat(tStr)
    gets translated to this:
    Code (CSharp):
    1. UnityScript.Lang.UnityBuiltins.parseFloat(tStr)
    Which doesn't work in 2019 or later. It should get translated to this:
    Code (CSharp):
    1. float.Parse(tStr)
     
    AdrianoVerona_Unity likes this.
  41. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    @wjld1314 I've looked into your logs and it looks like the converter is getting invalid information.

    If you look in the Editor.log you posted, you'll find something like:

    and that implies that the converter is getting assembly paths instead of a list of defined symbols (like UNITY_EDITOR, etc).

    Are you using the Unity Package and doing the conversion through the Editor?

    By the way, you have not attached the response file (you attached the Editor.log twice).

    Could you try it again?

    Best

    Adriano
     
    nekoneko777 likes this.
  42. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Last edited: Aug 23, 2021
  43. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've found something the translator converts incorrectly:

    Mathf.Log10 gets translated to *.
     
    AdrianoVerona_Unity likes this.
  44. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Last edited: Aug 25, 2021
  45. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I don't have a GitHub account.

    One other thing I've discovered, Javascript parseInt can, apparently, take a float as an argument, and parseFloat can take an int as an argument.
     
    Last edited: Aug 25, 2021
  46. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Fair enough. I've filled an issue: https://github.com/Unity-Technologies/unityscript2csharp/issues/62

    yeap. I mentioned that in the issue I've filled
     
    Last edited: Aug 27, 2021
  47. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Just curious, WHY translate For loops to While loops? The syntax for For loops is exactly the same in JS and C#, so no translation is necessary. It just makes the code more complex and difficult to read.

    What is this VS extension, and where can I get it? I've been translating small projects up till now, and cleaning them up manually after the fact. But now I have only a few big projects left, and every little bit helps.
     
    Last edited: Sep 15, 2021
  48. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Because UnityScript implements for loops as a while (or, in other words, it parses a for loop into the same AST node generated when it parses a while loop so it would be much harder to preserve the for loop :(.

    Adriano
     
  49. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I just had a conversion fail with the following error:

    BCE0070: Definition of 'HappyCoinFlickControl.OnFlick(TouchScript.Gestures.FlickGesture)' depends on 'HappyCoinFlickControl.Reload()' whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.​

    I don't know what this means. I don't know what a "cycle" is, or what it means to explicitly declare a type.

    The first function, OnFlick, calls the second function, Reload. Does this have something to do with the Reload function containing a Yield?
     
  50. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    It's not that difficult. Just copy and paste. ;)

    Or is it not the source that's being translated? Is the UnityScript being compiled, then uncompiled back into C#?