- Home /
Inspector doesn't refresh in dinamical script change
Hi everyone,
After searching the answer on forum and related info, I give up.
I'll try to explain as best I can, the problem that I have is this.
When the values I coded in my script change, have no effect on the inspector (neither in the game) until I change the scene or restart the game.
It only happens when I change script from another script.
For example, changing a Texture:
Command Script:
//Inside a GUI function
if (cucat.GetComponent(scriptCucat).whiteTNT == false)
{
if (GUI.Button (Rect (Screen.width/1.8,Screen.height/2.4,Screen.width/2.5,Screen.height/15), "WHITE TINT"))
{
cucat.transform.GetComponent(scriptCucat).TNTNUM = 1;
}
}
if (cucat.GetComponent(scriptCucat).greyTNT == false)
{
if (GUI.Button (Rect (Screen.width/1.8,Screen.height/2,Screen.width/2.5,Screen.height/15), "GREY TINT"))
{
cucat.transform.GetComponent(scriptCucat).TNTNUM = 2;
}
}
if (GUI.Button (Rect (Screen.width/1.8,Screen.height/1.7,Screen.width/2.5,Screen.height/15), "ORIGINAL TINT"))
{
cucat.transform.GetComponent(scriptCucat).TNTNUM = 0;
}
Commanded Script:
//Inside Update()
if (TNTNUM == 0)
{
cucatMesh.renderer.material.mainTexture = ORIGTNT;
}
else if (TNTNUM == 1)
{
cucatMesh.renderer.material.mainTexture = WHITETNT;
}
else if (TNTNUM == 2)
{
cucatMesh.renderer.material.mainTexture = GREYTNT;
}
Any suggestions?
Comment