- Home /
Scripts Won't Update?
I've been trying to debug a script I've been writing, and I just noticed that the edits I've made aren't being acknowledged when I test the game; even after commenting out the entire script, the old version still runs. Things I've tried so far include:
Saving the script on Monodevelop before running the scene
Re-importing the script
In the project view, selecting "Sync Monodevelop Project"
Restarting the editor
Refreshing the script
Restarting my computer
Also, when I select the script in the inspector, it shows the edits [I've] made (i.e. that everything's commented out), but those changes don't take effect in the game itself. I've never had this problem before, and I can't for the life of me figure out what's going on. Has anyone else experienced this, and if so, any ideas on how to fix it?
Update: Even when I remove the script from the object its attached to, it still runs. I'm now officially out of ideas.
Can you post the script? Perhaps you are expecting something to happen in a function that isn't being called, or something like that? This has indeed happened to me before at points, but usually restarting the editor fixes the issue(s).
Well, that's the thing; it's not that my script isn't working as intended, it's that it's being run when I know nothing should be happening. Here's the code:
public class SoundScript : $$anonymous$$onoBehaviour {
public GameObject listener;
List<Collider> heardPlayers = new List<Collider> ();
List<Collider> knownColliders = new List<Collider> ();
List<Collider> trueActives = new List<Collider> ();
float checkTime = 0.0f;
bool check = false;
/*
All the code here is commented
*/
}
Yet, I'm getting printout statements that have been commented, etc. If I remove the public variables from the code, those changes are reflected in the editor, but in-game, the old code still runs, and I just get null reference exceptions. Even when I remove the script component from my object, it runs. The only thing I can think of is I just upgraded to Windows 10, and maybe something there is messing with Unity?
I'm not really sure what to do at this point.
Sorry to hear you are having such a difficult time with this! I just upgraded as well but am not having any issues like this. If you search for the script in your documents and open it with notepad/another IDE does it look the same? It sounds like there's a disconnect between $$anonymous$$D and Unity. I suppose there is always reinstalling, just be sure and back up. Let me know if you're still having issues and I'll try to help. Also, perhaps try saving a copy of the script, and then pasting it into a new class after completely removing it from the project? Good luck!
Yeah, I actually did open it in notepad, and it looked like it should, commented and all. Your new class idea worked, so as long as this doesn't keep happening, I should be good to go. Otherwise, I guess I'll just reinstall, but hopefully it won't come up again. Thanks for the help!