ArabDesert/Assets/1-arab desert/udon/simple_button.cs

56 lines
1.2 KiB
C#

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using UnityEngine.UI;
public class simple_button : UdonSharpBehaviour
{
private Button _button;
public GameObject Object;
private Image _buttonImage;
public simple_button _simple_button;
public Color acctive;
public Color unacctive;
void Start()
{
_button = transform.GetComponent<Button>();
_buttonImage = transform.GetComponent<Image>();
if (!Object.activeSelf)
{
_buttonImage.color = unacctive;
}
else
{
_buttonImage.color = acctive;
}
}
public void ObjectToggle()
{
if (!Object.activeSelf)
{
Object.SetActive(!Object.activeSelf);
_buttonImage.color = acctive;
}
else
{
Object.SetActive(!Object.activeSelf);
_buttonImage.color = unacctive;
}
_simple_button.update();
}
public void update()
{
if (!Object.activeSelf)
{
_buttonImage.color = unacctive;
}
else
{
_buttonImage.color = acctive;
}
}
}