When i keep pressing this button i get YES NO YES NO YES NO in the console, which is what i dont want to happen. How can I get it to ignore the print(“NO”) bit while I keep pressing down this button?
Well, your problem is that OnGUI is executed several times a frame (at least two times: the Layout step and the Repaint step). Usually the input is processed in the Repaint event so you have to check for the Repaint event in your else statement.
ps. DON’T put the whole button into such an Event check, that would break the GUI system. The RepeatButton function (and all other GUI functions) have to be called for all Events.