private void DisableShadowRendering() { if (shadowRenderer) { DestroyImmediate(shadowRenderer); } else { try { //Try to look for an old unreferenced component and delete it if (shadowCaster) { shadowRenderer = shadowCaster.GetComponent <StylizedWaterShadowCaster>(); } if (shadowRenderer) { DestroyImmediate(shadowRenderer); } } catch (Exception) { throw; } } }
private void EnableShadowRendering() { if (shadowCaster.GetComponent <StylizedWaterShadowCaster>() == null) { shadowRenderer = shadowCaster.gameObject.AddComponent <StylizedWaterShadowCaster>(); } }