protected virtual void RefreshLocalContent() { // Set the scale of the pivot contentParent.transform.localScale = Vector3.one * contentScale; label.transform.localScale = Vector3.one * 0.005f; // Set the content using a text mesh by default // This function can be overridden for tooltips that use Unity UI TextMesh text = label.GetComponent <TextMesh>(); if (text != null && !string.IsNullOrEmpty(toolTipText)) { text.fontSize = fontSize; text.text = toolTipText.Trim(); text.lineSpacing = 1; text.anchor = TextAnchor.MiddleCenter; // Get the world scale of the text // Convert that to local scale using the content parent Vector3 localScale = text.transform.localScale; localContentSize.x = localScale.x + backgroundPadding.x; localContentSize.y = localScale.y + backgroundPadding.y; } // Now that we have the size of our content, get our pivots ToolTipUtility.GetAttachPointPositions(ref localAttachPointPositions, localContentSize); localAttachPoint = ToolTipUtility.FindClosestAttachPointToAnchor(anchor.transform, contentParent.transform, localAttachPointPositions, attachPointType); }
protected virtual void Update() { // Enable / disable our line if it exists if (toolTipLine != null) { toolTipLine.enabled = IsOn; toolTipLine.FirstPoint = AnchorPosition; toolTipLine.LastPoint = AttachPointPosition; } if (IsOn) { contentParent.SetActive(true); localAttachPoint = ToolTipUtility.FindClosestAttachPointToAnchor(anchor.transform, contentParent.transform, localAttachPointPositions, attachPointType); } else { contentParent.SetActive(false); } }