ProjectDDD/Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1ChangeAllChildTextFonts.cs
2025-07-08 19:46:31 +09:00

24 lines
613 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1ChangeAllChildTextFonts : MonoBehaviour
{
[SerializeField] private Font newFont;
[SerializeField] private bool changeFontOnStart;
private void Start()
{
if(changeFontOnStart) ChangeFonts();
}
[ContextMenu("ChangeFonts")]
private void ChangeFonts()
{
Text[] canvasTexts = GetComponentsInChildren<Text>();
for(int i = 0; i < canvasTexts.Length; i++) canvasTexts[i].font = newFont;
}
}
}