First of all, what are you doing mixing OnGUI with NGUI? Second, of course this won't work! "isEnabled" flag for the two buttons is shared! So when you flip it twice, it ends up being exactly what it started with. Instead of a "foreach", do a single GetComponent<UIButton>().isEnabled = !wasEnabled.