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: float): Color;
static Color operator /(Color a, float b);
static def operator /(a as Color, b as float) as Color

Description

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

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

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

public class ExampleClass(MonoBehaviour):

	public grayColor as Color = (Color.white / 2)