How to detect multiple object from camera view?

Hi, i am trying to detect multiple objects from camera view. For example i got 2 paintings on the wall and want to detect them in which returns me the paintings object name. I tried raycastall but it was blae to detect both of it from certain angle but when looking directly at them, it only retun one of the paintings object name only. Can anyone help me?

That above method will work for sure. The painting was still detected even when you were behind the wall because while you are inside unity the camera in scene view is also taken into account so if the painting was visible in the scene view it will be detected. So play the game in full screen mode it will work.

ok i got try moving the view from the scene mode away from the object to the starting position of the camera. But when i run the game, it still detect the object even its behind a wall. Here the code i used

using UnityEngine;
using System.Collections;

public class becomevisible : MonoBehaviour {
	void OnBecameVisible() {
		enabled = true;
		print("Your're looking at " + gameObject.name);
	}
}