operator -(Vector2, Vector2)
Subtracts one vector from another.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Operator
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static Vector2 operator -(Vector2 a, Vector2 b)
Parameters
Returns
Type | Description |
|---|---|
| Vector2 | The difference between the two vectors, returned as a Vector2 struct. |
Remarks
Subtracts each component of from .
baExamples
using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Create two vectors. Vector2 A = new Vector2(1, 2); Vector2 B = new Vector2(3, 2); // Subtract vector B from vector A. Vector2 C = A - B; // Print the result. print(C); }}