[SOLVED]OnMouseOver not using children Collider?

So, I have a small piece of code that is used for all objects that can be “clicked”, it displays a hand to indicate that if you’re close enough, and if you click it will call “action”.

All my interactives object derrive from this class, and it worked great as I used it on cubes, I could add physics, readable descriptions… I worked great.

I tried to use it on an imported object from cinema4D that contains different meshes. My issue is that I use “OnMouseOver”, in my script, but the parent object doesn’t have any colliderBox, and my script is on the parent. Even if children have a collider it doesn’t seem to work.

Here’s the code, some bits are in french sorry about that

using UnityEngine;
using System.Collections;

public class CubeCliquable : MonoBehaviour {
    // Use this for initialization
    protected Curseur curseur; 
    protected double distanceToPlayer;
    protected double distanceCursorDisplay;

    public virtual void Start () {
        curseur = GameObject.Find("Canvas/Curseur").GetComponent<Curseur>();
        distanceCursorDisplay = curseur.distanceActivable;
    }
    // Update is called once per frame
    public virtual void OnMouseOver()
    {
        distanceToPlayer = (this.gameObject.transform.position - Camera.main.transform.position).magnitude;
        if(distanceToPlayer < distanceCursorDisplay)
        {
            if (!curseur.isActif())
            {
                curseur.afficherActiver();
            }
            if (Input.GetButtonDown("Fire1"))
            {
                action();
            }
        }
        else
        {
            curseur.afficherPoint();
        }
    }
    public virtual void action()
    {        }
    public virtual void OnMouseExit()
    {
        curseur.afficherPoint();
    }
	void Update () {
	}
}

I read on forums that OnMouseOver uses the parent’s collider and all it’s children, but it doesn’t seem to work here. The parent has the script, and the child has the collider.

Your parent object probably doesn’t have a Rigidbody component. It is required for compound colliders to work (colliders from child objects are combined). Just add a Rigidbody and set isKinematic to true if you don’t want it to be affected by physics (static object). There should be no Rigidbodies on gameobjects under the parent in the hierarchy.