Best use of GetButton

Hello,

What is the best use to get all button states, my code now is:

if(!Input.GetButtonUp("Left"))
		{
			if(Input.GetButton("Left"))
			{
				log("Button Hold");
				if(Input.GetButtonDown("Left"))
				{
					log("Button Down");
				}
			}
		} else log("Button Up");

Usage is: User Pressed Button Down => an “object” is selected, if button goes up, it is still selected. While holding mouse down, object can be moved.

Other solution what I thought of to seperate it in three seperate if statements.

So what is best use-case ?
Thanks in advance.

GetButton() will handle all the cases i think… so whenever the button is pressed, make sure the object is selected, and move it.

if (Input.GetButton("Left")) {
    if (!selected)
        selectObject();

    moveObject();
}

if (holding)
log(“Button hold”);

if (Input.GetButtonDown("Left")){
    holding = true;
    log("Button down");
}
if (Input.GetButtonUp("Left")){
    holding = false;
    log("Button up");
}

Well looks like I found a solution, nothing else had worked for me.
Here my code, of course if someone uses it the functions has to be replaced.
What it does : if object clicked, marked red as long as clicked. If button is not clicked anymore, object is yellow “still selected”, if anything else is clicked than the desired object, selection is revoked.
Correct layers has to be set to objects that are clickable.

if(Input.GetButton("Left"))
     	{
			Physics.Raycast( Camera.main.ScreenPointToRay( Input.mousePosition ), out hitInfo,100,(1<<8) + (1<<10));
			
			if(hitInfo.collider != null)
				{
					log(hitInfo.collider.gameObject.name);
					currentObject = hitInfo.collider.gameObject;
					currentObjectScene = currentObject.GetComponent<SceneObject>();
					currentObjectScene.setIsActive(true);
					log("Set Object Active");
					
				}
			else 
				if(currentObjectScene != null)
				{
					if(currentObjectScene.getIsSelected()) 
						currentObjectScene.reset(false,false);
				}	
		}
		
		if(Input.GetButtonUp("Left"))
			{
				if((currentObjectScene != null) && currentObjectScene.getIsActive())
				{
					currentObjectScene.setIsActive(false);
					currentObjectScene.setIsSelected(true);
				log("Set Object selected but not active anymore");
				}
			}

GetButton will register as true as long as the button is done. IMO the only uses for the other cases is if you want an action only ONCE on a button press (OnButtonDown) or if you want to hook into the use releasing the button. Outside of those cases I use normal GetButton for everything.