protected virtual void Awake() { //Create the mesh filter MeshFilter mFilter = gameObject.GetOrCreateComponent <MeshFilter>(); mFilter.mesh = QuickUtils.CreateFullScreenQuad(); mFilter.mesh.bounds = new Bounds(Vector3.zero, new Vector3(1000000, 1000000, 1000000)); //Create the mesh renderer MeshRenderer r = gameObject.GetOrCreateComponent <MeshRenderer>(); r.shadowCastingMode = ShadowCastingMode.Off; r.receiveShadows = false; _material = new Material(Shader.Find("QuickVR/CalibrationScreen")); r.material = _material; gameObject.layer = LayerMask.NameToLayer("UI"); SetColor(Color.clear); }
protected virtual void OnEnable() { //Create the mesh filter _mFilter = gameObject.GetOrCreateComponent <MeshFilter>(); if (!_mFilter.sharedMesh) { _mFilter.sharedMesh = QuickUtils.CreateFullScreenQuad(); } //Create the mesh renderer _renderer = gameObject.GetOrCreateComponent <MeshRenderer>(); _renderer.receiveShadows = false; //Ensure that the renderer has the reflection material. string shaderName = GetShaderName(); if (!_renderer.sharedMaterial || _renderer.sharedMaterial.shader.name != shaderName) { _renderer.sharedMaterial = new Material(Shader.Find(shaderName)); } QuickMirrorReflectionManager.AddMirror(this); }