Global Game Jam 2023
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
505 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NaughtyAttributes;
  5. /// <summary>
  6. ///
  7. /// </summary>
  8. public static class GameObjectExtension
  9. {
  10. public static bool isTagInParent(this GameObject go, string tag)
  11. {
  12. Transform current = go.transform;
  13. while (current != null)
  14. {
  15. if (current.gameObject.CompareTag(tag))
  16. return true;
  17. current = current.parent;
  18. }
  19. return false;
  20. }
  21. }