I am using the code below and although it works perfectly i get this error whenever i press the button on my keyboard. Is this a bug of the engine or something wrong with my code?
private void OnGUI()
{
if (pistol_button)
{
if(GUI.Button(new Rect(20, Screen.height - 50, 100, 50), "1. Pistol") || Input.GetKeyDown(KeyCode.Alpha1))
{
child1.SetActive(true);
child2.SetActive(false);
}
}
if (shotgun_button)
{
if(GUI.Button(new Rect(140, Screen.height - 50, 100, 50), "2. Shotgun") || Input.GetKeyDown(KeyCode.Alpha2))
{
child2.SetActive(true);
child1.SetActive(false);
}
}
}