using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.publicclassExampleClass : MonoBehaviour
{
public Button button;
public Color newColor;
voidStart()
{
//Changes the button's Disabled color to the new color.
ColorBlock cb = button.colors;
cb.disabledColor = newColor;
button.colors = cb;
}
}
fadeDuration
How long a color transition between states should take.
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.publicclassExampleClass : MonoBehaviour
{
public Button button;
public Color newColor;
voidStart()
{
//Changes the button's Highlighted color to the new color.
ColorBlock cb = button.colors;
cb.highlightedColor = newColor;
button.colors = cb;
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.publicclassExampleClass : MonoBehaviour
{
public Button button;
public Color newColor;
voidStart()
{
//Changes the button's Normal color to the new color.
ColorBlock cb = button.colors;
cb.normalColor = newColor;
button.colors = cb;
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.publicclassExampleClass : MonoBehaviour
{
public Button button;
public Color newColor;
voidStart()
{
//Changes the button's Pressed color to the new color.
ColorBlock cb = button.colors;
cb.pressedColor = newColor;
button.colors = cb;
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.publicclassExampleClass : MonoBehaviour
{
public Button button;
public Color newColor;
voidStart()
{
//Changes the button's Selected color to the new color.
ColorBlock cb = button.colors;
cb.selectedColor = newColor;
button.colors = cb;
}
}