项目中有需要批量替换字体以及字号的需求,一般也就是多语言处理吧。

提供界面如下:

手机拍图,就这样凑合看吧。但是代码不打折。

紧急避让,我只提供修改UILabel以及UIPopupList 下的字体,字号。其他需求的,可以绕远了。还有哈,代码写的很渣渣,因为自己用嘛。还有所有权归我本人所有,一切用于商业用途的,请自己联系博主,上缴费用,谢谢~~~~(赚钱好方法)

using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO; //
public class ReplaceFontEditor
{
[MenuItem("XmlTest/打开替换字体窗口", false, )]
static void OpenReplaceFontEditor()
{
UIReplaceFontEditorWindow.Init();
}
}
 using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
using System.Text;
using LuaInterface; public class FontInfo
{ } public class UIReplaceFontEditorWindow : EditorWindow
{
private static UIReplaceFontEditorWindow window; private static Dictionary<string, Font> allFonts = new Dictionary<string, Font>(); // key: fontName, value : Font
private static Dictionary<string, HashSet<int>> allFontsSize = new Dictionary<string, HashSet<int>>(); // key: fontName, value :Hash<int>, Hash<int> 保存所有的字号(去重)
private static Dictionary<string, Dictionary<int, HashSet<string>>> allFontNameSizePrefabName = new Dictionary<string, Dictionary<int, HashSet<string>>>(); // key : fontName, value: < key:fontSize, value: prefabNames > private static List<GameObject> allNeedReplacePrefab = new List<GameObject>();
private static string[] allFontName = new string[]; // 预先分配
private static string writefileinfo = "字体名称、字号文件(fontsizeinfo.txt)写入状态:空闲状态 ";
// prefab文字信息保存目录
private static string prefabFontSizeInfoSaveDir = "dir name";
private int ID = -;
// 待替换字体
public Font previousFont = null;
private string previourFontSelectInfo = "";
// 新字体
public Font newFont = null;
private string newFontSelectInfo = "";
// 字体对应文件
public string fontSizeFilePath = "file name";
private string fontSizeFilePathSelectInfo = "";
// 保存字号对应文件
private ArrayList fontSizeArray = new ArrayList();
// 新prefab保存目录
public string newPrefabSaveDir = "dir name"; private string objpath_test = ""; public static void Init()
{
// Get existing open window or if none, make a new one:
window = (UIReplaceFontEditorWindow)EditorWindow.GetWindow<UIReplaceFontEditorWindow>("替换字体窗口",true); StaticInitData();
} static void StaticInitData()
{
allFonts.Clear();
foreach (var item in allFontsSize)
{
item.Value.Clear();
}
allFontsSize.Clear();
allNeedReplacePrefab.Clear();
for (int i = ; i < allFontName.Length; i++ )
{
allFontName[i] = "";
}
writefileinfo = "字体名称、字号文件(fontsizeinfo.txt)写入状态:空闲状态";
prefabFontSizeInfoSaveDir = "dir name"; } void InitData()
{
ID = -;
// 待替换字体
previousFont = null;
previourFontSelectInfo = "";
// 新字体
newFont = null;
newFontSelectInfo = "";
// 字体对应文件
fontSizeFilePath = "file name";
fontSizeFilePathSelectInfo = "";
// 保存字号对应文件
fontSizeArray.Clear();
// 新prefab保存目录
newPrefabSaveDir = "dir name"; objpath_test = "";
}
static void FontInit()
{
// 查找选中的prefab内的所有字体,以及字体所设置的所有字号 UnityEngine.Object[] selectObjs = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); foreach (UnityEngine.Object selectObj in selectObjs)
{
GameObject obj = null;
try
{
obj = (GameObject)selectObj;
}
catch
{
continue;
} if (obj == null || selectObj == null)
{
Debug.LogWarning("ERROR:Obj Is Null !!!");
continue;
}
string objPath = AssetDatabase.GetAssetPath(selectObj); if (objPath.Length < || objPath.EndsWith(".prefab") == false)
{
Debug.LogWarning("ERROR:Folder=" + objPath);
}
else
{
string prePath = objPath.Substring(, objPath.Length - ).Replace("\\", "/").ToLower(); allNeedReplacePrefab.Add(obj);
Debug.Log("Selected Folder=" + objPath); // 直接修改prefab
UILabel[] labels = obj.GetComponentsInChildren<UILabel>(true); foreach (UILabel label in labels)
{
// 保存字体 以及字号 if ( label.trueTypeFont == null )
{
Debug.Log("font is null" + prePath);
}
else
{
if (!allFonts.ContainsKey(label.trueTypeFont.name))
{
allFonts.Add(label.trueTypeFont.name, label.trueTypeFont);
}
if (allFontsSize.ContainsKey(label.trueTypeFont.name))
{
allFontsSize[label.trueTypeFont.name].Add(label.fontSize);
}
else
{
allFontsSize.Add(label.trueTypeFont.name, new HashSet<int>());
allFontsSize[label.trueTypeFont.name].Add(label.fontSize);
} if ( allFontNameSizePrefabName.ContainsKey( label.trueTypeFont.name))
{
if ( allFontNameSizePrefabName[label.trueTypeFont.name].ContainsKey(label.fontSize))
{
allFontNameSizePrefabName[label.trueTypeFont.name][label.fontSize].Add(objPath);
}
else
{
allFontNameSizePrefabName[label.trueTypeFont.name].Add(label.fontSize, new HashSet<string>());
allFontNameSizePrefabName[label.trueTypeFont.name][label.fontSize].Add(objPath);
}
}
else
{
allFontNameSizePrefabName.Add(label.trueTypeFont.name, new Dictionary<int, HashSet<string> >());
allFontNameSizePrefabName[label.trueTypeFont.name].Add(label.fontSize, new HashSet<string>());
allFontNameSizePrefabName[label.trueTypeFont.name][label.fontSize].Add(objPath);
}
}
}
UIPopupList[] poplists = obj.GetComponentsInChildren<UIPopupList>(true);
foreach (UIPopupList popListItem in poplists)
{
// 保存字体 以及字号
if (popListItem.trueTypeFont == null)
{
Debug.Log("font is null" + prePath);
}
else
{
if (!allFonts.ContainsKey(popListItem.trueTypeFont.name))
{
allFonts.Add(popListItem.trueTypeFont.name, popListItem.trueTypeFont);
}
if (allFontsSize.ContainsKey(popListItem.trueTypeFont.name))
{
allFontsSize[popListItem.trueTypeFont.name].Add(popListItem.fontSize);
}
else
{
allFontsSize.Add(popListItem.trueTypeFont.name, new HashSet<int>());
allFontsSize[popListItem.trueTypeFont.name].Add(popListItem.fontSize);
}
}
}
}
}
int i = ;
foreach ( KeyValuePair<string,Font> kv in allFonts)
{
allFontName[i] = kv.Key;
i++;
} if (prefabFontSizeInfoSaveDir.Equals("") || prefabFontSizeInfoSaveDir.Equals("dir name"))
{
Debug.LogWarning("未选择目录,不保存文字信息");
writefileinfo = "未选择文件保存目录,因此不保存字号信息 ";
}
else
{
writefileinfo = "字体名称、字号文件(fontsizeinfo.txt)写入状态:正在写入";
writefileinfo = WriteFontSizeInfoToFile(prefabFontSizeInfoSaveDir);
} } static string WriteFontSizeInfoToFile(string path)
{ FileStream fs = new FileStream( prefabFontSizeInfoSaveDir + "/fontsizeinfo.txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
List<int> fontSizeList = new List<int>();
sw.WriteLine("字体信息如下,格式为:【 字体名称:所有字号 】 ");
// 输出信息
foreach (var item in allFontsSize)
{
sw.Write(item.Key + ":");
fontSizeList.Clear(); foreach (var fontsize in item.Value)
{
fontSizeList.Add(fontsize);
//sw.Write(fontsize + " ");
}
fontSizeList.Sort(); foreach (var fontsizeInList in fontSizeList)
{
sw.Write(fontsizeInList + ",");
}
sw.WriteLine();
}
foreach (KeyValuePair<string, Dictionary<int,HashSet<string> > > allItemInfo in allFontNameSizePrefabName)
{
sw.WriteLine();
sw.Write("字体名称(fontName) :" + allItemInfo.Key +"," + "所有字号个数(allFontSizeCount):" + allItemInfo.Value.Count);
sw.WriteLine(); List<KeyValuePair<int,HashSet<string> > > lst = new List<KeyValuePair<int,HashSet<string>>>(allItemInfo.Value);
lst.Sort(delegate(KeyValuePair<int, HashSet<string>> s1, KeyValuePair<int, HashSet<string>> s2)
{
return s1.Key.CompareTo(s2.Key);
}); foreach (var fontSizeAndPrefabName in lst)
{
sw.WriteLine();
sw.WriteLine("--字号(fontSize) : " + fontSizeAndPrefabName.Key + " : ");
foreach (var prefabName in fontSizeAndPrefabName.Value)
{
sw.WriteLine(" " + prefabName + ";");
}
}
} sw.Flush();
sw.Close();
fs.Close();
return "字体名称、字号文件(fontsizeinfo.txt)写入状态:保存成功";
} /// <summary> 保存.</summary>
void OnSelectNewFont(UnityEngine.Object obj)
{
newFont = obj as Font;
//NGUISettings.ambigiousFont = obj;
Repaint();
} void OnSelectPreviousFont(UnityEngine.Object obj)
{
previousFont = obj as Font;
//NGUISettings.ambigiousFont = obj;
Repaint();
}
void OnSelectAtlas(UnityEngine.Object obj)
{
NGUISettings.atlas = obj as UIAtlas;
Repaint();
}
/// <summary> 刷新窗口. </summary>
void OnSelectionChange() { Repaint(); } public static bool IsSetNullFont; /// <summary>UI绘制区域.</summary>
void OnGUI()
{
try
{
int startWidth = ;
int startHeight =;
EditorGUIUtility.labelWidth = 100f; int _LineStartWidth = startWidth;
int _LineStartHeight = startHeight; EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "1、选择Prefab内字体名称、字号信息文件保存目录(文件名默认为fontsizeinfo.txt)", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ;
newPrefabSaveDir = EditorGUI.TextArea(new Rect(_LineStartWidth, _LineStartHeight, , ), prefabFontSizeInfoSaveDir, EditorStyles.textField);
_LineStartWidth += ;
if (GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, , ), "选择目录"))
{
prefabFontSizeInfoSaveDir = EditorUtility.SaveFolderPanel("Save newPrefab to directory", "./", "");
}
_LineStartWidth = startWidth;
_LineStartHeight += ; EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "2、点击按钮获取字体信息(若第1步未选择目录,则不保存文件)", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ; if (GUI.Button(new Rect(_LineStartWidth , _LineStartHeight, , ), "获取所选Prefab内字体信息并将信息写入文件"))
{
FontInit();
}
_LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), writefileinfo, EditorStyles.boldLabel); _LineStartWidth = startWidth;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "3、选择需要替换的字体", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ; ID = EditorGUI.Popup(new Rect(_LineStartWidth, _LineStartHeight, , ), ID, allFontName);
if (ID >= )
{
previousFont = allFonts[allFontName[ID]];
} _LineStartWidth += ;
//EditorGUI.TextArea(new Rect(_LineStartWidth, _LineStartHeight, 300, 20), prefabFontSizeInfoSaveDir, EditorStyles.textField);
EditorGUI.ObjectField(new Rect(_LineStartWidth, _LineStartHeight, , ), previousFont, typeof(Font), false);
_LineStartWidth += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), previourFontSelectInfo, EditorStyles.boldLabel);
/***
_LineStartWidth = startWidth + 40;
_LineStartHeight += 40; GUILayout.BeginHorizontal(); if (GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, 80, 20), "Font ▽"))
{
ComponentSelector.Show<Font>(OnSelectPreviousFont);
}
_LineStartWidth += 90;
previousFont = EditorGUI.ObjectField(new Rect(_LineStartWidth, _LineStartHeight, 200, 20), previousFont, typeof(Font), false) as Font;
_LineStartWidth += 210;
if (previousFont != null && GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, 20, 20), "X"))
{
previousFont = null;
}
GUILayout.EndHorizontal();
**/
_LineStartWidth = startWidth;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(startWidth, _LineStartHeight, , ), "4、选择新字体(如不选择新字体,则Prefab内字体将置空)", EditorStyles.boldLabel); _LineStartWidth = startWidth;
_LineStartHeight += ;
GUILayout.BeginHorizontal();
_LineStartWidth = startWidth + ;
if (GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, , ), "Font ▽"))
{
ComponentSelector.Show<Font>(OnSelectNewFont);
}
_LineStartWidth += ;
newFont = EditorGUI.ObjectField(new Rect(_LineStartWidth, _LineStartHeight, , ), newFont, typeof(Font), false) as Font;
_LineStartWidth += ;
if (newFont != null && GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, , ), "X"))
{
newFont = null;
}
_LineStartWidth += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), newFontSelectInfo, EditorStyles.boldLabel);
GUILayout.EndHorizontal(); _LineStartWidth = startWidth;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "5、选择字号对应文件(不选择文件,则字号不变)", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ;
//Rect textRect = new Rect(_LineStartWidth, _LineStartHeight, 300, 150);
fontSizeFilePath = EditorGUI.TextArea(new Rect(_LineStartWidth, _LineStartHeight, , ), fontSizeFilePath, EditorStyles.textField);
_LineStartWidth += ; if (GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, , ), "打开文件"))
{
fontSizeFilePath = EditorUtility.OpenFilePanel("Open file directory", "./", "txt");
}
_LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), fontSizeFilePathSelectInfo, EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "字号对应文件格式为:序号,老字号,新字号", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "示例:", EditorStyles.boldLabel);
_LineStartWidth += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "1,20,30", EditorStyles.boldLabel);
_LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "2,25,40", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, , ), "3,18,28", EditorStyles.boldLabel); //_LineStartWidth = startWidth;
//_LineStartHeight += 30; //EditorGUI.LabelField(new Rect(_LineStartWidth, _LineStartHeight, 150, 150), "选择新Prefab保存目录", EditorStyles.boldLabel); //_LineStartWidth = startWidth;
//_LineStartHeight += 20;
//newPrefabSaveDir = EditorGUI.TextArea(new Rect(_LineStartWidth, _LineStartHeight, 300, 20), newPrefabSaveDir, EditorStyles.textField);
//_LineStartWidth += 310;
//if (GUI.Button(new Rect(_LineStartWidth, _LineStartHeight, 80, 18), "选择目录"))
//{
// newPrefabSaveDir = EditorUtility.SaveFolderPanel("Save newPrefab to directory", "./", "");
//} _LineStartWidth = startWidth;
_LineStartHeight += ;
EditorGUI.LabelField(new Rect(startWidth, _LineStartHeight, , ), "6、点击按钮替换文字信息", EditorStyles.boldLabel); _LineStartWidth = startWidth + ;
_LineStartHeight += ; if (GUI.Button( new Rect(_LineStartWidth , _LineStartHeight,, ),"开始替换"))
{
ReplaceFontAndFontSize();
}
}
catch (System.Exception ex)
{
Debug.LogError(ex.Message + objpath_test);
previousFont = null;
newFont = null;
fontSizeFilePath = "file name"; }
} private void ReplaceFontAndFontSize()
{
if (previousFont == null)
{
previourFontSelectInfo = "未选择需要替换的字体,请选择...";
Debug.LogError(previourFontSelectInfo);
return;
} if (newFont == null)
{
newFontSelectInfo = "未选择新字体,字体将置空";
Debug.LogWarning(newFontSelectInfo);
} if (fontSizeFilePath.Equals("") || fontSizeFilePath.Equals("file name"))
{
fontSizeFilePathSelectInfo = "你没有选择对应字号文件,将不替换字号 ";
Debug.LogWarning(fontSizeFilePathSelectInfo);
CorrectionPublicFont( newFont, previousFont, false);
}
else
{
//读取文件内容
StreamReader sr = new StreamReader(fontSizeFilePath, Encoding.Default); string strLine = null;
fontSizeArray.Clear();
while ((strLine = sr.ReadLine()) != null)
{
if (!string.IsNullOrEmpty(strLine))
{
string[] newArray = strLine.Split(',');
fontSizeArray.Add(newArray);
} }
sr.Close();
// 具体替换
CorrectionPublicFont(newFont, previousFont, true);
}
StaticInitData();
InitData();
} private void CorrectionPublicFont(Font replace, Font matching, bool isReplaceFontSize)
{
foreach (GameObject obj in allNeedReplacePrefab)
{
// 直接修改prefab
UILabel[] labels = obj.GetComponentsInChildren<UILabel>(true);
int newFontSize = ;
foreach (UILabel label in labels)
{
if (label.trueTypeFont == matching)
{
label.trueTypeFont = replace;
newFontSize = GetNewFontSizeByOldSize(label.fontSize);
label.fontSize = newFontSize;
}
}
UIPopupList[] poplists = obj.GetComponentsInChildren<UIPopupList>(true);
foreach (UIPopupList popListItem in poplists)
{
if (popListItem.trueTypeFont == matching)
{
// NGUISettings.ambigiousFont = replace;
popListItem.trueTypeFont = replace;
newFontSize = GetNewFontSizeByOldSize(popListItem.fontSize);
popListItem.fontSize = newFontSize;
}
}
EditorUtility.SetDirty(obj);
/**** 创建新prefab 失败 ******/
/****
GameObject clone = GameObject.Instantiate(obj) as GameObject;
UILabel[] labels = clone.GetComponentsInChildren<UILabel>(true);
int newFontSize = 0;
foreach (UILabel label in labels)
{
if (label.trueTypeFont == matching)
{
label.trueTypeFont = replace;
newFontSize = GetNewFontSizeByOldSize(label.fontSize);
label.fontSize = newFontSize;
}
}
UIPopupList[] poplists = clone.GetComponentsInChildren<UIPopupList>(true);
foreach (UIPopupList popListItem in poplists)
{
if (popListItem.trueTypeFont == matching)
{
// NGUISettings.ambigiousFont = replace;
popListItem.trueTypeFont = replace;
newFontSize = GetNewFontSizeByOldSize(popListItem.fontSize);
popListItem.fontSize = newFontSize;
}
}
SaveDealFinishPrefab(clone, path);
GameObject.DestroyImmediate(clone);
******/
Debug.Log("Connect Font Success=" + obj.name); }
EditorApplication.SaveAssets();
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
private int GetNewFontSizeByOldSize(int fontSize)
{
int newFontSize = fontSize;
if (fontSizeArray.Count > )
{
int nRow = fontSizeArray.Count;
int nCol = ((string[])fontSizeArray[]).Length;
for ( int i = ; i < nRow; i++ )
{
string[] data = (string[])fontSizeArray[i];
for (int j = ; j < nCol;j++ )
{
if (fontSize == int.Parse(data[]))
{
newFontSize = int.Parse(data[]);
return newFontSize;
}
} }
}
return newFontSize;
}
//private void SaveDealFinishPrefab(GameObject go, string path)
//{
// if (File.Exists(path) == true)
// {
// UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
// PrefabUtility.ReplacePrefab(go, prefab);
// }
// else
// {
// PrefabUtility.CreatePrefab(path, go);
// }
//}
}

直接复制到代码内,然后放在Editor下,就可以用辣

至于步骤,在界面上说的也很清楚了。不明白的,怪自己智商咯。

Unity编辑器下,界面替换NGUI字体以及字号的更多相关文章

  1. Unity编辑器下重启

    我们项目AssetBundle打包走的是全自动化流程,打包之前要进行各种资源检测,如果检测顺利通过,则进入打包,否则提示错误资源名称及路径,打包中断!有时候即使资源检测通过也会打包崩溃,初步断定是Un ...

  2. Unity 编辑器的 界面布局 保存方法

    在软件界面的右上角(关闭按钮的下方),点击  layout  (界面)的下拉箭头. 弹出选项中的 save layout....(保存界面选项),输入命名,就可以生成这个界面的布局.  (软件本身也有 ...

  3. Unity编辑器下获取动画的根运动状态并修改

    我最初想直接修改.anim文件 但通过后来得到的信息,其实根运动状态储存在FBX.meta文件里,转出的.anim文件虽然也有根运动的信息但是算是塌陷过的,无法进行开关操作. 这是我针对有根运动.an ...

  4. 实现Unity编辑器模式下的旋转

    最近在做一个模型展示的项目,我的想法是根据滑动屏幕的x方向差值和Y方向的差值,来根据世界坐标下的X轴和Y轴进行旋转,但是实习时候总是有一些卡顿.在观察unity编辑器下的旋转之后,发现编辑器下的旋转非 ...

  5. 关于Unity中的NGUI字体

    NGUI字体类型 1: UIFont字体,UIFont类实现的2: TTF动态字体的使用3: BBCode的特殊字体的使用4: NGUI字体制作5: BMFont字体制作和艺术字体的制作6: UILa ...

  6. Ubuntu下的UNITY和GNOME界面

    [转自] http://www.tuicool.com/articles/nUbMVbU 从Ubuntu 11.04后,UNITY就作为默认界面来推广.如果用户需要体验GNOME 3,还需要用户自己安 ...

  7. unity 创建NGUI字体

    1.NGUI -> Open -> Font Maker 打开FoontMaker窗口. 2.点Source选择.ttf字体,必须是中文命令,否则会出错. 3.点Custom单选按钮,输入 ...

  8. 【Unity编辑器】UnityEditor多重弹出窗体与编辑器窗口层级管理

    一.简介 最近马三为公司开发了一款触发器编辑器,对于这个编辑器策划所要求的质量很高,是模仿暴雪的那个触发器编辑器来做的,而且之后这款编辑器要作为公司内部的一个通用工具链使用.其实,在这款触发器编辑器之 ...

  9. 定制你的Unity编辑器

    Unity的编辑器可以通过写脚本进行界面定制,包括添加功能菜单,今天写游戏Demo用到了记录一下. 为Unity添加子菜单 示例程序 [AddComponentMenu("Defend Ho ...

随机推荐

  1. sql server @@ROWCOUNT 会被 if 给 清 0

    官方说 @@ROWCOUNT  会被以下几种语句清0 原文如下: Statements such as USE, SET <option>, DEALLOCATE CURSOR, CLOS ...

  2. ios实例开发精品文章推荐(8.13)

    提示用户对产品进行评价 http://www.apkbus.com/android-137752-1-1.html设置UILabel和UITextField的Insets http://www.apk ...

  3. iOS应用间相互跳转

    使用第三方用户登录,跳转到需授权的App.如QQ登录,微信登录等. 需要用户授权,还需要"返回到调用的程序,同时返回授权的用户名.密码". 应用程序推广,跳转到另一个应用程序(本机 ...

  4. linux下软链接与硬链接及其区别

    linux下创建链接命令 ln -s 软链接 这是linux中一个非常重要命令,请大家一定要熟悉.它的功能是为某一个文件在另外一个位置建立一个不同的链接,这个命令最常用的参数是-s, 具体用法是:ln ...

  5. ROS学习(十三)—— 编写简单的Service和Client (C++)

    一.编写Service节点 1.节点功能: 我们将创建一个简单的service节点("add_two_ints_server"),该节点将接收到两个整形数字,并返回它们的和. 2. ...

  6. iOS 一个小动画效果-b

    近期工作不忙,来一个需求感觉棒棒的,是一个比较简单的页面,如下图(图1) 图1 应该很简单吧,没什么大的功能,就是一个展示,一个拨打电话,拨打电话不需要说,几行代码搞定,基本UI也不用说了,刚培训完的 ...

  7. 【Linux】统计命令wc

    如果我想要知道 /etc/man.config 这个文件里面有多少字?多少行?多少字符的话, 可以怎么做呢?其实可以利用 wc 这个命令来达成喔!他可以帮我们计算输出的信息的整体数据! [root@w ...

  8. MySQL Sleep进程

    MySQL中查询当前的连接数: mysql> show status like '%Threads_connected%'; +-------------------+-------+ | Va ...

  9. Git Note

    Git 参考 http://chengshiwen.com/article/head-first-git/ 文件状态 Git目录: (git directory),亦即Git仓库,一般对应项目根目录下 ...

  10. golang 学习笔记 ---内存分配与管理

    Go语言——内存管理 参考: 图解 TCMalloc Golang 内存管理 Go 内存管理 问题 内存碎片:避免内存碎片,提高内存利用率. 多线程:稳定性,效率问题. 内存分配   内存划分 are ...