Question by
PhoenixFeng · Apr 09, 2018 at 01:26 PM ·
scripting problemshadow
How to use OnBecameInvisible if I need Cast Shadow to be On?
Hello everyone, I want to do something when a game object becomes invisible by the camera. I tried OnBecameInvisivle. But I found that if I turn on Cast Shadow, it won't works as expect. So how to use OnBecameInvisible if I do need turn on Cast Shadow on the renderer? In my game, the camera will move itself. I want to destroy player's character when it gets out of the screen, so I want to use OnBecameInvisible. Of course I want the character to generates shadows while playing, but OnBecameInvisible won't woks. Is there a solution? Or do I need to write some extra code to check if the character inside the screen space instead of using OnBecameInvisible? Thanks!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612160405im_/https://answers.unity.com/themes/thub/images/avi.jpg)