EngediKimHyeYoung / Unity

0 stars 0 forks source link

유니티 이미지 클릭시 이미지 변경 및 씬 이동 #22

Open EngediKimHyeYoung opened 1 year ago

EngediKimHyeYoung commented 1 year ago

using System.Collections; using System.Collections.Generic; using JetBrains.Annotations; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement;

public class ImgChange : MonoBehaviour { public Image imageToChange; // 변경할 이미지를 가리키는 변수 public Sprite newImage; // 새로운 이미지

private bool ImgCheck = false;

public void ChangeImage()
{
    if(ImgCheck){
        Debug.Log("성공--------------");
        SceneManager.LoadScene("scene2");
    } else {
        ImgCheck = true;
        imageToChange.sprite = newImage; // 이미지 변경
    }
}
// Start is called before the first frame update
void Start()
{
    // Debug.Log("메롱");
}

// Update is called once per frame
void Update()
{
    // Debug.Log("메롱메롱");
}

}

EngediKimHyeYoung commented 1 year ago

image