美文网首页
unity代码添加Tag

unity代码添加Tag

作者: 红定义 | 来源:发表于2017-03-07 08:22 被阅读0次

static void AddTag(string tag)

{

if (!isHasTag(tag))

{

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);

SerializedProperty it = tagManager.GetIterator();

while (it.NextVisible(true))

{

if (it.name == "tags")

{

int count = it.arraySize;

it.InsertArrayElementAtIndex(count);

SerializedProperty dataPoint = it.GetArrayElementAtIndex(count);

dataPoint.stringValue = tag;

tagManager.ApplyModifiedProperties();

return;

}

}

}

}

static bool isHasTag(string tag)

{

for (int i = 0; i < UnityEditorInternal.InternalEditorUtility.tags.Length; i++)

{

if (UnityEditorInternal.InternalEditorUtility.tags[i].Equals(tag))

return true;

}

return false;

}

相关文章

  • unity代码添加Tag

    static void AddTag(string tag) { if (!isHasTag(tag)) { Se...

  • vscode插件安装

    自动添加HTML / XML关闭标记Auto Close Tag 路径提示Path Intellisense 代码...

  • vsCode常见配置

    常用插件 Auto Close Tag 自动添加HTML / XML关闭标签 HTML Snippets 代码自动...

  • 我的vscode插件

    作者:烨竹 align:对齐代码(ctrl+alt+a)Auto Color Tag:自动添加HTML / XML...

  • git-tag的使用

    显示tag git tag tag 匹配 git tag -l 'v1.4.2.*' 为当前提交添加tag git...

  • Git tag增加 查看 删除

    添加tag 本地增加tag: git tag 1.0.0指定tag: git tag 1.0.0 f52c633 ...

  • 三种工作流CI/CT/CD

    开发分支推送CI 推送配置 单元测试 代码扫描 构建推送 分支环境部署 添加Tag时CT 单元测试 代码扫描 构建...

  • git 奇技淫巧

    Tag 添加 Tag 例如:1.0.0 推送所有 tag,同步到远程仓库: 删除本地 Tag 例如:1.0.0 删...

  • unity小知识总结

    给游戏物体添加tag值,获取tag gameObject.tag //设置游戏对象的tag值 gameObject...

  • Android:Tag的妙用

    Android 的 View 可有各种Tag。 不禁令人联想到Unreal、Unity中物体的标签。 Tag不限定...

网友评论

      本文标题:unity代码添加Tag

      本文链接:https://www.haomeiwen.com/subject/cgmpgttx.html