팀프로젝트/R&D

2020.06.24. 스크롤 뷰 전환 버튼 UI

dev_sr 2020. 6. 24. 15:12

버튼 입력에 따라 스크롤뷰가 포함된 UI창 전환

 

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
public class App : MonoBehaviour
{
    public Button btn1;
    public Button btn2;
    public Button btn3;
 
    public GameObject scrollview1;
    public GameObject scrollview2;
 
    public GameObject settingImage;
 
    void Start()
    {
        this.btn1.onClick.AddListener(() =>
        {
            this.scrollview1.SetActive(true);
            this.scrollview2.SetActive(false);
            this.settingImage.SetActive(false);
        });
 
        this.btn2.onClick.AddListener(() =>
        {
            this.scrollview1.SetActive(false);
            this.scrollview2.SetActive(true);
            this.settingImage.SetActive(false);
        });
 
        this.btn3.onClick.AddListener(() =>
        {
            this.scrollview1.SetActive(false);
            this.scrollview2.SetActive(false);
            this.settingImage.SetActive(true);
        });
    }
 
    
}