Renderer.IsVisible jump repeatedly between true and false

I was using obj.GetComponent().IsVisible to control my UI’s visible state.However ,Renderer.IsVisible jump repeatedly between true and false when this obj wasn’t in my game scene

I’m not sure how you’re getting Renderer.isVisible if the GameObject isn’t in the game scene, but the inconsistencies in bool value may be the cause of how Renderer.isVisible is calculated. As stated in the Unity Documentation, Renderer.isVisible takes is true whenever the Renderer in question needs to be rendered. This includes when it needs to be rendered for shadows, regardless of if it’s on screen or not. I see you mentioned UI elements, so this may all be irrelevant. If you’re trying to test whether or not a given UI element is hidden (invisible), use UIElements.Visibility.Hidden, as shown in the properties section of UIElements.VisualElement. If however you’re trying to find whether or not a given UI element is visible on the current screen, try the answer suggested on this forum post from 2017: Test if UI element is visible on screen.