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.

21 lines
497 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public static class TransformUtility
  5. {
  6. public static float GetGlobalIndex(this Transform transform)
  7. {
  8. float retVal = transform.GetSiblingIndex() + 1;
  9. transform = transform.parent;
  10. while (transform != null)
  11. {
  12. retVal /= 10;
  13. retVal += transform.GetSiblingIndex() + 1;
  14. transform = transform.parent;
  15. }
  16. return retVal;
  17. }
  18. }