Search Unity

Inspector values not corresponding with script values

Discussion in 'Scripting' started by Spartounet, Sep 1, 2014.

  1. Spartounet

    Spartounet

    Joined:
    Dec 17, 2013
    Posts:
    1
    Hi guys! I hope I'm in the right section this is my first post here. A very strange thing is happening to me in Unity right now.

    Few days ago I updated my script called SkinSystemScript. Everything worked perfectly when I played the game. But today when I open the script, I only find the old version of the script, not the one I wrote few days ago.
    But the strangest thing is that Unity uses the updated version of the script because it displays public variables of the updated script but which don't appear in the script when I open it! When I hit play, this is the updated script that I cannot find which is used. I really don't understand how it's possible.

    As you can see on the screenshot below, the name of the script in Unity is different than the Public Class one I don't know why, I don't have any error from the console when I hit Play I'm totally lost.

    Do I have to rewrite my script? :(

     
  2. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    Unity does not keep internal versions of your script, if you have lost your code, it's lost.
    A MonoBehaviour that you put on GameObjects needs to have the same filename(sans extension) as the class it contains (http://docs.unity3d.com/Manual/CreatingAndUsingScripts.html).
    This is probably why your inspector variables are different, I suppose you renamed your script file at some point and did not change the class name.