user-interfaceunity-game-engineunity3d-ui

What's the best practice for activating/deactivating UI components in Unity3D?


I'm making a UI for my Unity3D game and am activating/deactivating UI components in order to display or hide them, which works but is slow. The first time a UI component is activated, it is particularly slower than thereafter. Is there a best practice as to how UI should be hidden/displayed?


Solution

  • Try disabling canvas renderer. It should be a lot less stressing on the CPU than using GameObject.SetActive() if you have nested panels and what not.