Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


operator /

Divides a vector by another vector.
Read time 1 minuteLast updated 5 days ago

Definition

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

operator /(Vector2, Vector2)

Divides a vector by another vector.
public static Vector2 operator /(Vector2 a, Vector2 b)

Parameters

The vector to divide.

The vector to divide by.

Returns

Type

Description

Vector2

Remarks

Divides each component of
a
by its matching component from
b
.

operator /(Vector2, float)

Divides a vector by a number.
public static Vector2 operator /(Vector2 a, float d)

Parameters

The vector to divide.

The number to divide by.

Returns

Type

Description

Vector2

Remarks

Divides each component of
a
by a number
d
.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // make the vector twice shorter: prints (0.5,1.0) print(new Vector2(1, 2) / 2.0f); }}