2020-08-18 17:38:09 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-09-04 21:36:40 +10:00
|
|
|
|
using UnhollowerBaseLib;
|
2020-08-18 17:38:09 +10:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Explorer
|
|
|
|
|
{
|
|
|
|
|
public static class UnityExtensions
|
|
|
|
|
{
|
|
|
|
|
public static string GetGameObjectPath(this Transform _transform)
|
|
|
|
|
{
|
|
|
|
|
return GetGameObjectPath(_transform, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetGameObjectPath(this Transform _transform, bool _includeThisName)
|
|
|
|
|
{
|
|
|
|
|
string path = _includeThisName ? ("/" + _transform.name) : "";
|
|
|
|
|
GameObject gameObject = _transform.gameObject;
|
|
|
|
|
while (gameObject.transform.parent != null)
|
|
|
|
|
{
|
|
|
|
|
gameObject = gameObject.transform.parent.gameObject;
|
|
|
|
|
path = "/" + gameObject.name + path;
|
|
|
|
|
}
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|