Gameobject automatically invisible

The gameobjects automatically gets invisble if my trackable is displayed on the marker. I tried changing renderer property to true in update function of the script, but it didn’t work. So I wrote the below script. Can anyone please tell me what is wrong with the below script?

using UnityEngine;
using System.Collections;

public class ImageTargetRender : MonoBehaviour, ITrackableEventHandler {
private TrackableBehaviour mTrackableBehaviour;
private GameObject bucket, spawnEgg;

// Use this for initialization
void Start () {
	bucket = GameObject.Find ("Bucket").gameObject;
	spawnEgg = GameObject.Find ("SpawnObject").gameObject;
	mTrackableBehaviour = GetComponent<TrackableBehaviour>();
	if (mTrackableBehaviour)

public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
	if (newStatus == TrackableBehaviour.Status.DETECTED ||
	    newStatus == TrackableBehaviour.Status.TRACKED ||
	    newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)

private void OnTrackingFound()
	bucket.transform.localPosition = new Vector3(0.0f, -0.5312791f, -6.911067f);
	bucket.transform.localRotation = Quaternion.identity;
	bucket.transform.localScale = new Vector3(0.06667648f, 0.01529135f, 0.06667648f);

	spawnEgg.transform.localPosition = new Vector3(0.0f, 3.162413f, -6.824616f);
	spawnEgg.transform.localRotation = Quaternion.identity;
	spawnEgg.transform.localScale = new Vector3(1f, 1f, 1f);


P.S: It is a simple game to catch eggs in the bucket. The spawnEgg object consists of the Egg prefab and the script is attachd to it that helps in spawning of the eggs.

Thanks in advance.

Bhagyashree Shah

Is the renderer set to invisible like you think or is the GameObject not active? you could try to force the GameObject active if it is the latter using this buildin method: