GetComponentsInChildren question!

I am trying to create an AR application using Qualcomm’s AR sdk.
The following code is used to render the 3d models.

    private void OnTrackingFound(){
    Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

    // Enable rendering:
    foreach (Renderer component in rendererComponents) {
        component.enabled = true;
    }
    Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
}

The hierarchy used is :

ImageTarget (script)
  ->Gameobject3 (animation)
     ->Gameobject4 (mesh renderer)
     ->Gameobject5 (mesh renderer)

However when i add an empty gameobject as in the following hierarchy, the meshes do not render at all. Shouldn’t the GetComponentsInChildren get all componets? How should i change the script to get the desired results?

ImageTarget (script)
 ->Gameobject2 (empty gameobject)
   ->Gameobject3 (animation)
      ->Gameobject4 (mesh renderer)
      ->Gameobject5 (mesh renderer)

GetComponentsInChildren will go down the whole hierarchy, so your setup should work fine. Make sure you don’t offset your objects when adding the empty GO. While testing in the editor you can pause and select the objects in the hierarchy. Press “f” to find the object in the scene-view. Check if the Renderer on the objects are really enabled after this code has been called.

You were right. My object was there but to small to spot it. Thanks a million.