Child objects trigger collider not working when parent has rigidbody

I have tried using OnMouseOver and a raycast mouse event using camera.screenpointtoray but I still can’t get the collider to recognize when my mouse is over it if it’s parent object has a rigidbody. What gives? Any suggestions/advice?

I solved it last night. It turns out OnMouseOver events will NOT not work on child objects if the root parent has a rigidbody. BUT! If you use a raycast and hit.collider.transform it does. Here’s the script I used to test this(It’s in C#) :

Using UnityEngine;
Using System.Collections;
        
public Class AdvancedMouseDetect: MonoBehavior
{
    public Camera myCam;
    private LayerMask _layerMask 1 >> 8; //This sets the object to ignore layer 8 which is a custom layer;
    
    void GetMouseInfo()
    {
        Ray ray = myCam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
    
        if (Physics.Raycast(ray,out hit, Mathf.Infinity, _layerMask))
        {
            if(hit.collider.transform.name == name)//This detects the colliders transform if you just use hit.transform it gets the root parent at least thats what I found.
            {
                Debug.Log("Mouse is over " + name + ".")
            }
        }
    
    }
    
    void Update()
    {
        GetMouseInfo();
    }
        
}

I hope this helps someone or every one :smiley: