- Home /
Best practice for migrating scripts to plugin?
I'm interested in moving scripts in my project to a plugin. I can easily create a managed plugin with Visual Studio and import it through the Editor. And, I can easily move the script assets out of my project to be part of that plugin. The problem is that all the assets that used those scripts are still referencing the old asset location, and I'd like them to reference them from the plugin.
Is there a good/easy way to change references of a script (project wide) to another reference, AND retain all the field values?
In a perfect world, I'd like to be able to create an assembly asset in the Editor and move scripts in and out of it at will the same way they can be moved around in the file system.
Thanks.
Answer by cjdev · Jan 18, 2016 at 12:11 AM
Short of creating a fairly robust find and replace script, you could instead create a wrapper class for your new assets with the same name as the old one. With properties for the variables and methods that redirected to your new location you could avoid the hassle of having to rewrite everything. If you have code that needs really high performance though I would just suggest biting the bullet.
Appreciate the idea, but I think it'd be more work to create the wrappers than manually convert the project to use the new script locations. I'd hoped there'd be an easy way to tell the Editor to use one location over another. Or, even use a text editor to search and replace GUIDs, but it seems likely to fail.
Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220612060237im_/https://answers.unity.com/themes/thub/images/avi.jpg)