I’m making a custom inspector for a monobehaviour, and i wish to call Debug.DrawLine into the sceneview while the inspector is active.
I’ve read that you have to call it from sceneview update, not from OnInspectorGUI or anywhere else. What would be the proper way of doing that?
public override void OnInspectorGUI()
{
obstacle = (Obstacle)target;
bool isPrefab = PrefabUtility.GetPrefabType(obstacle) == PrefabType.Prefab ? true : false;
obstacle.UpdateTransform();
obstacle.Center = EditorGUILayout.Vector2Field("Offset", obstacle.Center);
obstacle.Radius = EditorGUILayout.FloatField("Radius", obstacle.Radius);
if (!isPrefab && SceneView.lastActiveSceneView != null)
{
// Draw the obstacle using Debug.DrawLine()
obstacle.DrawBoundingBall(Color.red);
}
}