using UnityEditor;
using UnityEngine;
using System.IO;
using System.Collections;
using System.Collections.Generic; public class MyTools
{
[MenuItem("MyTools/RenameSelected")]
static void RenameSelected()
{
Transform[] trans = Selection.GetTransforms(SelectionMode.Assets); if (trans.Length > )
{
foreach (Transform item in trans)
{
string tempName = item.gameObject.name; string[] ary = tempName.Split(new char[] { '(', ')' }, System.StringSplitOptions.RemoveEmptyEntries); tempName = ary[] + " " + ary[]; item.name = tempName;
}
}
else
{
Debug.Log("请选择父对象");
}
} [MenuItem("MyTools/AddEmptyToSelected")]
static void AddEmptyToSelected()
{
Transform[] trans = Selection.GetTransforms(SelectionMode.Assets);
if (trans.Length > )
{
GameObject go = new GameObject();
go.name = "GameObject";
go.transform.parent = trans[];
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.Euler(Vector3.zero);
go.transform.localScale = new Vector3(, , );
}
else
{
Debug.Log("请选择父对象");
} // AssetDatabase.CreateFolder("Assets","ZJW");
// Undo.PerformRedo(); //Undo.PerformUndo(); //foreach (Object o in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
//{
// Debug.Log(o.name);
// // if (!(o is object))
// //continue; // //assetdatabase.renameasset(assetdatabase.getassetpath(o), "1" + o.name);
//} // if (Selection.objects.Length <= 0)
// {
// Debug.Log("gos[0].name");
// }
// else
// {
// foreach (Object o in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
// {
// if (!(o is Object))
// continue;
// AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(o), "1" + o.name);
// }
// }
} [MenuItem("MyTools/CreateFullDirectory")]
static void CreateFullDirectory()
{
if (!Directory.Exists(Application.dataPath + "/Scripts"))
{
AssetDatabase.CreateFolder("Assets", "Scripts");
} if (!Directory.Exists(Application.dataPath + "/Documents"))
{
AssetDatabase.CreateFolder("Assets", "Documents");
} if (!Directory.Exists(Application.dataPath + "/Scenes"))
{
AssetDatabase.CreateFolder("Assets", "Scenes");
} if (!Directory.Exists(Application.dataPath + "/Plugins"))
{
AssetDatabase.CreateFolder("Assets", "Plugins");
} if (!Directory.Exists(Application.dataPath + "/Models"))
{
AssetDatabase.CreateFolder("Assets", "Models");
} if (!Directory.Exists(Application.dataPath + "/Materials"))
{
AssetDatabase.CreateFolder("Assets", "Materials");
} if (!Directory.Exists(Application.dataPath + "/Animations"))
{
AssetDatabase.CreateFolder("Assets", "Animations");
} if (!Directory.Exists(Application.dataPath + "/Audios"))
{
AssetDatabase.CreateFolder("Assets", "Audios"); if (!Directory.Exists(Application.dataPath + "/Audios/Sounds"))
{
Directory.CreateDirectory(Application.dataPath + "/Audios/Sounds");
} if (!Directory.Exists(Application.dataPath + "/Audios/Musics"))
{
Directory.CreateDirectory(Application.dataPath + "/Audios/Musics");
}
} if (!Directory.Exists(Application.dataPath + "/Atals"))
{
AssetDatabase.CreateFolder("Assets", "Atals");
} if (!Directory.Exists(Application.dataPath + "/Fonts"))
{
AssetDatabase.CreateFolder("Assets", "Fonts");
} if (!Directory.Exists(Application.dataPath + "/Prefabs"))
{
AssetDatabase.CreateFolder("Assets", "Prefabs");
} if (!Directory.Exists(Application.dataPath + "/Shaders"))
{
AssetDatabase.CreateFolder("Assets", "Shaders");
} if (!Directory.Exists(Application.dataPath + "/StreamingAssets"))
{
AssetDatabase.CreateFolder("Assets", "StreamingAssets");
} if (!Directory.Exists(Application.dataPath + "/Effects"))
{
AssetDatabase.CreateFolder("Assets", "Effects");
}
}
} //public class TestWindow : EditorWindow
//{
// string[] inspectToolbarStrings = { "Textures", "Materials", "Meshes" };
// enum InspectType
// {
// Textures, Materials, Meshes
// }; // InspectType ActiveInspectType = InspectType.Textures; // [MenuItem("MyTools/TestWindow")]
// static void Init()
// {
// TestWindow window = (TestWindow)EditorWindow.GetWindow(typeof(TestWindow));
// window.minSize = new Vector2(100, 300);
// }
// void OnGUI()
// {
// bool b = false;
// if (b =GUILayout.Toggle(true, "123"))
// {
// b = true;
// } // string str= GUILayout.TextArea(""); // if (GUILayout.Button("Meshes"))
// {
// Debug.Log(str);
// } // if (GUILayout.Button("Textures"))
// { // } // if (GUILayout.Button("Materials"))
// { // }
// }
//}

MyTools的更多相关文章

  1. [Proposal]MyTools

    [名称]:MyTools [需求分析]:现在市场上常用的移动端工具类APP,要么功能单一,如手电筒,录音机,指南针等,要么虽然有多种功能的整合,但只是单一的堆砌,内部依然是一个个独立的功能模块,并未形 ...

  2. maven

    maven常见问题问答 1.前言 Maven,发音是[`meivin],"专家"的意思.它是一个很好的项目管理工具,很早就进入了我的必备工具行列,但是这次为了把project1项目 ...

  3. 使用私有Pod Spec的类库--提高公司开发效率

    前言 找了这么长时间,再次开始去尝试Cocoapods了.前面已经写过一篇关于如何把自己的Github上的代码库添加Cocoapods支持.现在就让我们看一下如果搭建私有的Spec吧. 之所以构建私有 ...

  4. PostgreSQL function examples

    warehouse_db=# CREATE TABLE warehouse_tbl(warehouse_id INTEGER NOT NULL,warehouse_name TEXT NOT NULL ...

  5. Spring Shedule Task之注解实现 (两次启动Schedule Task 的解决方案)

    在spring 中的新引入的task 命名空间.可以部分取代 quartz 功能,配置和API更加简单,并且支持注解方式. 第一步: 在Spring的相关配置文件中(applicationContex ...

  6. Java高级规范之四

    四十一.控制层不能调用model层除了最顶级的接口外的任何内容.要通过new顶级接口才能调用. 不规范示例: public class UserServiceImpl{ private UserDAO ...

  7. Windows WMIC命令使用详解

    本文转载出处http://www.jb51.net/article/49987.htm www.makaidong.com/博客园文/32743.shtml wmic alias list brief ...

  8. keepalived健康检查方式

    keepalived对后端realserver的健康检查方式主要有以下几种: TCP_CHECK:工作在第4层,keepalived向后端服务器发起一个tcp连接请求,如果后端服务器没有响应或超时,那 ...

  9. 测试文档锁:doc.LockDocument()

    /// <summary> /// 总结:用到DocumentManager.Open(filePath)时,如果是ForWrite,就需要用到lock文档锁. /// </summ ...

随机推荐

  1. hdu 5187(高精度快速幂)

    zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  2. Python 解释器中方向键无法使用的解决方法

    如下: SyntaxError: invalid syntax >>> ^[[A File "<stdin>", line 1 ^ SyntaxErr ...

  3. 【互动问答分享】第5期决胜云计算大数据时代Spark亚太研究院公益大讲堂

    Spark亚太研究院100期公益大讲堂 [第5期互动问答分享] Q1:spark怎样支持即席,应该不是spark sql吧,是hive on spark么? Spark1.0 以前支持即席查询的技术是 ...

  4. 来,让我们谈一谈 Normalize.css

    Normalize.css 只是一个很小的CSS文件,但它在默认的HTML元素样式上提供了跨浏览器的高度一致性.相比于传统的CSS reset,Normalize.css是一种现代的.为HTML5准备 ...

  5. UTC时间

    世界的每个地区都有自己的本地时间,在Internet及无线电通信时,时间的统一非常重要! 整个地球分为二十四时区,每个时区都有自己的本地时间.在国际无线电通信中,为统一而普遍使用一个标准时间,称为通用 ...

  6. P1162 填涂颜色 洛谷

    题目描述 由数字0 组成的方阵中,有一任意形状闭合圈,闭合圈由数字1构成,围圈时只走上下左右4个方向.现要求把闭合圈内的所有空间都填写成2.例如:6X6的方阵(n=6),涂色前和涂色后的方阵如下: 0 ...

  7. ( 转 ) mysql 实战 or、in与union all 的查询效率

    OR.in和union all 查询效率到底哪个快. 网上很多的声音都是说union all 快于 or.in,因为or.in会导致全表扫描,他们给出了很多的实例. 但真的union all真的快于o ...

  8. [CTSC2017]密钥

    传送门:http://uoj.ac/problem/297 “无论哪场比赛,都要相信题目是水的” 这不仅是HNOI2018D2T3的教训,也是这题的教训,思维定势真的很可怕. 普及组水题,真是愧对CT ...

  9. [xsy2164]theory

    又积累了一个网络流模型:最大权闭合子图,相关证明去看论文,感觉自己不是很懂证明,但现在还是先把建模记下来再说吧 枚举一个点,硬点它一定要被选中,那么以它为根,如果选了$x$就必须要选$fa_x$,这就 ...

  10. 【强联通分量缩点】【最短路】【spfa】bzoj1179 [Apio2009]Atm

    缩点后转化成 DAG图上的单源最长路问题.spfa/dp随便. #include<cstdio> #include<queue> #include<algorithm&g ...