OnMouse--- functions not working

I’ve already checked many threads on this issue and tries everything suggested there. It just doesn’t work.
The idea: I have a group of 8 spheres attached to one cube positioned between them and 8 point lights attached to these spheres. During the game when player holds any button (let’s say, LeftShift), this group appears at the current position of mouse and after that moves with the camera so that the cursor can move separately from the group. When the player releases LeftShift, the group disappears.
Here’s the code for this script and it works perfectly:

public class GroupMove : MonoBehaviour {

	private Vector3 pos;
	private Vector3 oldpos;
	private bool appeared;
	public Camera cam;
	public GameObject Player;

	// Use this for initialization
	void Start () {
		oldpos=transform.position;
		appeared=false;
	}
	
	// Update is called once per frame
	void LateUpdate () {
		pos=new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10);
			if(Input.GetKeyDown(KeyCode.LeftShift) & appeared == false){
			transform.position=cam.ScreenToWorldPoint(pos);
			appeared=true;
		}
		else if(Input.GetKeyUp(KeyCode.LeftShift)){
			transform.position=oldpos;
			appeared=false;
		}
	}
}

Next idea: during this group appearance all the lights are disabled. If player drags the mouse over any of the spheres, the attached light gets enabled.
During the test all the lights are shut down so the Start () function works. However, they don’t react to the mouse.
The script is attached to each sphere, they all have colliders that don’t cross each other or lay on each other in front of the camera view. I even tried to separate them from each other and from their lights really far - no result. Tried functions Over, Enter, Exit, Click. Also added debug command to know wether or not they detect the mouse. Empty result.
The sphere code:

public class ButtonCheck : MonoBehaviour {

public Light BtnLight;
void Start () {
	BtnLight.enabled=false;
}

void OnMouseOver () {
	Debug.Log ("Clicked!");
	BtnLight.enabled=true;
}

}

I really need help on this one cause otherwise the project can be simply thrown away.

I don’t believe that’s true. I created a new sphere/light and a new cube. I kept the scripts on the spheres (one on each) and made them children of the cube:

40094-2childobjects.png

matched the light to the sphere script slot on both spheres and also added the OnMouseExit() to switch off the light.

Both lights work perfectly, I’m using unity free/indie and version 4.6.1f1.

EDIT

And Here is a link to a video showing it working

using UnityEngine;
using System.Collections;

public class ButtonCheck : MonoBehaviour {
	
	public Light BtnLight;
	void Start () {
		BtnLight.enabled=false;
	}
	
	void OnMouseOver () {
		BtnLight.enabled=true;
	}

	void OnMouseExit() {
		BtnLight.enabled=false;
	}
}

Hello Mmmpies,

I would like you to see that its not about the nesting of gameobjects, its about the colliders.
I have used your script “ButtonCheck” in the following image.

There are two setups :

Setup 1. Cube with two child spheres and the cube has a collider which has its box collider size values set to 1, 1, 1. These are the ones in row 1. So in this set up when you rollover onto the sphere the light shows up as intended, and you can see it in first two images in the collage above.

Setup 2. Cube with two child sphers but here this cube has a collider which has it box collider size values set to 10, 2, 5. These are the ones in row 2. But now when you rollover to two spheres below nothing happens as you can see in the third (image top right) in the collage above.

The reason is when see the fourth image in bottom left of the collage, you would realize that the cube’s box collider overlaps the its child spheres hence their sphere colliders are encapsulated as well. Thus the OnMouseOver script on the spheres wont work. But if you disable the Box collider and then check, OnMouseOver script will start working as intended on the spheres in setup2.

So UniqueMAX, the spheres being child of cube is not the problem, just check whether their (sphere’s) collider are not being obstructed by any other collider towards the camera.

Regards,