Jul
12
2017

Editor Plugin: Paste Script To File

Small editor script to easily paste full script into new file in project.
(instead of having to manually create new script file, opening it, pasting contents to it, renaming file etc..)

Usage
– Download CopyPasteHelper.cs script from https://github.com/UnityCommunity/UnityLibrary/blob/master/Scripts/Editor/Tools/CopyPasteHelper.cs
– Place it under Editor/ folder in your project
– Select “Window/UnityLibrary/CopyPasteHelper” to open the tool window
– Dock the window somewhere (and save layout if you want to keep it there)
– Copy some script source from web (sample script)
– Click “C#” button on the CopyPasteHelper window
– New script file is created under Assets/Scripts/Paste/

TODO (still missing few important features)
– Parse class and filename from the script (so that created filename matches it)
– Add support for pasting shader files
– Validate clipboard text (to check if its c# or shader)
– Check if its editor script (then save to editor/ folder)
– Add separate folder for shaders
– ..

*Best used with this browser plugin (to add Copy button into unity scripting docs)
https://unitycoder.com/blog/2017/07/13/browser-plugin-add-copy-button-to-unity-scripting-docs/


Leave a comment

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.