摘要: IMGUI中每个可点击(交互)的控件都会有一个controlID, 一般在mouseDown的时候设置, mouseUp的时候清除。 #if UNITY_EDITOR using UnityEditor; using UnityEngine; public class TestHotControlI 阅读全文
posted @ 2023-10-19 23:45 yanghui01 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 效果 #if UNITY_EDITOR using UnityEditor; using UnityEngine; public class TestSceneGUIWindow : EditorWindow { [MenuItem("MyTools/TestSceneGUIWindow")] pu 阅读全文
posted @ 2023-10-19 23:29 yanghui01 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 扩展Scene视图的几种方式 1) 注册SceneView.duringSceneGui委托(Unity2018及之前版本是SceneView.onSceneGUIDelegate) #if UNITY_EDITOR using UnityEditor; public class TestScene 阅读全文
posted @ 2023-10-19 23:05 yanghui01 阅读(121) 评论(0) 推荐(0) 编辑
摘要: var ray = Camera.ScreenPointToRay(screenPos); 1) screenPos需要是左下角为(0, 0), 单位为像素的屏幕坐标。 2) 得到的射线的开始为屏幕坐标在相机near平面上的点, 指向屏幕坐标在far平面上的点 在游戏代码中使用 using Unit 阅读全文
posted @ 2023-10-19 00:35 yanghui01 阅读(170) 评论(0) 推荐(0) 编辑