You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
672 B
25 lines
672 B
8 months ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using TMPro;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
[RequireComponent(typeof(Toggle))]
|
||
|
public class SelectionChangeImage : MonoBehaviour
|
||
|
{
|
||
|
public GameObject normalImage;
|
||
|
public GameObject selectImage;
|
||
|
void Start()
|
||
|
{
|
||
|
GetComponent<Toggle>().onValueChanged.AddListener(selectChanged);
|
||
|
normalImage.gameObject.SetActive(!GetComponent<Toggle>().isOn);
|
||
|
selectImage.gameObject.SetActive(GetComponent<Toggle>().isOn);
|
||
|
}
|
||
|
|
||
|
private void selectChanged(bool Ison)
|
||
|
{
|
||
|
normalImage.gameObject.SetActive(!Ison);
|
||
|
selectImage.gameObject.SetActive(Ison);
|
||
|
}
|
||
|
}
|