void Start() { // STEP 2: REGISTER FOR CAMERA EVENTS // Each instance of VRMOP needs to receive camera pose updates; put them in the // queue for updates by CameraController. // Note that this is done before duplication, so a single queue entry updates the camera // pose for all of the linked clones. if (cameraController != null && cameraMode == CameraMode.MOP) { foreach (GameObject target in GameObject.FindGameObjectsWithTag(targetTag)) { Renderer rend = target.GetComponent <Renderer> (); // Now we store a reference to the shared material in the camera controller cameraController.AddCameraPoseTargetMaterial(rend); Mesh mesh = target.GetComponent <MeshFilter> ().mesh; if (mesh != null) { mesh.bounds = new Bounds(new Vector3(0, 0, 0), new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)); } else { Debug.Log("Failed to update bounds on \"" + target.name + "\", no MeshFilter component found."); } } } else { Debug.LogError("Null cameraController; unable to register any objects."); } // STEP 3: CREATE CLONES foreach (GameObject target in GameObject.FindGameObjectsWithTag(targetTag)) { ResetCloneCount(); GameObject clonegroup = new GameObject(target.name + "-clones"); foreach (Matrix4x4 T in tiling) { if (T.Equals(Matrix4x4.identity)) { continue; } GameObject clone = TransformedClone(target, T); clone.transform.parent = clonegroup.transform; } } }