用Handles在场景中显示文本

场景中挂在了Spot的物体前会显示文本

public class SceneShow : Editor

{

[DrawGizmo(GizmoType.InSelectionHierarchy | GizmoType.NotInSelectionHierarchy)]
static void ShowHexSpot(Spot spot, GizmoType gizmoType)
{
GUIStyle style = new GUIStyle();
style.normal.textColor = Color.green;
string temp = string.Format("id: {0}\nq_r: {1}", spot.spot.hexSpotInfo.id, spot.spot.hexSpotInfo.hex.getAxialPosString());
Handles.Label(spot.transform.position + Vector3.up * 0.2F, temp, style);
}

}

posted @ 2023-01-30 14:42  mc宇少  阅读(42)  评论(0)    收藏  举报