Hello,
I really need help on this one, I have been seeking for solution and scroll hundreds of line of code just to see any mistake, but it's just a very basic toggle that produce the crash. Everything was working fine in past session but today i retest a toggle and it crash.
I have a serie of toggle that crash (hang) editor in play mode.
void Awake(){
EasyBtn.onValueChanged.AddListener(delegate { OnDifficultyChangeClick(1); });
HardBtn.onValueChanged.AddListener(delegate { OnDifficultyChangeClick(2); });
VeryHardBtn.onValueChanged.AddListener(delegate { OnDifficultyChangeClick(3); });
}
void OnDifficultyChangeClick(int MyChoice)
{
Debug.Log("My difficulty choice is " + MyChoice);
if (MyChoice == 1)
{
EasyBtn.isOn = true;
HardBtn.isOn = false;
VeryHardBtn.isOn = false;
InsaneBtn.isOn = false;
CurrentDifficultyChoice = 1;
}
else if (MyChoice == 2)
{
EasyBtn.isOn = false;
HardBtn.isOn = true;
VeryHardBtn.isOn = false;
InsaneBtn.isOn = false;
CurrentDifficultyChoice = 2;
}
else if (MyChoice == 3)
{
EasyBtn.isOn = false;
HardBtn.isOn = false;
VeryHardBtn.isOn = true;
InsaneBtn.isOn = false;
CurrentDifficultyChoice = 3;
}
else if (MyChoice == 4)
{
EasyBtn.isOn = false;
HardBtn.isOn = false;
VeryHardBtn.isOn = false;
InsaneBtn.isOn = true;
CurrentDifficultyChoice = 4;
}
else
{
Debug.Log(MyChoice);
}
}
The DebugLog doesn't even get called, so it look like the problem is with the listener !?
The weird thing I see in the editor is that the image preview in the inspector doesn't show up for the problematic toggle. The image preview is blank (alpha). When I uncheck and recheck the gameobject the preview regenerate correctly. When I look in window sprite packer the correct image is there, I thought it could be a corrupted sprite pack, but I don't know how to force a regeneration. I also tried reimporting the image and deleting the meta to force recreation but nothing have improved.
Any clue ?
↧