using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UIFunctionNextLevel : MonoBehaviour { public int WhatScenceSelcet=-1; public Button 结构; public Button 事故; public GameObject[] 视频; public GameObject 视频模块; // Start is called before the first frame update void Start() { 事故.onClick.AddListener(delegate () { starVideo(); }); 结构.onClick.AddListener(delegate () { foreach (GameObject n in 视频) { n.SetActive(false); } 视频模块.SetActive(false); }); } // Update is called once per frame void Update() { } private void starVideo() { if (!事故.GetComponent().selected) { 视频模块.SetActive(true); foreach (GameObject n in 视频) { n.SetActive(false); } 视频[WhatScenceSelcet].SetActive(true); } } }