Hello I would like to know if there is a way to import scripts that may contain errors without affecting the current project, such as a place where I could mess with the script without being constantly showing me compilation errors or even having to create a new project for it.
This wouldn’t make much sense. What do you mean by “mess with the script”? If the file is ignored by Unity, why do you want to have it inside the Unity project? You could place scripts in a hidden folder (See the very bottom of this). However hidden folders are completely ignored by Unity. So you can not interact with then in Unity (which is kinda what you want).
If you just need a place to temporarily move items inside the Unity editor that are ignored by Unity, move them into the “StreamingAssets” folder that needs to be located directly inside your Assets folder.
Though be warned: This has to major issues:
- First of all files in the StreamingAssets folder are included in a build verbatim. So you have to remove them manually before creating a build or they will hang around as text assets in your game.
- Second while you can interact with things in the StreamingAssets folder in Unity, the scripts are not part of any C# project. So you can open the file in VisualStudio, but VisualStudio will not see it as part of your project. That means you get no references to the UntiyEngine or any other script in your project. So you can “mess” with the script but it won’t interact with anything Unity related.
I don’t quite see your exact usecase here. At least you can’t expect the compiler and VS to help you with your script if it’s not compiled at all. So in the end there’s not much difference from just moving the files out of Unity into a seperate folder.
If you just want to temporarily “ignore” a folder, you can rename the folder in the editor and make it a hidden folder (add a dot in the front, add a tilde at the end, …). Of course as mentioned above, such a folder would vanish from Unity and is completely ignored by Unity. To bring it back you just have to rename it back. You could use an EditorScript like this one. It provides menu items to rename the “Ignore” folder into “.Ignore” or back. It’s also an editor window that can be docked somewhere to have quick access. Though the issues I mentioned above still remain.
If you’re working on a new feature and you’re messing with a lot of code changes, I highly recommend to use some kind of version control like git. This would allow you to work on a seperate branch and you can go back to the master whenever you like.