/// <summary> /// Draw component texture with flag `enabled`. /// </summary> private static void DrawEnableComponentTexture(Type t, Rect rect, Texture image, bool enabled) { // If we are drawing behbaviour, we draw with alpha channel weather // the component is enabled. if (enabled) { HierarchyUtil.DrawTextureTooltip(rect, image, t.Name); } else { HierarchyUtil.DrawTextureTooltip(rect, image, t.Name, data.components.disableAlpa); } }
public static bool DrawLogIcon(GameObject go, Rect selectionRect, Dictionary <string, string> log, LogType type, int iconLevel) { if (type == LogType.Log && data.log.hideLog) { return(false); } if (type == LogType.Warning && data.log.hideWarning) { return(false); } if (type == LogType.Error && data.log.hideError) { return(false); } foreach (KeyValuePair <string, string> entry in log) { string t = entry.Key; Component component = go.GetComponent(t); if (component == null) { continue; } var stackTrace = entry.Value; var c = GetLogIcon(type, stackTrace); var x = GetNameX(selectionRect, currentItem.nestingLevel) + (ROW_HEIGHT * iconLevel); Rect rect = new Rect(x, selectionRect.yMin, ROW_HEIGHT, ROW_HEIGHT); HierarchyUtil.DrawTextureTooltip(rect, c.image, stackTrace); return(true); } return(false); }
public static void DrawComponent(Type t, GameObject go, Rect rect, Texture image) { if (t == null) { HierarchyUtil.DrawTextureTooltip(rect, image, "Missing component"); return; } if (t.IsSubclassOf(typeof(Behaviour))) { var comp = go.GetComponent(t) as Behaviour; if (comp != null) { DrawEnableComponentTexture(t, rect, image, comp.enabled); } } else if (t.IsSubclassOf(typeof(Collider))) { var comp = go.GetComponent(t) as Collider; if (comp != null) { DrawEnableComponentTexture(t, rect, image, comp.enabled); } } else if (t.IsSubclassOf(typeof(Renderer))) { var comp = go.GetComponent(t) as Renderer; if (comp != null) { DrawEnableComponentTexture(t, rect, image, comp.enabled); } } else { HierarchyUtil.DrawTextureTooltip(rect, image, t.Name); } }