Button Down not working,Key being pressed down not working.

I’m using a code to sense if Shift and = is pressed down, and if it is giving the value of “+” and if only = key is pressed, “=” value should come. The code I’m using is

   if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.RightShift))
    {
        Debug.Log("+ key was pressed.");
    }
    else
    {

        Debug.Log("= key was pressed.");

    }

This is creating an infinite amount of spam of “=” in my console even if nothing held down, and when Shift and Plus is pressed down, it inputs +, What am I doing wrong?

First, let’s look at your conditions:

if([key combination, where all keys must be pressed on a single frame])
{
}
else // any other time
{
}

Your else runs on every frame when [left/right shift] and [equals] aren’t pressed simultaneously on the same frame, and only for that frame.

That said, your current condition is also: If Equals is pressed, or both shift keys are pressed simultaneously…

It would seem that your intent is to register a single, immediate press of [equals], then determine whether a [shift] key is currently being held. That would look more like:

// Check for the single, immediate input
if(Input.GetKeyDown(KeyCode.Equals))
{
	// Check for current state of either
	if(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
	{
		Debug.Log("+ key was pressed.");
	}
	else
	{
		Debug.Log("= key was pressed.");
	}
}