当前位置: 首页>>代码示例>>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;未经允许,请勿转载。