UnityScript to C# Converter

I dug out an old UnityScript program and wanted to try converting it to C#. I did this successfully with many of my old programs some time ago, but it’s been a while. As I recall, the process was surprisingly painless. Not so much this time. I’m running Unity 2018.2.21 (Intel) on a Mac Studio, macOS 15.1.1, UnityScript2CSharp_1.0.7494.18177. Any ideas or suggestions?

Attached is the log. I see a lot of references to Emscripten, no idea what that is, and a WebGL permission error, this is an iOS project. After the conversion, only 2 JS files were converted.

Assets/Scripts/CameraControl.cs(7,12): error CS0246: The type or namespace name `Common' could not be found. Are you missing an assembly reference?

UnityScript2CSharp was not able to convert your project:.

UnityScript2CSharp 1.0.7494.18177
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/Manual
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/Manual/docdata
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/ScriptReference
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/ScriptReference/docdata
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/ScriptRefImages
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/css
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/images
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/images/favicons
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/css
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/fonts
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/fonts/font-awesome
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/fonts/oxygen
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/img
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/js
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/js/dist
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/js/lib
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/js/src
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFiles/js/feedback/five-star-rating-master/sass
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/css
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/images
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/images/favicons
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/css
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/fonts
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/fonts/font-awesome
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/fonts/oxygen
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/img
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/js
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/js/dist
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/js/lib
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/js/src
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/StaticFilesManual/js/feedback/five-star-rating-master/sass
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/Examples
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/ExpertGuides
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/GlobalIllumination
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/Main
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/SL
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/Shaders
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/Documentation/en/uploads/Textures
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Brotli
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Brotli/python
System.UnauthorizedAccessException: Access to the path '/Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Brotli/python' is denied.
  at System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) [0x00129] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.FileSystemEnumerableIterator`1[TSource].HandleError (System.Int32 hr, System.String path) [0x00006] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.FileSystemEnumerableIterator`1[TSource].CommonInit () [0x00054] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.FileSystemEnumerableIterator`1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler`1[TSource] resultHandler, System.Boolean checkHost) [0x000d6] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) [0x00009] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) [0x00000] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.Directory.InternalGetFiles (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) [0x00000] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x0001c] in <f2e6809acb14476a81f399aeb800f8f2>:0 
  at UnityScript2CSharp.Program.TryFindUnityAssembliesRoot (System.String testPath, System.Boolean verbose, System.String& unityAssembliesRootPath) [0x0000f] in <6958b174dfe1463f9e8e1e2af8966741>:0 
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/.circleci
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/cmake
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/cmake/Modules
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/cmake/Modules/Platform
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/media
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/build
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/build/text
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/build/text/docs
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/build/text/docs/tools_reference
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_static
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes/emscripten_sphinx_rtd_theme
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes/emscripten_sphinx_rtd_theme/static
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes/emscripten_sphinx_rtd_theme/static/css
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes/emscripten_sphinx_rtd_theme/static/fonts
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/_themes/emscripten_sphinx_rtd_theme/static/js
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/api_reference
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/building_from_source
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/compiling
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/contributing
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/debugging
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/getting_started
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/introducing_emscripten
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/optimizing
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/porting
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/porting/connecting_cpp_and_javascript
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/porting/files
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/porting/guidelines
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/porting/multimedia_and_graphics
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/site
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/site/source/docs/tools_reference
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/embind
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/bin
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/AL
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/EGL
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/GL
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/GLES
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/GLES2
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/GLES3
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/GLFW
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/KHR
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/SDL
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/SSE
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/X11
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/X11/extensions
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/compat
Probing /Applications/Unity Intel/Unity 2018.2.21f1 (UnityScript)/PlaybackEngines/WebGLSupport/BuildTools/Emscripten<message truncated>

I would ask the guy who wrote that script.

Bonus 1: The more crazy stuff your scripts do, the less likely it is to succeed.

Bonus 2: it is never obvious to human inspection what constitutes “crazy stuff.”

Any idea who that is? I was in contact with him when I did my big batch of conversions a few years ago. He very kindly updated the converter to run in 2018.2.21. But it looks like my private messages did not carry over from the old forum.

Nothing too crazy in these scripts (IAP? Dictionary variables?), based on my human inspection and previous experience with the converter.

I found the folder that had the permission problem, and made it read/write, then ran the converter again. Still failed, but no UnauthorizedAccessException this time. No errors at all, just “probing.” I selected verbose logging, could there be a log file saved somewhere? Something that would at least point me in the right direction. Failing without saying why is not helpful.

It successfully converted the 1st two scripts, so I looked at the 3rd script, the one it looks like it’s getting stuck on, and couldn’t see anything obvious. So I commented EVERYTHING out (except the variable and function definitions), and got the same result—it converted the 1st two scripts, then failed with the 3rd script untouched.

Why doesn’t Visual Studio Code recognize JavaScript?

I did find an old thread where I was asking about the C# converter, and I see that you participated in that thread. You wouldn’t happen to be that guy, would you?

No, no, not I… I barely touched UnityScript… it made my hands feel dirty.

I’m my experience cross-porting from one language to another falls into two results:

  1. it was a trivial script (like mouselook or smoothfollow or something) so involving an autoconverter was more of a waste of time than anything else.
    OR
  2. it was slightly complicated in which case there wasn’t 1-to-1 mappings between the two languages and you have to refactor it all anyway.

Honestly, you should probably just buckle down and timebox it, see what you can port in a half an hour. I think you’d be surprised. You might even make it better in the process.

Besides… it is weekend after all! Time to gamedev!! :slight_smile:

1 Like

Converting to C# is not the biggest problem. I could do it manually, but it would be very tedious and VERY time consuming (LOTS of scripts). There are also plenty of converters available on line, some of which do a pretty good job. The big problem is putting the project back together. Deleting the old scripts, attaching all the new scripts to all the game objects and prefabs, setting all the Inspector variables (unless you know of a way to translate a script without losing all of its connections).

I had this same problem a few years ago when I got a notice from the App Store that about 30 of our apps needed to be updated within 30 days. I considered all the options then, and decided the UnityScript2CSharp converter was the best. And it worked. Well. I wasn’t happy with the way it translated some things, but the programs ran, and I could go back later and clean things up. And, best of all, everything was intact after the conversion. No unassigned references. Pretty much just one click, and the program was good to go. Compared to hours/days/weeks to do the conversion manually. So I’m very motivated to get this script working.

Connections to individual fields in a script are largely through two major things:

  1. the GUID associated with script (see the meta file)
  2. the name of the field into which you drag stuff

If you can avoid changing either of those when cross-porting, that takes care of a lot of stuff, both assets linked into scene and scripts linked within the scene.

Your choices are to basically a) do the conversion in a precise way that preserves GUIDs and field variable names perfectly, or b) do the conversion and then reconnect the correct stuff.

Even if you go with option a) and think you did it perfectly, you’re always gonna have bugs and errors in your convert process, necessitating you figuring it all out again anyway… so why not just do option b) and make your code better!

You can make a tiny prefab with one script and one public field, drag things and see what is in the YAML constituting the .meta files and the .prefab or scene file, and from there decide if its worth doing some kind of crazy string replacement scheme. It may be for you, or it might be worth refactoring to clean it up and make it less dependent on obscure tribal knowledge.

Yes, as always. The script is the easy-cheesy part… connecting it all properly is the hard part.

That’s why I tend to decorate my script with extra labels and/or tooltips, as well as try to make things that put themselves together in code rather than massively dragging things together in a giant blob. I’m talking about stuff like:

[Header( "This should be linked to the in-scene object, not the prefab:")]
public GameObject OptionsPanel;

Tooltips can do this too but I prefer Header 99% of the time because a) it is visible all the time, no hover required, and b) it helps break things up visually in the inspector.

The tiny bit of extra typing when you’re making it more than pays off when you go to debug it or upgrade it later.

I give my variables the same names as the objects they link to. For example, the variable OptionsPanelObj would link to the game object called Options Panel, OptionsPanelPrefab to the prefab, OptionsPanelRect to the recttransform. Works for me.

1 Like

According to an old post, all I need to do is rename the js.meta file to its converted equivalent C#. Sounds easy. Except, there are no .js meta files in the project folder.

Also, I found the log file and I get the following error for the file it gets stuck on. Not too useful.

Internal compiler error: Environment is not available!

I did it! I successfully converted my project to C#. It was every bit as tedious as I thought it would be. Fortunately, lots of the translation could be done with search/replace. Except for variable definitions, and this:

trans.position.x = 100;

I did a LOT of that with positions, rotations, colors, and strict pragma did not flag it.

In case anyone is interested, this is what I did:

  • Translate ALL the JS files to C#.
  • Reimport all the original scripts to generate meta files.
  • Copy the GUID from the JS meta files and paste it into the C# meta files.
  • Upgrade the project to 2019, 2020, and so on up to 6.0.
  • That’s it!

I’m more than a little surprised it worked so well. When I launched Unity, all the C# files were where they were supposed to be and all the Inspector settings were there (except for a few files where I forgot to make the variables public).

1 Like

Hats off to you! Feels good, doesn’t it?

Let me suggest you go tickle every little dark corner of your game right now, like really try to exercise every single part of every single thing… my thinking is that if you find a trivial issue today it will be easier to fix it when your brain is still full of having done the conversion process, as opposed to find a bug a month from now and wondering if it was from the conversion or something else.