12345678910111213141516171819202122232425262728 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class SelectToggleItem : MonoBehaviour
- {
- public List<GameObject> m_IsOnActiveObjs;
- public List<GameObject> m_IsOnDisActiveObjs;
- public void Start()
- {
- GetComponent<Toggle>().onValueChanged.AddListener(isOn =>
- {
- if (isOn)
- {
- m_IsOnActiveObjs.ForEach(obj => { obj.SetActive(true); });
- m_IsOnDisActiveObjs.ForEach (obj => { obj.SetActive(false); });
- }else
- {
- m_IsOnActiveObjs.ForEach(obj => { obj.SetActive(false); });
- m_IsOnDisActiveObjs.ForEach(obj => { obj.SetActive(true); });
- }
- });
- }
- }
|