Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


operator *

Multiplies a vector by a number.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Operator
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

operator *(Vector4, float)

Multiplies a vector by a number.
public static Vector4 operator *(Vector4 a, float d)

Parameters

The vector to multiply.

The number to multiply by.

Returns

Type

Description

Vector4

Remarks

Multiplies each component of
a
by a number
d
.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // make the vector twice longer: prints (2.0,4.0,6.0,8.0) print(new Vector4(1, 2, 3, 4) * 2.0f); }}

operator *(float, Vector4)

Multiplies a number by a vector.
public static Vector4 operator *(float d, Vector4 a)

Parameters

The number to multiply.

The vector to multiply by.

Returns

Type

Description

Vector4

Remarks

Multiplies number
d
by each component of
a
.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // make the vector twice longer: prints (2.0,4.0,6.0,8.0) print(2.0f * new Vector4(1, 2, 3, 4)); }}