How to know if a gameobject is already active ?

Hello, guys, I want a sphere to get active if the main camera is activated, Can anyone help me, i tried using this,

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {
public gameobject camera;
public gameobject player;

void Update() {
if(camera.setactive(true)) (
player.setactive(true)
)

if (gameObject.active)

that is deprecated in Unity 4

for unity 4 it is actually

if (gameObject.activeSelf)

but to find if it is active in hierachy (ie parents are active) use

if (gameObject.activeInHierarchy)