Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Script Reference not saving language selection

Discussion in 'Scripting' started by echen, May 1, 2013.

  1. echen

    echen

    Joined:
    Mar 31, 2013
    Posts:
    1
    I don't know if anybody else is annoyed by this, but the Script Reference pages don't save your selected scripting language. So if you regularly use scripts other than JavaScript, you have to click and select the drop down list every single time you lookup something. And as a beginner, this gets annoying really fast.

    To fix this, you just need to have the Script Reference pages load the javascript file jquery.cookie.js :

    Problem:
    A user's preference of scripting language is not saved. This is online ( http://docs.unity3d.com/Documentation/ScriptReference/ ) and in the local ScriptReference pages.

    Symptom:
    The user has to select language every time he loads a new Script Reference page.

    Solution:
    Add this line to the bottom of every Script Reference page before </body>:

    Code (csharp):
    1. <script type="text/javascript" src="../Images/jquery.cookie.js"> </script>
    If you are on a Mac you can run these scripts to fix your local copy of Script Reference:

    1) Backup the Script Reference directory just in case. ( /Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference )

    2) Create the following files in the Script Reference directory:
    addCookie.sed
    Code (csharp):
    1. # insert jquery.cookie.js script  *before* the closing body tag
    2. /<\/body>/i\
    3. <script type="text/javascript" src="../Images/jquery.cookie.js"> </script>
    runAddCookie.sh
    Code (csharp):
    1. # change all the "*.html" files in the current directory
    2.  
    3. for i in `ls *html`
    4. do
    5.     echo "working on $i ..."
    6.       sed -f addCookie.sed < $i > ${i}.tmp
    7.         mv ${i}.tmp $i
    8.       done
    9.  
    3) Open Terminal.app
    Code (csharp):
    1. cd /Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference
    2. sh runAddCookie.sh
    3.  
    Google Chrome note
    Google Chrome by default doesn't allow cookies for local files. So local copy of ScriptReference won't work in Chrome. If you fix the HTML on your local machine AND use Chrome, the script selection still won't save. 2 solutions:
    1) Use another browser to open the local copy of Script Reference
    2) Start Chrome with --enable-file-cookies argument
    On a Mac in Terminal:
    Code (csharp):
    1.  open /Applications/Google\ Chrome.app -n --args --enable-file-cookies
     
  2. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    OS X Tip:
    To use Chrome like a normal app from Applications or the dock to browse the local documentation with the 'enable file cookies' fix shown above without having to use the terminal each time, use Automator to create an application (just a shell script) that runs Chrome with the additional command-line arguments needed.

    Taken/edited from: http://silvanolte.com/blog/2012/05/...os-x-application-with-command-line-arguments/

    1. Launch Automator (in the Applications folder).
    2. Choose “Application” as the type of document.
    3. Type “shell script” in the filter and double click on “Run Shell Script” to add a shell script to the application.
    4. On the right you will see a text box with the word “cat” in it. Delete this, then type the following command in the text box:
      Code (csharp):
      1.  open /Applications/Google\ Chrome.app -n --args --enable-file-cookies
    5. Press Command-s to save it. Name it “Google Chrome with File Cookies” (or similar) and save it in the Applications folder.
    6. Now find Google Chrome in the Applications folder and single-click it to highlight it (don’t launch the application).
    7. Press Command-i to get the info window for this application.
    8. Click on the icon inside the info window. (nb. the small icon at the top left, not the larger preview further down. It will highlight when you click it.)
    9. Press Command-c to copy the icon.
    10. Find the Automator Script you saved as an app in step 5 and single-click it to highlight it (don’t launch the application).
    11. Press Command-i to get the info window for this application.
    12. Click on the icon inside the info window. (nb. the small icon at the top left, not the larger preview further down. It will highlight when you click it.)
    13. Press Command-v to paste the icon.

    Done.

    // greg
    Flightless - http://www.flightless.co.nz