1. 程式人生 > >Unity 解決 An asset is marked with HideFlags.DontSave but is included in the build 問題。

Unity 解決 An asset is marked with HideFlags.DontSave but is included in the build 問題。

找來找去發現是由於UILabel 引用了Library/unity editor resources中的字型引發的。

所以我寫了個指令碼,來check所有UILabel的字型名稱, 並顯示錯誤引用字型的Prefab

using UnityEngine;  
using System.Collections;  
using System.Collections.Generic;  
using UnityEditor;  
using System.IO;  

public class PrefabCheck : MonoBehaviour {
	// 在選單來建立 選項 , 點選該選項執行搜尋程式碼  
	[MenuItem("Tools/Check Font")]
	static void CheckSceneSetting() {
		List<string> dirs = new List<string>();  
		GetDirs(Application.dataPath, ref dirs);  

	}  
	//引數1 為要查詢的總路徑, 引數2 儲存路徑  
	private static void GetDirs(string dirPath, ref List<string> dirs)  
	{  
		foreach (string path in Directory.GetFiles(dirPath))  
		{  
			//獲取所有資料夾中包含字尾為 .prefab 的路徑  
			if (System.IO.Path.GetExtension(path) == ".prefab")  
			{  
				dirs.Add(path.Substring(path.IndexOf("Assets")));
				GameObject obj =  (GameObject)AssetDatabase.LoadAssetAtPath (path.Substring(path.IndexOf("Assets")), typeof(GameObject));
				if(obj != null){
					GameObject instance =  Instantiate(obj);
					UILabel[] labels = instance.GetComponentsInChildren<UILabel>();
					foreach(UILabel label in labels){
						if(label.trueTypeFont != null && label.trueTypeFont.name.Contains("Lucida")){
							Debug.Log(label.trueTypeFont.name);
							Debug.Log(path.Substring(path.IndexOf("Assets")));  
						}
						if(label.bitmapFont != null && label.bitmapFont.name.Contains("Lucida")){
							Debug.Log(label.bitmapFont.name);
							Debug.Log(path.Substring(path.IndexOf("Assets")));
						}
					}
					DestroyImmediate(instance);
				} else {
					Debug.LogError(path.Substring(path.IndexOf("Assets")));  
				}


			}  
		}  
		
		if (Directory.GetDirectories(dirPath).Length > 0)  //遍歷所有資料夾  
		{  
			foreach (string path in Directory.GetDirectories(dirPath))  
			{  
				GetDirs(path, ref dirs);  
			}  
		}  
	}  
}


相關推薦

Unity 解決 An asset is marked with HideFlags.DontSave but is included in the build 問題

找來找去發現是由於UILabel 引用了Library/unity editor resources中的字型引發的。 所以我寫了個指令碼,來check所有UILabel的字型名稱, 並顯示錯誤引用字型的Prefab using UnityEngine; using

unity(使用了NGUI) 在Build時遇見DontSave but is included in the build

clu fonts 自動生成 tsa included image sources ext lag 錯誤提示: An asset is marked with HideFlags.DontSave but is included in the build:Asset: ‘L

python出現"pip is configured with locations that require TLS/SSL, however the ssl....."錯誤解決辦法

解決方法 新版的pip預設要使用SSL,可以通過設定修改,修改pip.conf檔案;還有一種辦法是openssl-dev,然後重新編譯安裝,只是在編譯的過程中加入 --enable-optimizations 具體如下: sudo yum install openssl-deve

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

make 重新 test however con conf ins ava OS # 背景 安裝pip後發現執行pip install pytest,提示下面錯誤 pip is configured with locations that require TLS/S

Chatbots Magazine is created with ❤ by 700+ bot innovators from around the world.

Chatbots MagazineBlockedUnblockFollowFollowingThe #1 Place to Learn About Chatbots. Founded by @MattPRD. Edited by @KelliKissack. Senior Reporter is @PaulB

安裝Django1.11.7時發現的問題,關於pip is configured with locations that require TLS/SSL, however the ssl

首先設定了一個虛擬環境mkvirtualenv -p /usr/bin/python3.5 +虛擬環境名稱然後下載djangopip install Django==1.11.7報錯了出現了很長一堆,然後開始往上尋找pip的錯誤,發現pip顯示pip is configure

JNI開發篇——報錯:Flag android.useDeprecatedNdk is no longer supported and will be removed in the next……

大概意思就是說: android.useDeprecatedNdk不再支援了 讓使用CMake or ndk-build 然後還有連結 解決方法: 1、先通過SDKManager下載:CMake和LLDB 2、在build.gradle的defaultConfig節點下加入:

【SVN】' ' is scheduled for addition,but is missing

這個問題出現,常常便隨這另外一個問題的出現: 檔案裡邊的內容都是綠色的,但是資料夾確實紅的。(我們常會遇到這個問題,一般是由於提交後的網路延遲的問題) 但是這種情況下就不是了!   SVN,紅色表示沒有提交!但是你提交後就會報這個錯誤。 原因: 你對新建的

Openwrt working with patches in the build system (8)

Reference :https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem example:   in the kernel top-level directory   # quilt new

Resolve "The security token included in the request is expired" Errors

All application API requests to Amazon Web Services (AWS) must be cryptographically signed using credentials issued by AWS. If your

解決linux下sudo更改檔案許可權報錯xxxis not in the sudoers file. This incident will be reported.

Linux中普通使用者用sudo執行命令時報”xxx is not in the sudoers file.This incident will be reported”錯誤,解決方法就是在/etc/sudoers檔案裡給該使用者新增許可權。如下: 1.切

a cycle was detected in the build path of project 異常解決

a cycle was detected in the build path of project xxxx出現在這裡,專案報著紅色感嘆號!說明專案中有相互依賴的元件,而編譯不過解決:error改成wa

【SVN】' ' is scheduled for addition,but is missing

這個問題出現,常常便隨這另外一個問題的出現: 檔案裡邊的內容都是綠色的,但是資料夾確實紅的。(我們常會遇到這個問題,一般是由於提交後的網路延遲的問題) 但是這種情況下就不是了! SVN,紅色表示沒有提交!但是你提交後就會報這個錯誤。 原因: 你對新建的檔案進

idea出現:error:java: Target level '1.7' is incompatible with source level '1.8'.解決辦法

tin get 技術 strong mark 更改 ID HR ati 當我們開始使用idea的時候,編譯jsp程序我們有可能出現編譯錯誤,然而我們的代碼又沒有什麽問題。 解決方法一:我們開始的時候可以通過修改java compiler來解決這樣的問題,點擊file菜

C#.net mysql There is already an open datareader associated with this command引發的問題

關閉 close csdn != 定義 spa apt 因此 關鍵字 【參考】There is already an open datareader associated with this command引發的問題 我在語句中並未使用 DataReader,未何也提示

5分鐘學會MySQL-this is incompatible with sql_mode=only_full_group_by錯誤解決方案

                                          &nb

解決IDEA安裝外掛Plugin 'Scala' is incompatible with this installation

今天從硬碟安裝idea -Scala外掛時,報如下錯誤: Plugin 'Scala' is incompatible with this installation 這個問題主要是因為idea版本與外掛版本不一致導致。 1.檢視idea版本 關閉所有工程,進入初始介面 看到我們

[MySQL]快速解決"Table '.\sjzlf\zbp_post' is marked as crashed and should be repaired"故障

為了不冒失修復,故採取保守做法,我們知道 MySQL 一個高效的管理工具便是 PhpMyAdmin,而在該管理軟體中就包含了對錶的檢查、分析、修復、優化功能,比起網上提供的含糊命令列來說更安全更簡便。         通過實

[MySQL]快速解決"Table '.sjzlfzbp_post' is marked as crashed and should be repaired"故障

alt 管理 net crash 測試 height 網上 tab 反饋 為了不冒失修復,故采取保守做法,我們知道 MySQL 一個高效的管理工具便是 PhpMyAdmin,而在該管理軟件中就包含了對表的檢查、分析、修復、優化功能,比起網上提供的含糊命令行來說更安全更簡便。

swift 報錯 Call can throw, but it is not marked with 'try' and the error is not handled

在開發中使用正則表示式時報了這樣的問題:Call can throw, but it is not marked with 'try' and the error is not handled,即: let regex:NSRegularExpression = NSRegularExpression(pa