Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Benjamindavid · Dec 13, 2012 at 01:10 PM · settingspreferences

External Script Editor

Does anyone know how the external script editor reads the code file from unity with a single click?
I mean when we press Edit->Preferences->External Tools->External Script Editor.
It would be really helpful for me. Thank you

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Zv_oDD · Mar 02, 2014 at 09:54 PM

The External Editor is called via the Operating System's shell ( at least for unsupported ones, ie not Visual Studio)

The External Script Editor Args option allows you to specify the command line parameters passed to the external editor. There are a few variables you can use in this options to set the file name and line number:

  • $(File) is replaces with the File Name

  • $(Line) is replaced with the Line Number

So if your external editor has a command line argument syntax that support those parameters you can add them in. For example suppose an editor that uses -f for file name and -n for line number you could write the External Script Editor Args option as:

 -f "($File)" -n $(Line)

So the final system/shell call coming from Unity might look like

 "C:\Program Files\SomeTextEditor\editor.exe" -f "C:\Project\Scripts\script.cs" -n 0

Exactly the same way you can call that script editor on the command line.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yoyo · Mar 03, 2014 at 06:29 AM 0
Share

Awesome, this must be a new feature since I posted my answer. Good to know, thanks for pointing it out!

avatar image
0

Answer by yoyo · Dec 13, 2012 at 04:30 PM

Unity will launch the external script editor and pass the full path to the script file as an argument on the command line. So for example if you select Windows notepad.exe as your script editor, then when you edit MyScript.cs, Unity will run something like:

C:/Windows/system32/notepad.exe "C:/Users/bob/unityprojects/myproject/Assets/MyScript.cs"

Similar story on a Mac -- the path to the script is passed as a command line argument to the editor.

Unfortunately external script editors cannot be configured to jump to a line number when you double-click on the console log, Unity just doesn't pass them that information. If you want this functionality, it is possible, but messy -- you can replace the standard MonoDevelop.exe with a launch program that reads the MonoDevelop command line (which includes line number information) and then launches the editor of your choice, reformatting the command line parameters as needed. (I know it's possible because I've done it, but that doesn't mean I necessarily recommend it! :-)

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benjamindavid · Dec 18, 2012 at 03:34 PM 0
Share

Thank you But, I already tried to pass the script like done in notepad. I can use command prompt to pass the script and open in the text editor. It works fine. But, It does not opens up when i set the new editor in the unity and then double click the script from unity. Are there any other methods unity opens up a script file in a selected code editor?

avatar image yoyo · Dec 18, 2012 at 05:32 PM 0
Share

Sorry, maybe I misunderstood your question. In the External Tools dialog you can click on the External Editor drop-down, select Browse ..., and then choose the executable you want to use for editing scripts (for example, on a Windows PC, "C:\Windows\system32\notepad.exe"). Once you select the external editor, then when you double-click on a script file it should open in the selected editor. Is that what you tried? Are you on PC or $$anonymous$$ac?

avatar image Benjamindavid · Dec 19, 2012 at 04:07 PM 0
Share

I'm on PC. Actually I'm creating a script editor for unity that i want to open the script directly from unity by double clicking the script just like opening in Visual Studio, $$anonymous$$onodevelop or notepad. I want to know how to pass the file to my editor. Is it the file path or something else? I already tried the file path. But, Not working. Any other way?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why Preferences get lost after I close Unity? 0 Answers

How can i change the unit grid to pixel grid ? 0 Answers

How can I use VSCode as a diff/merge tool for Unity Collaborate? 1 Answer

Error in Console, for Editor Settings, don't understand how to fix 1 Answer

Why does my Skybox appear to be a very different color than what should be default? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges