How do i store id of certain item?

So, i am doing a raycast whenever i move (turn based game), and when the ray hits an object with tag “Door”… Here is my question, can i somehow store the information WHICH door did i bump into? I mean, i have few doors on my map… Wouldnt want to open them all at once.

" hit.collider.gameObject " should do it for you.

Like this—

var doorScript : DoorScript = theHit.collider.gameObject.GetComponent(DoorScript);
if (!doorScript.isLocked)