protected virtual void OnDisable() { DestroyImmediate(_reflectionTextureLeft); DestroyImmediate(_reflectionTextureRight); QuickMirrorReflectionManager.RemoveMirror(this); }
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); }