当前位置: 首页 > news >正文

公司网站建设方案汇报做网站资源知乎

公司网站建设方案汇报,做网站资源知乎,著名营销成功案例,焦作网络推广哪家好目录 需求描述上代码打个赏吧 需求描述 现在有这样一个需求#xff1a; 在Hierarchy面板的对象上绘制按钮点击按钮#xff0c;弹出菜单再点击菜单项目响应自定义操作在这里的响应主要是复制对象层级路路径 看具体效果请看动图#xff1a; 注#xff1a; 核心是对Edito… 目录 需求描述上代码打个赏吧 需求描述 现在有这样一个需求 在Hierarchy面板的对象上绘制按钮点击按钮弹出菜单再点击菜单项目响应自定义操作在这里的响应主要是复制对象层级路路径 看具体效果请看动图 注 核心是对EditorApplication.hierarchyWindowItemOnGUI委托的实现其它需求可参考实现如是要要Project面板实现类似的功能可以参考实现EditorApplication.hierarchyWindowItemOnGUI委托 上代码 /*********************************************** author: anyuanlzh* date: 2023-05-18* des: Hierarchy面板工具***********************************************/using System.Collections.Generic; using UnityEditor; using UnityEngine;[InitializeOnLoad] public class HierarchyTabTool {// 静态构造函数static HierarchyTabTool(){EditorApplication.hierarchyWindowItemOnGUI HierarchyWindowItemOnGUI;}private static void HierarchyWindowItemOnGUI(int instanceId, Rect selectionRect){var obj EditorUtility.InstanceIDToObject(instanceId) as GameObject;if (obj null)return;GameObject selectedObjs Selection.activeGameObject;if(obj!selectedObjs)return;selectionRect.x selectionRect.width - 60;selectionRect.y 0;selectionRect.width 60f;GUIStyle fontStyle new GUIStyle(GUI.skin.button);fontStyle.alignmentTextAnchor.MiddleCenter;fontStyle.fontSize10;fontStyle.normal.textColorColor.yellow;//点击事件if (GUI.Button(selectionRect, 复制层级, fontStyle)){// Debug.Log($click: {Selection.activeObject.name});// 弹出菜单Vector2 mousePosition Event.current.mousePosition;Rect position new Rect(mousePosition.x, mousePosition.y7, 0, 0);EditorUtility.DisplayPopupMenu(position, GameObject/1_复制层级路径, null);}}// 防止一次点击响应多次private static float _last_call_time 0;private static float minInterval_time 0.5f;[MenuItem(GameObject/1_复制层级路径/A点~B点, false, 40)]private static void GetHierarchyPath2(){if (Time.time - _last_call_timeminInterval_time){return;}_last_call_time Time.time;GameObject[] selectedObjs Selection.gameObjects;//Debug.Log(selectedObjs.Length);if (selectedObjs.Length 1){Copy_HierarchyPath_root2target();return;}else if (selectedObjs.Length 2){Debug.Log(请选择一个或二个有包含关系对象);return;}Transform first selectedObjs[0].transform;Transform last selectedObjs[selectedObjs.Length-1].transform;// Debug.Log($first.name:{first.name} last.name:{last.name});Transform a null;Transform b null;if (EditorUtils.IsAncestor(first, last)){a first;b last;}else if (EditorUtils.IsAncestor(last, first)){a last;b first;}else{Debug.LogError(请选择有包含关系的二个对象);return;}Liststring names new Liststring();while (b!null){if (a b){names.Insert(0,b.name);break;}names.Insert(0, b.name);b b.parent;}string path ;for (int i 0; i names.Count-1; i){path names[i] /;}path names[^1];GUIUtility.systemCopyBuffer path;Debug.Log(对象层次路径 A点到B点: path);}[MenuItem(GameObject/1_复制层级路径/根0~目标, false, 40)]private static void Copy_HierarchyPath_root0target(){Copy_HierarchyPath_rootN2target(0);}[MenuItem(GameObject/1_复制层级路径/根1~目标, false, 40)]private static void Copy_HierarchyPath_root1target(){Copy_HierarchyPath_rootN2target(1);}[MenuItem(GameObject/1_复制层级路径/根2~目标, false, 40)]private static void Copy_HierarchyPath_root2target(){Copy_HierarchyPath_rootN2target(2);}[MenuItem(GameObject/1_复制层级路径/根3~目标, false, 40)]private static void Copy_HierarchyPath_root3target(){Copy_HierarchyPath_rootN2target(3);}// 从根0的第N级到目标// rootN从零开static void Copy_HierarchyPath_rootN2target(int rootN){if (Time.time - _last_call_timeminInterval_time){return;}_last_call_time Time.time;if (Selection.count ! 1){Debug.LogError($Copy_HierarchyPath_rootN2target: 请选择一个对象);return;}Transform target Selection.activeGameObject.transform;Liststring names new Liststring();Transform parent target.transform.parent;while (target ! null){names.Insert(0, target.name);target target.parent;}if (names.Count - 1 rootN){Debug.LogError($Copy_HierarchyPath_rootN2target: N:{rootN}大于目标对象的深度);return;}string path ;for (int i rootN; i names.Count-1; i){path names[i] /;}path names[^1];GUIUtility.systemCopyBuffer path;Debug.Log($对象层次路径 root_{rootN}到target: path);} } 打个赏吧
http://www.pierceye.com/news/210082/

相关文章:

  • 网站申请书博客系统做网站
  • 灰色行业老域名做网站不收录初学者的网站建设
  • 网站做成微信小程序贵州企业seo
  • 在淘宝做印刷网站怎么办wordpress 主题 edu
  • 成都设计公司网站线上线下一体化营销
  • 网站你懂我意思正能量晚上下载注册公司需要多少钱手续费
  • 在线html网站开发广州网站排名优化公司
  • 如何在免费网站上做推扩自己怎么来建设网站
  • 福安市教育局建设网站做架构图简单的网站
  • 如何快速进行网站开发seo是什么东西
  • 网站建设需要具备哪些学编程多少钱学费
  • 建设工程许可证在那个网站办金融行业网站制作
  • 邢台专业做网站价格信息流广告是什么
  • 网站开发的母的目的和意义.建设购物平台网站
  • 立方米网站建设做淘宝客网站用什么程序好
  • 怎样做网站挣钱建筑资料软件
  • 涿州建设局网站苏州市高新区建设局网站
  • 个人soho要怎么做企业网站成都包装设计公司
  • 网站开发 chrome浏览器崩溃ruhe用dw做网站
  • 全屏网站 图片优化个人网站cms系统
  • 做我女朋友程序网站邵东做网站
  • 建设网站如何挂到网上wordpress首页添加幻灯
  • 汕头正规网站建设模板总部城乡建设网站 资料员
  • vs 2017c 怎么建设网站网站建设的数字化和互联网化
  • 南昌网站设计公司海南营销网站建设
  • 购物网站素材个人搭建网站教程
  • 青岛网站建设哪里好模板建站服务公司
  • 青色网站欣赏wordpress中文购物
  • 建站培训全国住房与城乡建设部网站
  • 唐山网站建设方案策划沧州网站建设联系电话