Working with Unity also means working with the script reference a lot. I think the script reference is very good and has good code-snippets. One thing that has annoyed me is the default language is set to JavaScript and in this blog I’ll show how to change the default language.
After a bit of research I found out that the problem apparently only exist in the Chrome browser. Google Chrome does not allow cookies for local files to be read and saved for security reasons.
To change the default language into C# use the following hack:
Find the file jquery.cookie.js, it should be located in your Unity program folder under Documentation/Images. Open the file in a text editor (notepad or similar) and append the following code to the end of the file:
// simple fix to hardcode the default language // (reason: cookies for local files does not work in Chrome) $.cookie = function(cookieName){ return "C#"; }
After saving the file you have now hardcoded the default language to C# – for all the content in the local Unity script reference. Note: you may need to force a reload in Chrome using ctrl+click reload for the changes to take effect.
How does unity script relate to chrome? script referencing is calling objects from other parts of the game. i am a noob please explain.
By: prodatflaps on July 22, 2011
at 10:22
I’m actually not talking about Unity at all. Only Unity documentation. If you use the offline documentation in Unity, the default language is UnityScript (aka. JavaScript) – and there is no way to change the default language permanent … unless you use the workaround I describe.
By: Morten Nobel-Jørgensen on July 22, 2011
at 10:33
Brilliant! I’ve been annoyed by the fact that JavaScript is set to default and I cannot change it to my beloved C#. Thanks a lot! 🙂
By the way. Do you know how to set MonoDevelop (the default editor that comes with Unity3D) to open local scripting reference/manual when developer (means Me) hit F1 or something on selected class name?
There is F12 which opens Assembly Browser but this is just a bunch of classes both from .net and Unity and there’s no examples also and I’d like to open reference for me automaticaly on correct topic instead of me opening it up by myself and the searching it for myself.
By: T0meck on October 18, 2012
at 23:57
It doesn’t work for me. I added in jquery.cookie.js it after the }; and before it. But nothing seems to change.
By: Eco on February 8, 2013
at 20:36
Chrome doesn’t allow to save cookies for local files, here’s a solution I came up with:
1. Open Documentation/StaticFiles/SelectCategory.js
2. Append the following code:
function getLanguage() {
// C# is at index 1 in the dropdown
return 1;
}
By: maurizzzio on January 31, 2014
at 02:37
Chrome doesn’t store cookies on local files, here’s a solution I came up with:
1. Open Documentation/StaticFiles/SelectCategory.js
2. Append the following code:
function getLanguage() {
// C# is at index 1 in the combo
return 1;
}
By: maurizzzio on January 31, 2014
at 02:39