Since Unity’s new update, my visual studio keeps adding “using System;” to my files, but I don’t want them, they create conflicts with Object and Random, is there a way to turn that off?
I could not pinpoint exactly when they were added, they just seem to sometimes pop when I modify a script.
Yes, this is put there by the script templates. However, it just doesn’t matter. It might effect compile times by a negligible amount, but nothing to worry about in a typical Unity project. This used to be much different in a language like C++ where header files have to be constantly read and re-read and re-parsed every time. C# is fast though, saying “using System” doesn’t incur any more parsing, it just looks at the assembly that’s already compiled and grabs a list of classes and methods. There’s probably no harm at all in leaving it there.
However, as others suggested you can remove it from your template file. Or, if you’re using Visual Studio 2015 there are tools to clean up using statements available (I think) from the right-click menu.
The OP stated nothing about performance penalties. Rather this is about the compiler becoming confused between System.Object and Unity.Object. There are a few ways to solve this and one of them is to simply remove the reference.
It has nothing to do with templates, the template does not have “using System”, it is not there upon creation either, it is added afterward, consistently, everytime I change the file it gets automatically added. As if it detected Random statements and told itself: “hey he says Random but I don’t see any “using System”, let’s help him…”
Update: It happens when I generate a method through the VS snippets, beginning to think it has something to do with settings in VS and not the update. Anyone know what would the setting be?