Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

Color.operator *

static function operator *(a: Color, b: Color): Color;
static Color operator *(Color a, Color b);
static def operator *(a as Color, b as Color) as Color

Description

Multiplies two colors together. Each component is multiplied separately.

// white * gray = gray
var grayColor: Color = Color.gray * Color.white;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Color grayColor = Color.gray * Color.white;
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public grayColor as Color = (Color.gray * Color.white)

static function operator *(a: Color, b: float): Color;
static Color operator *(Color a, float b);
static def operator *(a as Color, b as float) as Color

Description

Multiplies color a by the float b. Each color component is scaled separately.

// gray * 2 = White
var whiteColor: Color = Color.gray * 2;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Color whiteColor = Color.gray * 2;
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public whiteColor as Color = (Color.gray * 2)

static function operator *(b: float, a: Color): Color;
static Color operator *(float b, Color a);
static def operator *(b as float, a as Color) as Color

Description

Multiplies color a by the float b. Each color component is scaled separately.

// 2 * gray = White
var whiteColor: Color = 2 * Color.gray;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Color whiteColor = 2 * Color.gray;
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public whiteColor as Color = (2 * Color.gray)