private void OnDestroy() { //AssetDatabase.CreateAsset(mIrradianceMapAsset, "Assets/test/IrradianceMap.cubemap"); //AssetDatabase.SaveAssets(); if (mPBRObject != null) { GameObject.DestroyImmediate(mPBRObject); mPBRObject = null; } if (mCamera != null) { mCamera.targetTexture = null; } if (mQuad != null) { mQuad.Clear(); mQuad = null; } if (mCameraObject != null) { Object.DestroyImmediate(mCameraObject); mCameraObject = null; } mCamera = null; if (mPrefilterIrradianceDiffuseMaterial != null) { Object.DestroyImmediate(mPrefilterIrradianceDiffuseMaterial); mPrefilterIrradianceDiffuseMaterial = null; } if (mPrefilterEnvSpecularMaterial != null) { DestroyImmediate(mPrefilterEnvSpecularMaterial); mPrefilterEnvSpecularMaterial = null; } if (mRenderToBRDFMaterial != null) { Object.DestroyImmediate(mRenderToBRDFMaterial); mRenderToBRDFMaterial = null; } if (brdfCompute != null) { brdfCompute = null; } }