//thanks to laurentlavigne private static void ShowIcon(int instanceId, Rect selectionRect) { var go = EditorUtility.InstanceIDToObject(instanceId) as GameObject; if (go == null) { return; } var curve = go.GetComponent <BGCurve>(); if (curve == null) { return; } bool hasError = false, hasWarning = false; BGCurveEditorComponents.ComponentsStatus(curve, ref hasError, ref hasWarning); string text; GUIStyle style; if (hasError) { text = "C!"; style = curveErrorStyle; } else if (hasWarning) { text = "C!"; style = curveWarningStyle; } else { text = "C"; var selected = Selection.Contains(instanceId); style = selected ? selectedCurveStyle : curveStyle; } GUI.Label(new Rect(selectionRect) { x = selectionRect.xMax - IconSize, width = IconSize }, text, style); }
//thanks to laurentlavigne private static void ShowIcon(int instanceId, Rect selectionRect) { var go = EditorUtility.InstanceIDToObject(instanceId) as GameObject; if (go == null) { return; } var curve = go.GetComponent <BGCurve>(); if (curve == null) { return; } var selected = Selection.Contains(instanceId); bool hasError = false, hasWarning = false; BGCurveEditorComponents.ComponentsStatus(curve, ref hasError, ref hasWarning); var icon = selected //selected ? hasError ? CurveErrorSelectedIcon : hasWarning ? CurveWarningSelectedIcon : CurveSelectedIcon // Not selected : hasError ? CurveErrorIcon : hasWarning ? CurveWarningIcon : CurveIcon; GUI.Label(new Rect(selectionRect) { x = selectionRect.xMax - IconSize, width = IconSize }, icon); }