Update function not checking all if statement which have string comparisons

// Update is called once per frame
void Update()
{

    if(primary.Equals("mines")){
    //primaryAmount.GetComponent<Text>().text = ""+mines;
    primaryAmount = mines;
    Debug.Log("MinesWorking");
    
    //PrimaryAmountText.amount = mines;
    }
    else{

    }
    
        if(secondary.Trim().Equals("beacons")){
        secondaryAmount = beacons;
        Debug.Log("working");

    }
    else{
        
    }
    if(ability.Equals("teleport")){
  ///  abilityAmount.text = ""+teleport;
    }
    else{

    }
    
}

}


Hello guys. I have problems with my code above. mu update function is only properly working on the first if statement about mines. the 2nd if statement about beacons only works 2/10 times when i run the game. Any suggestions. It is only supposed to check if the string is equal to “beacon”, but it doesnt seem to work all the time

void Update()
{
if (primary == “mines”)
{
//primaryAmount.GetComponent().text = “”+mines;
primaryAmount = mines;
Debug.Log(“MinesWorking”);

            //PrimaryAmountText.amount = mines;
        }

        if (secondary.Trim() == "beacons")
        {
            secondaryAmount = beacons;
            Debug.Log("shit");
        }

        if (ability == "teleport")
        {
            ///  abilityAmount.text = ""+teleport;
        }
    }