public static z_SelectionRenderState GetSelectionRenderState() { #if UNITY_5_3 || UNITY_5_4 return(z_SelectionRenderState.Wireframe); #else bool wireframe = false, outline = false; try { wireframe = (bool)z_ReflectionUtil.GetValue(null, "UnityEditor.AnnotationUtility", "showSelectionWire"); outline = (bool)z_ReflectionUtil.GetValue(null, "UnityEditor.AnnotationUtility", "showSelectionOutline"); } catch { Debug.LogWarning("Looks like Unity changed the AnnotationUtility \"showSelectionOutline\"\nPlease email [email protected] and let Karl know!"); } z_SelectionRenderState state = z_SelectionRenderState.None; if (wireframe) { state |= z_SelectionRenderState.Wireframe; } if (outline) { state |= z_SelectionRenderState.Outline; } return(state); #endif }
/** * Set the selected render state for an object. In Unity 5.4 and lower, this just toggles wireframe * on or off. */ public static void SetSelectionRenderState(Renderer renderer, z_SelectionRenderState state) { #if UNITY_5_3 || UNITY_5_4 EditorUtility.SetSelectedWireframeHidden(renderer, state == 0); #else EditorUtility.SetSelectedRenderState(renderer, (EditorSelectedRenderState)state); #endif }