subscribe via rss
2 Apr 2010

[Unify Wiki] Using Notepad Plus Plus as a script editor

Author: Unity3D News Pipe | Filed under: Technology

Summary: Removed the disadvantage section since it has a solution now


Notepad++ is a powerful text editor based on Scintilla (which is where UniSciTE is also based from). It is available only in Windows.

Advantages:
* it can manage more than ten text files opened simultaneously
* customizable color scheme

[[Image:unitynotepadpp2.jpg|thumb|alt=Notepad++ editing a Unityscript file|Notepad++ editing a Unityscript file.]]

== Directions ==
# Notepad++ can be found in http://notepad-plus.sourceforge.net/uk/site.htm. Download and install.
# Change your External Script Editor to Notepad++ (In Unity, Edit> Preferences > General)
# Unity should now open Notepad++ whenever you double-click a script (or any text file actually).



== How to add searching of Unity Documentation within Notepad++ ==
# Download the Language Help Plugin via the Plugin Manager: Plugins > Plugin Manager > Show Plugin Manager. Then choose "Language Help" from the list, and click Install.
# Go to Plugins > Language Help > Options...
# Click Add and put these values
:Name: Unity
:Extension List: "js" (and/or "cs" if you're using C#)
:Extended help file path: http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=$word$
Now whenever you press ctrl+f1 while your cursor is on a word, it will search that word in the Unity documentation. (You can change the key binding via Settings > Shortcut Mapper)



== How to enable highlighting of unity "keywords" within N++ ==
# Open "C:\Program FilesNITY\EDITOR\DATA\TOOLS\UNISCITENITYKEYWORDS.PROPERTIES" THIS TEXT FILE CONTAINS ALL THE UNITY KEYWORDS.
# In Notepad++ go to Settings > Style Configurator...
# In the "Language:" list, select your appropriate language.
# In the "Style:" list, select Keyword (or Instruction Word).
# Add the keywords from the unitykeywords.properties file (the big block of text) into the "User-Defined Keywords" box.
# Save & Close. Close and open Notepad++. Voila.



== How to enable highlighting of unity "keywords" manually ==
# Open "C:\Program FilesNITY\EDITOR\DATA\TOOLS\UNISCITENITYKEYWORDS.PROPERTIES" THIS TEXT FILE CONTAINS ALL THE UNITY KEYWORDS.
# Open "C:\Program Files\Notepad++\stylers.xml" (If you're using a custom theme, open C:\Program Files\Notepad++\themes and open the theme XML file you are using instead.)
# In stylers.xml (or your theme's XML file), find: <LexerType name="javascript" desc="Javascript" ext="">
# Find the coressponding: <WordsStyle name="KEYWORD" styleID="47" fgColor="000080" bgColor="F2F4FF" fontName="" fontStyle="3" fontSize="" keywordClass="instre1">
# Insert all the unity keywords (found from the unitykeywords.properties you opened earlier) inside that <WordsStyle name="KEYWORD"> tag
# Save it. Close and open Notepad++. It should highlight the Unity keywords now.



== How to add Intellisense (called Auto-Completion in Notepad++) for Unityscript ==
# Turn on Auto-Completion by going to: Settings > Preferences > Backup/Auto-Completion. Check "Function parameters hint on input"
# Open "C:\Program Files\Notepad++\plugins\APIs\javascript.xml"
# Copy paste contents of http://anomalousunderdog.herobo.com/UnityProjectUploads/UnityJS_to_Npp_2.6.1.txt.zip (zipped text file, just extract it) to anywhere inside the <AutoComplete> tags of the "javascript.xml" file.
# Close and open Notepad++. A function tooltip should now appear whenever you type in an open parenthesis after a Unity function.

Note: The UnityJS_to_Npp.txt is created from the file found as "C:\Program FilesNITY\EDITOR\DATA\TOOLS\UNISCITE\UNITYJS.API", CONVERTING IT USING A PROGRAM I MADE (HTTP://ANOMALOUSUNDERDOG.HEROBO.COM/UNITYPROJECTUPLOADS/UNITYJSAPI_TO_NPP.PY). IF EVER THE UNITYJS.API CHANGES (IN CASE OF A UNITY UPDATE), JUST RUN THE PYTHON SCRIPT.

== How to make Notepad++ jump to the correct line number from the error console ==
# Back up the original UniSciTE.exe file
# Download the Windows Redirector For Notepad++ (Located at http://www.smokymonkeys.com/pub/user/querbok/UniSciTE%20redirecter%20for%20Notepad++.zip )
# Extract both files from the Zip file in #2 into the UniSciTE directory (Windows: C:\Program Files(86)NITY\EDITOR\DATA\TOOLS\UNISCITE )
# Set Unity3D to use the BUILT-IN Editor.
# Unity will now launch Notepad++ and jump to the correct line number when clicking an error message inside the Unity3D error console.

** The information in this last section is taken from this website: http://www.smokymonkeys.com/kyrill/index.asp?direct=254 Since it is in Japanese you can find the Google Translate version of it here: http://translate.google.com/translate?hl=nl&sl=ja&tl=en&u=http://www.smokymonkeys.com/kyrill/index.asp%3Fdirect%3D254&twu=1

2 Responses to “[Unify Wiki] Using Notepad Plus Plus as a script editor”

  1. Daniel Bø Golan says:
  2. Hey,
    really nice tutorial but im kinda a beginner with coding and was wondering if you could email me ( danielbg [at] live.no ) the styles.xml file since i didnt manage to fix the highlighting of unity “keywords” ? :)

  3. Thanks a million!!! Very helpful and detailed!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>