If ray in contact with collider...

Why it dsnt work? (C#)
What I need to do with it - if ray from “A” script in contact with collider of object attached to “B” script, then in “A” something doing:

    Vector3 ray = transform.TransformDirection(Vector3.forward); 
    Debug.DrawLine(transform.position, ray, Color.green); 
    pickup = ray.collider.GetComponent<rev_pickup>();  
    if(pickup != null) { do(); }


error CS1061: Type UnityEngine.Vector3' does not contain a definition for collider’ and no extension method collider' of type UnityEngine.Vector3’ could be found (are you missing a using directive or an assembly reference?)

kinda confusing the way you worded it but i guess your trying to check if a script is attached via raycast right?

Vector3 fwd = transform.TransformDirection(Vector3.forward);

RaycastHit hit;

if(Physics.Raycast(transform.position, fwd, hit, 10))

     //do your thing here :D


*btw just wrote this on here so you may have to reorganise or reword it see the reference here…