- Home /
OnBecameInvisible() Error
So I have the following code applied to one object, and for some reason the in the log it just prints an infinite loop of invisible and visible in that order whether I am looking at it or not, any suggestions?
function OnBecameVisible () {
print("VISIBLE");
}
function OnBecameInvisible () {
print("INVISIBLE!");
}
function Update(){
OnBecameInvisible();
OnBecameVisible();
}
Answer by robertbu · May 12, 2014 at 05:07 AM
OnBecameInvisible() and OnBecameVisible() are callbacks. You don't call them. So delete the calls in Update. Note these functions are triggered by any camera. In Unity 3.x that included the scene camera when the app was run in the editor. So if you have trouble getting these functions to fire reliably, turn the scene camera away from the action.
Your answer
Follow this Question
Related Questions
Rendering beyond solid surface 1 Answer
How to use isVisible or OnBecameInvisible() to detect player offscreen 1 Answer
Is there a way that I can control the maximum number of Visable Skinned Mesh? 0 Answers
Onbecomevisable, straight up dosnt work. activates but gameobject is not in camera view? 0 Answers
My Enemy isn't moving! 1 Answer