I have a 2d sprite#1 that appears on screen at which point OnBecameVisible() is called…
then i have the sprite#1 animate while calling a function inside another sprite#2,
then i destroy sprite #2 at which point sprite#1 inexplicably calls OnBecameVisible() again!!!
But it never called OnBecameInvisible()!
I have no idea why this could be happening! anyone have any idea?
It only happens as soon as i destroy the sprite#2 but its simply a damage function that has NOTHING to do with rendering sprite#1 and as i said OnBecameInvisible() is never called!
In fact after testing i noticed that even destroying sprite#2 before sprite#1 calls the damage function, OnBecameVisible() is still called! And it’s only called IF OnBecameVisible() is called initially when the sprite first appears, so if sprite#1 was off screen and i destroy sprite#2 then nothing happens.
UPDATE:
So i did more testing,
Even if i completely remove any connection between sprite#1 and sprite#2, so no references, no functions calls, NOTHING AT ALL, and i call Destroy(sprite#2) after sprite#1 called OnBecameVisible() the first time, it STILL calls OnBecameVisible() AGAIN on sprite#1… wtf???
UPDATE:
Apparently ANY sprite that exists and is visible on the screen gets OnBecameVisible() called when sprite#1 is destroyed. AMAZING!