Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Zarenityx · Jul 07, 2015 at 06:50 PM · defaulteditor extensionframeworktemplateeditor extention

Creating a new code template

Hi, I have done a ton of searching and still can't find an answer to this. I have created a fairly complex framework that I want everyone to easily customize and use. In order to write scripts using this framework, one needs to do all sorts of small stuff, including using different namespaces and overriding functions. I saw that it was possible to change the default code template, so When you hit 'Project>Create>New Language Script' it has all of your regions and such that you normally use. I was wondering if it were possible to create an entirely new code template that could be used like 'Project>Create>New Language Automation' for instance.

In case you are wondering why on earth I would want to do this, right now users can create their own cellular automations by inheriting from a class, but they also have to override all of the methods of that class. I also wanted to remove the 'using UnityEngine' part, since it's multithreaded and I didn't want users to accidentally use Unity stuff in there.

Is it possible to do something like this? Thanks in advance!

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
2
Best Answer

Answer by DiegoSLTS · Jul 08, 2015 at 02:54 AM

You can extend the Unity editor with a script that adds an option to almost any menu. That option could create the new file with the default code you want. I don't have a lot of experience with editor scripts, but I'm sure you can do this, lots of plugins create new script files with custom code inside after choosing an option.

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 Zarenityx · Jul 09, 2015 at 12:42 AM 0
Share

Thanks! I don't know why I didn't think of that... But that means I could have it generated from a custom editor, too, which would be nice. This is exactly what I was looking for!

avatar image
1

Answer by Itinerant · Jul 07, 2015 at 07:05 PM

I did a bit of searching through the forums, and came across this article. It should help you do what you want:

Unity quick tip: Change the template for new classes.

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 Zarenityx · Jul 08, 2015 at 01:03 AM 0
Share

That just changes the default template for the script you make with 'New C# script' or 'New Javascript'. I was wondering if it were possible to create another one, not the default, that would be set up to use my framework. That way, you could still easily create normal scripts, as well as automator scripts. I don't want to rewrite the original, I want to make a new one that is set up for a different purpose.

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

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

Related Questions

How can i change the default new scene? 1 Answer

New Project/Scene - Change Default Settings? 2 Answers

Change the default script template? 5 Answers

Calling tortoiseSVN commands in c# 0 Answers

Procedural icons generator - Texture2D.ReadPixels works incorrectly in Unity 5.6 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