A Vector3 can be converted into a Vector2. (The z is discarded).
using UnityEngine;
class Camera : MonoBehaviour
{
private void Update()
{
Vector3 v3 = ...;
Vector2 v2 = ...;
var distance = Vector2.Distance(v2, new Vector2(v3.x, v3.y));
}
}
Use built-in conversion:
using UnityEngine;
class Camera : MonoBehaviour
{
private void Update()
{
Vector3 v3 = ...;
Vector2 v2 = ...;
var distance = Vector2.Distance(v2, v3);
}
}
A code fix is offered for this diagnostic to automatically apply this change.