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

Is it possible to change the default code templates?

Discussion in 'Scripting' started by Willem, Mar 25, 2007.

  1. Willem

    Willem

    Joined:
    Mar 9, 2007
    Posts:
    184
    I'm looking at moving to C-Sharp for my Unity scripting but the default script template doesn't agree with my coding style at all.

    Is there a way I can change what that default script template looks like?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you show package contents for Unity and look in the contents/resources/ folder, there are NewBehaviorScripts for Boo, Javascript, and C#. I assume by changing those, you'd change the default template. (I haven't actually tested that; I just happened to notice them one day when I was poking around.)

    --Eric
     
  3. Willem

    Willem

    Joined:
    Mar 9, 2007
    Posts:
    184
    That does it! Thanks man, much appreciated...
     
  4. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Yup, and for reference I have it on my to-do list to look into documenting this properly in the near future.
     
  5. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    Maybe I could drop in a feature request while we're on the subject....

    It would be quite nice if Unity looked for these files in ~/Library/Application Support/Unity/Templates or somewhere similar as well as inside its own bundle. That would prevent user-modified templates from being overwritten when Unity gets updated.
     
  6. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Duly noted, thanks for the good suggestion Neil.