文字の色を外部から変えるスクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UIAnimation : MonoBehaviour {
[SerializeField]
private Color defaultColor, changeColor;
private Text __text;
private Text text { get { return this.__text ? this.__text : this.__text = GetComponent<Text> (); } }
// Start is called before the first frame update
void Start () {
}
void OnEnable () {
SwitchDefaultColor ();
}
public void SwitchChangeColor () {
text.color = changeColor;
}
public void SwitchDefaultColor () {
text.color = defaultColor;
}
// Update is called once per frame
void Update () {
}
}