當前位置: 首頁>>代碼示例>>C#>>正文


C# SerializedObject.SetIsDifferentCacheDirty方法代碼示例

本文整理匯總了C#中UnityEditor.SerializedObject.SetIsDifferentCacheDirty方法的典型用法代碼示例。如果您正苦於以下問題:C# SerializedObject.SetIsDifferentCacheDirty方法的具體用法?C# SerializedObject.SetIsDifferentCacheDirty怎麽用?C# SerializedObject.SetIsDifferentCacheDirty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEditor.SerializedObject的用法示例。


在下文中一共展示了SerializedObject.SetIsDifferentCacheDirty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DoImportBitmapFont

        public static void DoImportBitmapFont(string fntPatn)
        {
            if (!IsFnt(fntPatn)) return;

            TextAsset fnt = AssetDatabase.LoadMainAssetAtPath(fntPatn) as TextAsset;
            string text = fnt.text;
            FntParse parse = FntParse.GetFntParse(ref text);
            if (parse == null) return;

            string fntName = Path.GetFileNameWithoutExtension(fntPatn);
            string rootPath = Path.GetDirectoryName(fntPatn);
            string fontPath = string.Format("{0}/{1}.fontsettings", rootPath, fntName);
            string texPath = string.Format("{0}/{1}", rootPath, parse.textureName);

            Font font = AssetDatabase.LoadMainAssetAtPath(fontPath) as Font;
            if (font == null)
            {
                font = new Font();
                AssetDatabase.CreateAsset(font, fontPath);
                font.material = new Material(Shader.Find("UI/Default"));
                font.material.name = "Font Material";
                AssetDatabase.AddObjectToAsset(font.material, font);
            }

            SerializedObject so = new SerializedObject(font);
            so.Update();
            so.FindProperty("m_FontSize").floatValue = parse.fontSize;
            so.FindProperty("m_LineSpacing").floatValue = parse.lineHeight;
            UpdateKernings(so, parse.kernings);
            so.ApplyModifiedProperties();
            so.SetIsDifferentCacheDirty();

            Texture2D texture = AssetDatabase.LoadMainAssetAtPath(texPath) as Texture2D;
            if (texture == null)
            {
                Debug.LogErrorFormat(fnt, "{0}: not found '{1}'.", typeof(BFImporter), texPath);
                return;
            }

            TextureImporter texImporter = AssetImporter.GetAtPath(texPath) as TextureImporter;
            texImporter.textureType = TextureImporterType.GUI;
            texImporter.mipmapEnabled = false;
            texImporter.SaveAndReimport();

            font.material.mainTexture = texture;
            font.material.mainTexture.name = "Font Texture";

            font.characterInfo = parse.charInfos;

            AssetDatabase.SaveAssets();
        }
開發者ID:xxyz,項目名稱:Be-Music-Viewer,代碼行數:51,代碼來源:BFImporter.cs

示例2: addSelectedObjects

	void addSelectedObjects(){
		MB2_MeshBakerRoot mom = (MB2_MeshBakerRoot) target;
		if (mom == null){
			Debug.LogError("Must select a target MeshBaker to add objects to");
			return;
		}
		List<GameObject> newMomObjs = GetFilteredList();
		
		MB_EditorUtil.RegisterUndo(mom, "Add Objects");
		List<GameObject> momObjs = mom.GetObjectsToCombine();
		int numAdded = 0;
		for (int i = 0; i < newMomObjs.Count;i++){
			if (!momObjs.Contains(newMomObjs[i])){
				momObjs.Add(newMomObjs[i]);
				numAdded++;
			}
		}
		SerializedObject so = new SerializedObject(mom);
		so.SetIsDifferentCacheDirty();
		
		if (numAdded == 0){
			Debug.LogWarning("Added 0 objects. Make sure some or all objects are selected in the hierarchy view. Also check ths 'Only Static Objects', 'Using Material' and 'Using Shader' settings");
		} else {
			Debug.Log("Added " + numAdded + " objects to " + mom.name);
		}
	}
開發者ID:FaGame,項目名稱:Dockyard-Construction-Site-Motorbike,代碼行數:26,代碼來源:MB_MeshBakerEditorWindow.cs


注:本文中的UnityEditor.SerializedObject.SetIsDifferentCacheDirty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。