Legacy Documentation: Version 5.6 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ColorBlock.pressedColor

public Color pressedColor;

Description

Pressed Color.

using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.

public class ExampleClass : MonoBehaviour { public Button button; public Color newColor;

void Start() { //Changes the button's Pressed color to the new color. ColorBlock cb = button.colors; cb.pressedColor = newColor; button.colors = cb; } }