Expressions in statements must only be executed for their side-effects? D:

So, I’m making a GUI Background changing script to add a little user input on the user side, And I came up teh ye-olde pain in teh butt “Expressions in statements must only be executed for their side-effects”. Anybody have any idea what went wrong? I’ve examined it and I have found nothing as to what is wrong.

	public var overlayCount = 0;
	@HideInInspector
	public var texture : Texture2D = wallpaper1;
	
	public var wallpaper1 : Texture2D;
	public var wallpaper2 : Texture2D;
	public var wallpaper3 : Texture2D;

function OnGui() {

    if (GUI.Button(Rect(10,10,50,30),"<-"))
        overlayCount - 1;
        if (overlayCount < 0){
        	overlayCount = 1;
        }
    if (GUI.Button(Rect(70,10,50,30),"->"))
        overlayCount + 1;
        if (overlayCount > 3){
        	overlayCount = 3;
        }
        
    if (overlayCount == 1){
    	texture = wallpaper1;
    }
    
    if (overlayCount == 2){
    	texture = wallpaper2;
    }
    
    if (overlayCount == 3){
    	texture = wallpaper3;
    }
}

You can’t do things like “overlayCount + 1”. It’s “overlayCount++” or “overlayCount += 1”. Also there’s no built-in function called “OnGui”.

–Eric

Thanks! Worked like a charm! Also, You’re right. It’s OnGUI.