标签:new paint line blog rgb 重绘 gif 技术分享 获取
在编辑器的Scene视图中追踪选择目标,调试动作用
SceneView这个类没有说明文档比较蛋疼
在update中调用SceneViewCameraFace2Target函数,编辑器的OnInspectorUpdate不够平滑
每帧重绘SceneView的lastActiveSceneView,原本想要获取Scene视图中的Camera对象的,没有找到接口但是功能是达到了
#if UNITY_EDITOR
private GameObject focusTarget = null;
public void SceneViewCameraFace2Target( )
{
if (UnityEditor.Selection.activeGameObject != null)
{
focusTarget = UnityEditor.Selection.activeGameObject;
}
if (focusTarget != null)
{
Quaternion rotation = focusTarget.transform.rotation * Quaternion.AngleAxis(180, Vector3.up);
Vector3 pos = focusTarget.transform.position + new Vector3(0,3,0);
UnityEditor.SceneView.lastActiveSceneView.rotation = rotation;
UnityEditor.SceneView.lastActiveSceneView.pivot = pos;
UnityEditor.SceneView.lastActiveSceneView.Repaint();
}
}
#endif
SceneView 追踪选择目标
标签:new paint line blog rgb 重绘 gif 技术分享 获取
原文地址:http://www.cnblogs.com/Hichy/p/6720248.html