12345678910111213141516171819202122232425262728 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ToggleTextColor : MonoBehaviour
- {
- [SerializeField] private Color m_ColorUnactive = Color.black;
- [SerializeField] private Color m_ColorActive = Color.white;
- private Text m_Text = null;
- private void Awake() {
- if (m_Text == null)
- m_Text = GetComponent<Text>();
- }
- public void SetColor(bool value) {
- if (m_Text == null) return;
- if (value) {
- m_Text.color = m_ColorActive;
- }
- else {
- m_Text.color = m_ColorUnactive;
- }
- }
- }
|