Canvases.cs 645 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEngine;
  2. namespace FirstGearGames.Utilities.Objects
  3. {
  4. public static class Canvases
  5. {
  6. /// <returns>Returns true part is within whole.</returns>
  7. public static void SetActive(this CanvasGroup group, bool active, bool setAlpha)
  8. {
  9. if (group == null)
  10. return;
  11. if (setAlpha)
  12. {
  13. if (active)
  14. group.alpha = 1f;
  15. else
  16. group.alpha = 0f;
  17. }
  18. group.interactable = active;
  19. group.blocksRaycasts = active;
  20. }
  21. }
  22. }