Getting objects name using raycast VR

Hello! I want to make a code that I can select an object using raycast and get back its name for comparing it later for my game. I cant get it to work for some reason, i tried attaching a script to my controllers that have the raycast comming from it, but it doesnt seem to work. Any help is appreciated!