Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Enabling a disabled "DoodleAnimator" component activates OnBecameInvisible

A topic by wedgiebee created 14 days ago Views: 12
Viewing posts 1 to 1

The bug:

  • Enabling a disabled DoodleAnimator component activates OnBecameInvisible
  • Found it while trying to make a script that disables DoodleAnimator components in OnBecameInvisible and re-enables them in OnBecameVisible
  • I'm on Unity 2019.3.0f6

Repro:

  • Add a Doodle asset to the scene as a sprite
  • Make a script with the following function
    private void OnBecameInvisible()
    {
        Debug.Log("i am invisible :o");
    }
  • Add that script to the gameobject of the doodle you added to the scene
  • Enter play mode, disable/uncheck the DoodleAnimator component on the gameobject, then re-enable it
  • Observe in the log the message "i am invisible :o" appears. The callstack looks like:
i am invisible :o
UnityEngine.Debug:Log(Object)
testo:OnBecameInvisible() (at Assets/Scripts/testo.cs:9)
UnityEngine.Renderer:set_enabled(Boolean)
DoodleStudio95.DoodleAnimator:SetVisible(Boolean)
DoodleStudio95.DoodleAnimator:Hide()
DoodleStudio95.DoodleAnimator:Stop()
DoodleStudio95.DoodleAnimator:OnEnable()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)