Object appears even though it is inactive

I am having the following problem.
During gameplay I am making some gui buttons active or inactive.
Under certain (replicable) circumstances, inactive buttons still appear in the gameview (they don’t appear in the sceneView).

In the screenshot bellow, it is the button saying “Rest for a day”.
I can see in the inspector that it is inactive:


While this happens (inside Unity), if I try to resize the gameview, the button dissapears.

It is very confusing during testing. Any idea of what happens?

Hi, @kkoyan! Try this UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(RectTransform layoutRoot)