using UnityEngine; public class PathUtility { public static string GetRelationPath(Transform tranform) { System.Text.StringBuilder _stringBuilder = new System.Text.StringBuilder(); if(tranform.parent != null && tranform.parent.parent == null) { return tranform.name; } while(tranform.parent != null) { _stringBuilder.Insert(0,string.Format("/{0}",tranform.name)); tranform = tranform.parent; } string _result = _stringBuilder.ToString().Substring(1); _stringBuilder = null; return _result; } }