位置: 编程技术 - 正文
推荐整理分享删除丢失脚本(脚本被删除),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:删除脚本怎么写,执行脚本删除自己,删除丢失脚本文件,windows删除脚本,快速删除脚本错误的方法,删除脚本怎么写,删除丢失脚本文件,删除丢失脚本文件,内容如对您有帮助,希望把文章链接给更多的朋友!
有时候一开始写了一些脚本,但到项目后期觉得这些脚本没用,就删掉了,但有些prefab上如果挂有这些脚本,就会提示警告:脚本已丢失,多了就非常不爽。
所以需要找到所有的丢失脚本的路径,并删除。
查找代码如下:
using UnityEngine;using UnityEditor;public class FindMissingScriptsRecursively : EditorWindow { static int go_count = 0, components_count = 0, missing_count = 0; [MenuItem("Window/FindMissingScriptsRecursively")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(FindMissingScriptsRecursively)); } public void OnGUI() { if (GUILayout.Button("Find Missing Scripts in selected GameObjects")) { FindInSelected(); } } private static void FindInSelected() { GameObject[] go = Selection.gameObjects; go_count = 0; components_count = 0; missing_count = 0; foreach (GameObject g in go) { FindInGO(g); } Debug.Log(string.Format("Searched {0} GameObjects, {1} components, found {2} missing", go_count, components_count, missing_count)); } private static void FindInGO(GameObject g) { go_count; Component[] components = g.GetComponents<Component>(); for (int i = 0; i < components.Length; i) { components_count; if (components[i] == null) { missing_count; string s = g.name; Transform t = g.transform; while (t.parent != null) { s = t.parent.name "/"s; t = t.parent; } Object.DestroyImmediate(components[i]); Debug.Log (s " has an empty script attached in position: " i, g); } } // Now recurse through each child GO (if there are any): foreach (Transform childT in g.transform) { //Debug.Log("Searching " childT.name " " ); FindInGO(childT.gameObject); } }}
unity3d中的坑和解决方案 unity3d中的坑和解决方案unity3d是一个很牛x的引擎,当然其也有一些东西是不太好或者说不习惯的,下面列举一些:1、制作特效时,使用animation记录的位
SURF特征提取与匹配实践 上回说到,最近看了点算法,也实践了FAST关键点的提取,近来事多了些,所以今天才又有点成果。依然是C#实现,在Unity3d里面做的,先上J,哦不,上图
C# List多字段排序 根据符文的品质和战斗力排序,当品质一致的按战斗力排序;intSortRunesInfoByQualityAndfightPower(FuWenShowVOobj1,FuWenShowVOobj2){intres=0;if((null==obj1)(null==obj2))return0;else
标签: 脚本被删除
本文链接地址:https://www.jiuchutong.com/biancheng/375714.html 转载请保留说明!友情链接: 武汉网站建设