Skip to content

Instantly share code, notes, and snippets.

@bibinba
Created June 9, 2019 06:51
Show Gist options
  • Save bibinba/6a1cbc91064458bd23bda757569b7487 to your computer and use it in GitHub Desktop.
Save bibinba/6a1cbc91064458bd23bda757569b7487 to your computer and use it in GitHub Desktop.
タッチしたらスプライトの色が変わる
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class touch : MonoBehaviour
{
public Image image;
[SerializeField]
Color btnColor1 = Color.red;
[SerializeField]
Color btnColor2 = Color.blue;
bool btnChangeFlag = true;
public void onButton()
{
btnChangeFlag = !btnChangeFlag;
image.color= btnChangeFlag ? btnColor1 : btnColor2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment