DeviceView.cs 568 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class DeviceView : MonoBehaviour
  6. {
  7. void Start()
  8. {
  9. Transform t = this.transform.Find("ScrollView/Viewport/Content");
  10. for (int i = 0; i < t.childCount; i++)
  11. {
  12. int k = i;
  13. t.GetChild(i).GetComponent<Button>().onClick.AddListener(delegate() {
  14. Debug.Log(k);
  15. });
  16. }
  17. }
  18. public void Back() {
  19. AudioMgr.ins.PlayBtn();
  20. Destroy(this.gameObject);
  21. }
  22. }