[Serializable]
public struct ColorBlock : IEquatable<ColorBlock>
Fields defaultColorBlock
Simple getter for a code generated default ColorBlock.
Declarationpublic static ColorBlock defaultColorBlock
Field Value Properties colorMultiplier
Multiplier applied to colors (allows brightening greater then base color).
Declarationpublic float colorMultiplier { get; set; }
Property Value disabledColor
The disabled color for this color block.
Declarationpublic Color disabledColor { get; set; }
Property Value Examples
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 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.
Declarationpublic float fadeDuration { get; set; }
Property Value highlightedColor
The highlight color for this color block.
Declarationpublic Color highlightedColor { get; set; }
Property Value Examples
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 Highlighted color to the new color.
ColorBlock cb = button.colors;
cb.highlightedColor = newColor;
button.colors = cb;
}
}
normalColor
The normal color for this color block.
Declarationpublic Color normalColor { get; set; }
Property Value Examples
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 Normal color to the new color.
ColorBlock cb = button.colors;
cb.normalColor = newColor;
button.colors = cb;
}
}
pressedColor
The pressed color for this color block.
Declarationpublic Color pressedColor { get; set; }
Property Value Examples
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;
}
}
selectedColor
The selected color for this color block.
Declarationpublic Color selectedColor { get; set; }
Property Value Examples
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 Selected color to the new color.
ColorBlock cb = button.colors;
cb.selectedColor = newColor;
button.colors = cb;
}
}
Methods Equals(object) Declaration
public override bool Equals(object obj)
Parameters Type Name Description object obj Returns Overrides Equals(ColorBlock) Declaration
public bool Equals(ColorBlock other)
Parameters Returns GetHashCode() Declaration
public override int GetHashCode()
Returns Overrides Operators operator ==(ColorBlock, ColorBlock) Declaration
public static bool operator ==(ColorBlock point1, ColorBlock point2)
Parameters Returns operator !=(ColorBlock, ColorBlock) Declaration
public static bool operator !=(ColorBlock point1, ColorBlock point2)
Parameters Returns Implements
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4