hash tool
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
class SelectAllOfTagHash : ScriptableWizard
|
||||
{
|
||||
|
||||
string tagName = "ExampleTag";
|
||||
|
||||
|
||||
[MenuItem("Hash/Get Hash")]
|
||||
static void SelectAllOfTagHashWizard()
|
||||
{
|
||||
ScriptableWizard.DisplayWizard(
|
||||
"Hash/Get Hash",
|
||||
typeof(SelectAllOfTagHash),
|
||||
"Get Hash");
|
||||
}
|
||||
|
||||
void OnWizardCreate()
|
||||
{
|
||||
//AssetDatabase.RemoveObjectFromAsset(Selection.objects[0]);
|
||||
//AssetDatabase.CreateAsset(Selection.objects[0], "Assets/"+ Selection.objects[0].name + ".asset");
|
||||
|
||||
UnityEngine.GameObject obj = (GameObject)Selection.activeObject;
|
||||
if (obj == null)
|
||||
{
|
||||
Debug.LogError("You must select GameObj first!");
|
||||
return;
|
||||
}
|
||||
string result = "";
|
||||
|
||||
var children = obj.GetComponentsInChildren<Transform>();
|
||||
|
||||
foreach(var selectChild in children)
|
||||
{
|
||||
var tempChild = selectChild;
|
||||
|
||||
if (tempChild != null && tempChild != obj.transform)
|
||||
{
|
||||
result = tempChild.name;
|
||||
while (tempChild.parent != obj.transform && tempChild.parent != null)
|
||||
{
|
||||
tempChild = tempChild.parent;
|
||||
result = string.Format("{0}/{1}", tempChild.name, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Debug.Log(string.Format("GameObject:{0}, Hash:{1}", result, (uint)Animator.StringToHash(result)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3d086c88fee2954d9cee0d1acca0969
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user