Horje
change button color in script unity Code Example
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");
    }
}




Csharp

Related
zip file ignoring directory starting with dot Code Example zip file ignoring directory starting with dot Code Example
c# code to check anagram Code Example c# code to check anagram Code Example
VSIX Project Context Menu Code Example VSIX Project Context Menu Code Example
fluent assertion exception Code Example fluent assertion exception Code Example
Send Hotmail/Outlook Email C# (Win/ASP.NET) Code Example Send Hotmail/Outlook Email C# (Win/ASP.NET) Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10