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
4
Question by darthbator · Dec 03, 2012 at 01:39 AM · c#monodevelopdefault

How do I change the default monoDev C# file?

I've actually been through this once before. Back in 3.5 I had edited the default C# template file within unity to remove the comments describing the Start and Update methods. I get really tired of erasing those every single time I make a new script. However I noticed that anytime I updated unity it would overwrite the file. I also noticed that file does not appear to be the temple file that monodev itself is calling. So my question is how the hell do I change this?

I can't believe that the lions share of the entire unity development community erases those 2 lines every time they open a new file?

Comment
Add comment · Show 1
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 darthbator · Jan 02, 2016 at 11:10 PM 0
Share

I went ahead and made a script to Replace the default script template

Just edit the .txt file to your liking and run the shell script in there to replace the file. Needs to run under cygwin to work in windows (if someone wants to write a batch script that could be neat too I suppose).

4 Replies

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

Answer by doug__ · Dec 03, 2012 at 09:47 AM

It's annoying isn't it.

Sadly that template seems to be embedded into the UnityUtilities.dll, which makes it annoying to change.

There is a solution, but its a pain to do.

If you go into options Preferences -> External Tools -> Script Editor and use a normal (non-bundled) version of mono develop you can write a custom Addin (see http://monodevelop.com/Developers/Articles/Creating_a_Simple_Add-in). This lets you add extra template options in the 'new file' dialog, and customise them however you like.

Better yet, if you upgrade, you can just install the addin again on your new copy of monodevelop.

Writing addins is quite a laborious process though. If you can be bothered, its worth 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 darthbator · Dec 03, 2012 at 11:40 AM 0
Share

So I would need a non unity bundled version of monodev in order to build that add on but I would then install in inside unities bundled version of monodev? Ugh this is starting to sound like way more trouble then manually deleting 2 lines in a new file....

Oh well. I'm hesitant to mark this response as "correct" but I think it's the right answer, The truth is I just don't like it.

avatar image Philipp · Dec 03, 2012 at 12:44 PM 0
Share

Actually, you can write add-ins with the bundled version as well. Just start it by itself.

The process isn't that laborious... The documentation is hardly existent, and you can't debug add-ins well, but following the tutorial and poking around a bit, you should be able to have something going within a couple of hours.

avatar image darthbator · Dec 04, 2012 at 01:03 AM 0
Share

All seems to be a lot of work to just continually remove 2 comments.... /sigh oh well.

avatar image
10

Answer by foxor · Aug 07, 2013 at 04:50 PM

In unity 4, the template files are located in:

 C:\Program Files (x86)\Unity\Editor\Data\Resources\ScriptTemplates

Assuming the default install directory.

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 friendlyfoxes · Jan 02, 2016 at 08:30 AM 0
Share

In Unity 4 & 5 on OS X you go to the Unity app in Finder and browse the package with the Show Package Contents on right-click. Then the path of the script templates is: Contents/Resources/ScriptTemplates.

I've ended up making a shortcut to that folder to change the defaults quickly whenever there's an overwriting update.

avatar image
4

Answer by humaldo · Apr 03, 2014 at 06:49 AM

Thx for the tipp, I just changed the default C# MonoDev template. BUT be careful, there's a trap (at least on Win 7): Changing/Saving the file in the C:-Program Files (x86)-Unity-Editor-Data-Resources-ScriptTemplates isn't allowed so I made a copy of the 81-C# Script-NewBehaviourScript.cs.txt file (for backup) directly in the folder (and this was the problem), then copied the original file somewhere outside, changed the content, and copied it back.

But from then on, something went wrong. I wasn't able to create new C# scripts anymore. I tried a few things, but the only solution was to reinstall Unity again. Afterwards I tried it again, and this time it worked. This is what I did:

  1. Copied 81-C# Script-NewBehaviourScript.cs.txt to some other location on my harddrive

  2. Copied it again for backup reasons

  3. Changed the content of the file

  4. Copied it back to C:-Program Files (x86)-Unity-Editor-Data-Resources-ScriptTemplates and overwrote the original file

  • Works fine!

Hope this was helpful :-)

Cheers, Christian

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 WinAndLose · Dec 15, 2016 at 06:44 PM 0
Share

thank you!

avatar image
0

Answer by v01pe_ · Mar 16, 2016 at 01:44 PM

On OSX the folder where the default scripts are copied from can be found here (within your Unity folder)

Unity.app/Contents/Resources/ScriptTemplates

Edit the contents of 81-C# Script-NewBehaviourScript.cs.txt for C# scripts and also others (the names speak for themselves).

If you don't know how to get inside the .app - Right (secondary) click on the .app and select Show Package Contents

Comment
Add comment · 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

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

16 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Default Parameter Specifiers Are Not Permitted 3 Answers

Making a bubble level (not a game but work tool) 1 Answer

Why can't I edit C# script although I have monodevelop installed? PLEASE HELP 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