{"id":3649,"date":"2015-06-09T17:32:19","date_gmt":"2015-06-09T16:32:19","guid":{"rendered":"http:\/\/t-machine.org\/?p=3649"},"modified":"2015-06-10T15:38:26","modified_gmt":"2015-06-10T14:38:26","slug":"use-ctrl-shift-n-to-create-new-scripts-in-unity-project-window-fast","status":"publish","type":"post","link":"http:\/\/new.t-machine.org\/index.php\/2015\/06\/09\/use-ctrl-shift-n-to-create-new-scripts-in-unity-project-window-fast\/","title":{"rendered":"Use shift-N to create new scripts in Unity Project Window, fast"},"content":{"rendered":"<p>In Unity, you create new scripts many times per day, and folders but there&#8217;s no keyboard shortcuts. I fixed this, and made the popup rather more intelligent than Unity&#8217;s built-in one. I&#8217;ve decided to make the basic version available for free here:<\/p>\n<p><span style=\"color: red\">UPDATE: there&#8217;s a bug in the 1.0 version &#8211; it WILL NOT WORK if you set your Project window to 2-column layout. This is due to BUGS IN UNITY (not my code!). I have a workaround that&#8217;s in the Asset Store version, but is missing from the free version. I&#8217;ll patch it later<\/span><\/p>\n<blockquote><p>\n<a href=\"http:\/\/t-machine.org\/wp-content\/uploads\/FreeIntelligentNew.dll\">FreeIntelligentNew.dll<\/a> &#8211; I&#8217;m not supporting this; it&#8217;s free: use at your own risk.<\/p>\n<p>Or, for $2, you can <a href=\"https:\/\/www.assetstore.unity3d.com\/en\/#!\/content\/35088\">get the latest version with full source code from Asset Store<\/a> &#8211; I&#8217;m supporting + updating this.\n<\/p><\/blockquote>\n<h2>Installation<\/h2>\n<p>Drag\/drop the DLL into any folder named &#8220;Editor&#8221; in your project.<\/p>\n<p>(required by Unity; this is how they make sure that Editor scripts aren&#8217;t accidentally included in your final game)<\/p>\n<h2>Usage<\/h2>\n<ol>\n<li>Select the Project panel\n<li>Hit shift-N\n<li>By default, it intelligently guesses if you wanted a new Folder or a new Script. If it guessed wrong, hit &#8220;tab&#8221; to cycle through the options\n<li>Choose a name and hit Enter (like normal in Unity). Done!\n<\/ol>\n<h2>How&#8230;?<\/h2>\n<p>This works by peeking into some of Unity&#8217;s internals and detecting which EditorWindow has focus. If it&#8217;s the Project window, it uses some hardcoded constants (which differ between Unity versions, due to bugs they gradually fix, I think) to get the positions right, and offer you the popup.<\/p>\n<p>I did it this way because Unity currently provides NO PUBLIC API for reproducing some of their core Editor features (e.g. where they temporarily change the render-style of the &#8220;newly-created item&#8221; in a Unity windowpane, so that you can edit the name in-line. Not possible for you or I!)<\/p>\n<p>With a bit more hacking, I might be able to hook Unity&#8217;s own code and enable \/ trigger \/ alter the hidden features from keyboard, but &#8230; that&#8217;s on the wrong side of &#8220;Fragile; would probably break unexpectedly in a future version&#8221;.<\/p>\n<p>How I&#8217;ve done it so far it sits independently of Unity&#8217;s code, and is very unlikely to stop working, or to cause bugs later on. YMMV&#8230;<\/p>\n<p>(if you want to know more, get the Asset Store version, read the source. I&#8217;m happy to answer quetsions via the support links or in the Unity Forums page for this)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Unity, you create new scripts many times per day, and folders but there&#8217;s no keyboard shortcuts. I fixed this, and made the popup rather more intelligent than Unity&#8217;s built-in one. I&#8217;ve decided to make the basic version available for free here: UPDATE: there&#8217;s a bug in the 1.0 version &#8211; it WILL NOT WORK [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67,69],"tags":[],"_links":{"self":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/3649"}],"collection":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/comments?post=3649"}],"version-history":[{"count":11,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/3649\/revisions"}],"predecessor-version":[{"id":3661,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/3649\/revisions\/3661"}],"wp:attachment":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/media?parent=3649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/categories?post=3649"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/tags?post=3649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}