Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

change button color in script unity

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
 
public class ColorActivity : MonoBehaviour {
    //Reference to button to access its components
    private Button theButton;
 
    //this get the Transitions of the Button as its pressed
    private ColorBlock theColor;
 
    // Use this for initialization
    void Awake () {
        theButton = GetComponent<Button>();
        theColor = GetComponent<Button>().colors;
 
    }
 
 
    /// <summary>
    /// Example
    /// just add this to your Button component On Click()
    /// </summary>
    public void ButtonTransitionColors()
    {
 
        theColor.highlightedColor = Color.blue;
        theColor.normalColor = Color.cyan;
        theColor.pressedColor = Color.green;
 
        theButton.colors = theColor;
        print("Cliked");
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity quaternion 
Csharp :: get enum value from display name c# 
Csharp :: system.windows.forms not found 
Csharp :: unity icons 
Csharp :: dynamic arrays in c# 
Csharp :: c# static meaning 
Csharp :: total months between two dates c# 
Csharp :: move files from one directory to another using c# 
Csharp :: how to remove space between string in c# 
Csharp :: asp.net file detect mime type 
Csharp :: c# datetime add 
Csharp :: c# sum of list 
Csharp :: set parent of gameobject unity 
Csharp :: editorfor date format mvc 
Csharp :: getcomponent unity 
Csharp :: c# change label from thread 
Csharp :: wpf mouse over style trigger 
Csharp :: connection string in asp.net with username and password 
Csharp :: git find commits by file path 
Csharp :: c# string code ascii 
Csharp :: c# list object sort alphabetically 
Csharp :: c# remove first 5 characters from string 
Csharp :: generate qr code c# 
Csharp :: unity create empty gameobject in code 
Csharp :: unity no serializefield 
Csharp :: how use vue createApp 
Csharp :: get what week of the month c# 
Csharp :: copy class c# 
Csharp :: unity send post request json 
Csharp :: c# get the first 4 characters in the list 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =