Performance concerns with instancing or enabling ScreenGuis

Let’s say if you have a temporary ScreenGui, such as a shop or loading screen, that you need every once in a while but otherwise should be gone.

Would it be better to instance them when they are needed, then destroy them after the player is done, or is it better to just use the enabled/disabled property to hide it until it is needed again? Are there any performance benefits to either of these, or is the difference way too small to have a real impact? I’m concerned having lots of ScreenGuis will cause some lag issues, but instancing and destroying is expensive too.

If the interface in question is only every once in a while then the expensive of one-time instancing is negligible. I personally take preference in enabling and disabling interfaces that a player interacts with most and instance others that don’t always need to be there.

I’m not sure about the technicalities behind Gui instances besides them probably adding to client memory use just for existing and being kept on the client but in either case you do remove a deal of computational costs from the Gui engine because a nonexistent or disabled Gui doesn’t need to render any elements even if it isn’t static.

1 Like