public static void CreateDebugDisplyer() { DisplayerProjectSettings settings = DisplayerProjectSettings.Instance; GameObject displayerObject = new GameObject(settings.debugObjectName); displayerObject.SetActive(false); GameObject canvasObject = CreateCanvas(displayerObject.transform, "Canvas", settings.debugCanvasOrder, false).gameObject; TextMeshProUGUI text = CreateTextObject(canvasObject.transform, "Text", settings.debugFontSize); text.alignment = TextAlignmentOptions.TopLeft; text.color = Color.white; text.margin = new Vector4(10f, 10f, 10f, 10f); InfoDisplayer displayer = CreateDisplayer(displayerObject, text); displayer.displayerName = settings.debugDisplayerName; displayer.defaultLines = new DisplayerLine[0]; displayer.acceptUnknown = true; StaticTogglerBasic toggler = displayer.gameObject.AddComponent <StaticTogglerBasic>(); toggler.togglerTag = settings.debugTogglerName; toggler.key = settings.debugTogglerKey; toggler.toggleObject = canvasObject; displayerObject.SetActive(true); }
public static StaticTogglerBasic CreateToggler(GameObject target, string tag, GameObject toggleObject = null) { StaticTogglerBasic toggler = target.AddComponent <StaticTogglerBasic>(); toggler.addToDontDestroy = true; toggler.togglerTag = tag; toggler.toggleObject = toggleObject; return(toggler); }