I am following the BurgZergArcade tutorial and I ran in to a problem at video 138. The video is very old so I thought it might be a bigger chance to get an answer here. My problem is that I have button in an if statement and it is clickable and all but nothing happens. This is how it looks:
public void DisplayEquipment()
{
//Debug.Log ("Eqiupment");
if(PlayerCharacter.EquipedWeapon == null){
GUI.Label(new Rect(5,100,40,40), "", "Inventory Slot Empty");
}
else
{
if(GUI.Button(new Rect(5,100,40,40),new GUIContent(PlayerCharacter.EquipedWeapon.Icon, PlayerCharacter.EquipedWeapon.ToolTip ())))
{
Debug.Log ("Clicked Inventory");
PlayerCharacter.Inventory.Add(PlayerCharacter.EquipedWeapon);
PlayerCharacter.EquipedWeapon = null;
}
}
SetToolTip();
}
I put the Debug.Log there to see if the button actually does anything when clicked but it does not. Any one has any idea?
Have played around a bit and I can add that this button is within a a window with ToolBar and I now tried to remove the DragWindow function and the button works now. Problem not though is of course that the window can not be dragged around. Hopefully now someone will know what is wrong. The code for the window looks like this:
private void CharacterWindow(int id)
{
//GUI.DragWindow();
_characterPanel = GUI.Toolbar (new Rect(5,25,_characterWindowRect.width - 10, 25), _characterPanel,_characterPanelNames);
switch(_characterPanel)
{
case 0:
DisplayEquipment();
break;
case 1:
DisplayAttributes();
break;
case 2:
DisplaySkills();
break;
}
}