- Home /
Why are components' script field grayed out?
Components' script field is grayed out making me unable to simply replace the script by drag n dropping. I now manually have to remove the existing script and add a new one.
I tried searching on google with no success. It's not much of a problem, but knowing why it's grayed out would be awesome :) Does anyone know anything?
It's happened in every single project I have in Unity myself after updating to 5.3. The only alternative is to just drag n drop it under the "Add Component" button and removing the original script.
Yeah, this seems to be a new 5.3 feature. Not sure why yet but I suppose there is some reasoning behind the change. As @$$anonymous$$hozo said, you can just add the new component and remove this one.
There must be a reason. $$anonymous$$aybe it has something to do with Unity being split into several building modules (standalone, ios, android, samsung tv etc) which can be (de)selected during install?
So does that mean that you lose values of fields that are common to both scripts, and have to link things up again? I find it a very handy feature that you can change scripts while retaining the values of those fields.
Yes, you lose the references and cannot copy component values when they are not the same type, even if they inherit from the same type
I've tried adding the script manually using AddComponent button, dragging the script over, and everything else I can think of, but it won't let me do anything that changes the script from grayed out to normal.
For reference, I'm converting a project from standard windows to Android. The app works (kinda, the Cardboard prefab to split the view isn't kicking in, although it works in other projects), but the scripts are mostly grayed out.
Answer by Pharan · Dec 19, 2015 at 08:12 PM
You can un-gray it out (and get the old behavior back) by right-clicking on the Inspector's tab and switching from "Normal" to "Debug".
I guess they assume this is still a useful thing to have, so they kept it there, but disabled it by default to prevent weird stuff.
Given this though, I kinda wish they would've just removed it instead of graying it out, but still be able to highlight/ping the script file when you clicked on the component.
Thanks. I just realized this myself. Was about to post it. $$anonymous$$udos, sir.
Answer by Eric5h5 · Dec 19, 2015 at 06:42 PM
This is because by far most people who changed scripts this way did it accidentally, which creates strange problems. But they recognize that there is a legitimate use for it, and are looking into a way to make it work better.
What other changes were made to how scripts were handled? I'm not seeing anything specific in the patch notes related to this... but since I've updated to 5.3 our C# scripts to not communicate properly with our other applications.