public static void AddTooltipToObject(GameObject obj, string text) { if (tooltipPrefab == null) { tooltipPrefab = AssetBase.GetPrefab <Tooltip_Text>("Tooltip_Text"); } TooltipController_Text tooltip = obj.GetComponent <TooltipController_Text>(); if (tooltip == null) { tooltip = obj.AddComponent <TooltipController_Text>(); } tooltip.prefab = tooltipPrefab; tooltip.SetText(text); }
private void KillTooltips() { if (_dialog == null) { return; } var tooltips = _dialog.GetComponentsInChildren <TooltipController_Text>(true); for (int i = tooltips.Length - 1; i >= 0; i--) { TooltipController_Text tooltip = tooltips[i]; if (tooltip == null) { continue; } tooltip.SetText(""); } }