Still have to declare variables in script extensions?

I’m trying to create a custom player bullet script extended from the base bullet script but the player bullet script won’t recognize the RaycastHit variable declared in the base script:

public class PlayerBullet : Bullet{

	public override void DoHit(){

		base.DoHit();

		if(hit.collider.CompareTag("EnemyHead")){
			
			Debug.Log("HeadHit!!");
			
			
	}

  }

}

The name `hit’ does not exist in the current context

RaycastHit hit;

Is declared in the DoHit() function in the base script. Do I still have to declare that again in the PlayerBullet script?

Change:

RaycastHit hit;

to:

protected RaycastHit hit;

you can’t carry local variables in functions. You can reuse the code and get the value from base if you make a call to base version that then returns what you want, but just declaring it there doesn’t work.