Creating script that derives from other class than MonoBehavior without manually specifying it

Hey guys,

I have created a derived MonoBehavior from my project which is like MyProjectMonoBehavior which keep a reference to a transform,game object and other stuff. I wonder if it if possible to tell Unity that when I create a script, instead of deriving from MonoBehavior it automatically derives from MyMonoBehavior without having to specify it each time. Does anybody have an idea ?

Thanks a lot for your time :slight_smile:

Claude

Hi Siflou,

You can change scripts templates to anything you want within Unity’s folder, simply by changing a single .txt files.

On Mac:

  1. Right click on Unity Icon in your app folder => Show Package Contents
  2. Open Resources folder
  3. Open ScriptTemplates
  4. From there you can edit Javascript, C#, Boo, Shader or ComputeShader template.

On Windows:

  1. Go to your Unity install path
  2. Then you should locate the templates in /Unity/Editor/Data/Resources/ScriptTemplates/
  3. From there you can edit Javascript, C#, Boo, Shader or ComputeShader template.

As far as I know, there’s no built-in way to do that.

If it’s really a bother, you could create your own *.cs files (from another program, from a script, or by hand), then bring them into your Assets folder. Unity should automatically recognize and import the new files.