Help with consuming an object on key press

I’m trying to make a script where you can press ‘u’ when looking at body armor and it will add 100 to you’re armor value. However, it will not work. I’ve added a print statement to check to see if the ‘if statement’ is ran but nothing is printed to the console. So for some reason the second ‘if statement’ in void Update() is not being ran. Any help is greatly appreciated, thanks.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BodyArmour : MonoBehaviour {
	
	public static GameObject raycastObject;
	public static bool canPickUp = false;

	
	void Update () {
		RaycastHit hit;
		float Distance;
		
		Vector3 forward = transform.TransformDirection(Vector3.forward) * 2;
		Debug.DrawRay(transform.position, forward, Color.red);
		
		if (Physics.Raycast(transform.position,(forward), out hit)){
			Distance = hit.distance;
			raycastObject = hit.collider.gameObject;
		}
		
		checkPickUp();
		
		if (canPickUp == true && Input.GetKeyDown("u")) {
			print("Picked up!");
			Manager._playerArmour += 100;
			if (Manager._playerArmour > 100) {
				Manager._playerArmour = Manager._playerArmour - (Manager._playerArmour - 100);
			}
		}
		
	}
	
	void checkPickUp () {
		bodyarmourcheck script = raycastObject.GetComponent<bodyarmourcheck>();
		if (script != null) {
			canPickUp = true;
			print(canPickUp);
		}
		else {
			canPickUp = false;
			print(canPickUp);
		}
	}
}

I know you didn’t really ask, but I’ll show you a better way to do all this. If you plan on having 40 different types of items, that Update of yours is gonna get messy pretty quick, what you really want here is class to be inherited by all interactable items, with a “OnInteract()” method that can be called by this script. Then, you can have individual classes inherit that class and overide the OnInteract() method to do whatever it is you want them to do. This is a much more versatile way to handle this kind of this, and keeps your player class a lot cleaner, as well as running less code every frame so you get a better fps. Here’s a video on Inheritance and a video on Overriding if it’s new to you, it’s really useful stuff in these scenarios. There’s code below that show you how all of this works, and even includes an example on how this would work for a switch to open a door per say. I also modified your Manager script simply because it’s cleaner and more versatile this way.

public class PlayerInteractions : MonoBehaviour
{
	void Update ()
	{
		RaycastHit hit;
		Interactable inter;

		Debug.DrawRay (transform.position, transform.forward, Color.blue);
		if (Physics.Raycast (transform.position, transform.forward, out hit))
		{
			inter = hit.collider.gameObject.GetComponent<Interactable> ();
			if (Input.GetKeyDown ("u") && inter!=null)
			{
				inter.OnInteract ();
				Debug.Log ();
			}
		}
	}
}

public class Manager : MonoBehaviour
{
	static float _playerArmour;
	static float maxArmor = 100;
    
	public static void AddArmor (float newArmor)
	{
		_playerArmour = Mathf.Clamp (_playerArmour+newArmor, 0, maxArmor); 
	}
	public static float GetArmor ()
	{
		return _playerArmour;
	}
}

public class Interactable : MonoBehaviour
{
	public virtual void OnInteract ()
	{
		//Anything put here will happed every time anything is interacted with.
		//Universal sound/visual effects, etc.
		Debug.Log("Interactable Class: OnInteract() called");
	}
}

public class Armor : Interactable
{
	public float armorValue;

	public override void OnInteract ()
	{
		base.OnInteract ();
            //Universal effects only apply if this is here, so you can pick and choose.
            
		Debug.Log("Armor class: OnInteract() called");
		Manager.AddArmor (armorValue);
	}
}

public class Switch : Interactable
{
	public Door[] doors;

	public override void OnInteract ()
	{
		Debug.Log("Lever class: OnInteract() called");
		foreach (Door door in doors)
			door.ActivateDoor ();
	}
}

public class Door : MonoBehaviour
{
	public bool opened;

	public void ActivateDoor()
	{
		if (opened)
		{
			opened = false;
			Debug.Log ("Closing Door");
			//Close
		}
		else
		{
			opened = true;
			Debug.Log ("Opening Door");
			//Open
		}
	}
}