unity3d小插件之查找结点路径并自动写入到剪贴板
发布日期:2022-03-03 10:44:06 浏览次数:6 分类:技术文章

本文共 1490 字,大约阅读时间需要 4 分钟。

using UnityEngine;using UnityEditor;using System.Collections;using System.Collections.Generic;using System.IO;public class FindPath{    public static List
filelist = new List
(); public static List
deallist = new List
(); public static string filepath; // Use this for initialization [MenuItem("My Game/FindPath")] public static void GetPath() { clearmemory(); recursiveFind(Selection.activeGameObject.gameObject); printinScreen(); clearmemory(); } public static void recursiveFind(GameObject go) { if (go != null) { filelist.Add(go.name); if (go.transform.parent != null) { recursiveFind(go.transform.parent.gameObject); } } } public static void clearmemory() { filelist.Clear(); deallist.Clear(); } public static void printinScreen() { for(int i = filelist.Count -1 ; i >= 0 ; i --) { string str = filelist[i]; if(i != 0) { str = str +"/"; } deallist.Add(str); } string showstr = ""; foreach(var list in deallist) { showstr += list; } Debug.Log(showstr); TextEditor te = new TextEditor(); te.content = new GUIContent(showstr); te.SelectAll(); te.Copy(); } }

转载地址:https://blog.csdn.net/yangjie6898862/article/details/51897335 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:平衡二叉树的简单建立--示例
下一篇:c#中实现的万能变量类

发表评论

最新留言

不错!
[***.144.177.141]2024年04月25日 20时11分00秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

打开我的收藏夹 -- Python数据分析杂谈 2019-04-27
上手Pandas,带你玩转数据(1)-- 实例详解pandas数据结构 2019-04-27
上手Pandas,带你玩转数据(2)-- 使用pandas从多种文件中读取数据 2019-04-27
上手Pandas,带你玩转数据(3)-- pandas数据存入文件 2019-04-27
爬虫遇上不让右击、不让F12的网站,该怎么办? 2019-04-27
上手Pandas,带你玩转数据(4)-- 数据清洗 2019-04-27
上手Pandas,带你玩转数据(5)-- 数据转换与数据定位 2019-04-27
上手Pandas,带你玩转数据(6)-- 摆脱对pandas可视化丑图的刻板印象吧 2019-04-27
从零开始,学会Python爬虫不再难!!! -- (1)开篇:初识爬虫,基础铺垫 丨蓄力计划 2019-04-27
从零开始,学会Python爬虫不再难!!! -- (2)承接:解析网页,抓取标签 丨蓄力计划 2019-04-27
AttributeError: module ‘urllib‘ has no attribute ‘quote‘的解决办法 2019-04-27
linux shell — 6.初识 EXT2 文件系统 2019-04-27
Java — String(字符串) 2019-04-27
linux shell — 7.linux 磁盘与文件系统管理 2019-04-27
linux shell — 8.linux 磁盘与文件系统管理(2) 2019-04-27
Java — 事件监听、事件处理 初体验 2019-04-27
linux — Centos 7(第一天) 使用时出现的问题及解决方法 2019-04-27
数据结构 — 图的概述 2019-04-27
Centos 7 上 Eclipse 无法输入中文解决方法 2019-04-27
数据结构 — 图之邻接表存储创建和深度优先遍历 2019-04-27