<html>
<head>
<title>Create Script Dialog</title>
<style>
h1, h2, h3 { font-family:sans-serif; }
tt, dt {  border-bottom:1px solid #999; font-family:monospace; }
li { margin-top:10pt; }
dt, dd { margin:0 0 10pt 0; padding:0; } dt { float:left; clear:left; } dd { margin-left:120pt; }
.info { background-color:#eef7ff; border-color:#666; border-width:1px; border-style:solid; padding:5pt; }
pre { background-color:#f5f5f5; border-color:#666; border-width:1px; border-style:solid; padding:5pt; margin-left:30pt; }
</style>
</head>
<body>
<div style="width:50em;">

<p><b>Version 1.0 - for Unity 3.4 or higher</b></p>

<h1>Create Script Dialog</h1>

By <i>Unity Technologies</i> - <a href="http://unity3d.com" target="_new">unity3d.com</a></p>

<h2>Using the Dialog</h2>

<ul>
<li>Open the dialog by choosing the menu <tt>Assets > Create > Script...</tt>.</li>
<li>Type a name for your new script in the Name field.</li>
<li>You can change the script type (JavaScript, CSharp, or Boo) if it's not set to the type you want.</li>
<li>Click a folder in the Project View to make the script be saved in that folder when it's created.</li>
<li>You can choose between different script templates. The default is always <tt>MonoBehaviour</tt>.
<ul>
<li>If the <tt>MonoBehaviour</tt> template is used, you can click on a Game Object in the Hierarchy or Scene View to make the script be attached to that object when it's created.</li>
<li>If the <tt>Custom Editor</tt> template is used, you can type in the name of the script you want to make a custom editor for.</li>
<li>If the template supports functions, there is a Functions box where you can choose which functions you want to have included in the script from the beginning.</li>
</ul></li>
<li>Click the <tt>Create</tt> button to create the script.</li>
</ul>

<h2>Making Your Own Smart Template</h2>

<p>If you have a certain type of script you often want to make, you can make your own smart template for it.</p>

<p>The script template is basically just a plain text file. The extension must be .js, .cs, or .boo. The name of the file will be used as the template name. The file must be placed in the folder <tt>Assets/CreateScriptDialog/SmartScriptTemplates</tt>.</p>

<p>Certain keywords can be used in the template to make it more smart.</p>

<dl>
<dt>$ClassName</dt> <dd>This will be replaced with the script name that is typed into the dialog.</dd>
<dt>$NicifiedClassName</dt> <dd>This will be replaced with the script name that is typed into the dialog, but with added spaces. It can be used for naming menu items and such.</dd>
</dl>

<p>The template can specify what the base class for the script is by using the keyword <tt>BASECLASS</tt> in the first line of the template like this:</p>

<pre>BASECLASS=ClassNameOfBaseClass</pre>

<p>When a base class is specified, the dialog will look for a file called ClassNameOfBaseClass.functions and extract function data from there. Each line in the functions file must contain a valid function signature followed by a comment. For example:</p>

<pre>void LateUpdate() LateUpdate is called every frame, if the Behaviour is enabled.</pre>

<p>This can be prefixed with the keyword <tt>DEFAULT</tt> if the function should be included by default, e.g:</p>

<pre>DEFAULT void Update() Update is called every frame, if the MonoBehaviour is enabled.</pre>

<p>When a base class is specified in a template, some additional keywords can be used.</p>

<dl>
<dt>$Functions</dt> <dd>All functions that are chosen in the dialog will be placed where this keyword is.</dd>
<dt>$TargetClassName</dt> <dd>If the base class for the template script is <tt>Editor</tt>, then this keyword will be replaced with the class name that is typed into the dialog in the field "Editor for".</dd>
</dl>

<h2>Contact</h2>

<p>For questions or comments about the Create Script Dialog, please go to the <a href="http://forum.unity3d.com">Unity Forums</a> or <a href="http://answers.unity3d.com">UnityAnswers</a>. If you don't get any useful replies within a few days, you can send me a private message on the forums (handle: runevision) and send me a link to the post you posted and I'll try to have a look.</p>

</div>
</body>
</html>