- Redone most UIs (WIP) - New world map - Game LOGO - main menus updated (WIP)
44 lines
958 B
C#
44 lines
958 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(TMP_Text))]
|
|
public class TMP_CopyTextFromParent : MonoBehaviour
|
|
{
|
|
TMP_Text parentText;
|
|
TMP_Text thisText;
|
|
|
|
|
|
|
|
private void Awake()
|
|
{
|
|
parentText = transform.parent.GetComponent<TMP_Text>();
|
|
|
|
thisText = GetComponent<TMP_Text>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (parentText == null) return;
|
|
|
|
thisText.text = parentText.text;
|
|
}
|
|
|
|
public void OnValidate()
|
|
{
|
|
if (parentText == null)
|
|
parentText = transform.parent.GetComponent<TMP_Text>();
|
|
|
|
if(thisText == null)
|
|
thisText = GetComponent<TMP_Text>();
|
|
|
|
if (parentText == null) return;
|
|
if (thisText == null) return;
|
|
|
|
thisText.text = parentText.text;
|
|
thisText.fontSizeMin = parentText.fontSizeMin;
|
|
thisText.fontSizeMax = parentText.fontSizeMax;
|
|
}
|
|
}
|