阅读背景:

清除节点下的所有子节点中UILabel的内容

来源:互联网 

Selection.activeObject:可以获取选中的节点


using UnityEngine;
using System.Collections;
using UnityEditor;

public class MyEditorClearLabel
{
	//批量清除UILabel的内容
	[MenuItem ("ToolClear/ClearUILabel")]
	static void ClearUILabel ()
	{
		if(Selection.activeObject != null)
		{
			UILabel[] trans = ((GameObject)Selection.activeObject).GetComponentsInChildren<UILabel>(true);
			for(int i = 0; i < trans.Length; ++i)
			{
				trans[i].text = "";
			}
		}
	}
}using 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: