Struct Vector2MagnitudeComparer
Compare two Vector2 by magnitude.
Namespace: UnityEngine.InputSystem.Utilities
Syntax
public struct Vector2MagnitudeComparer : IComparer<Vector2>
Examples
public class CompositeWithVector2Part : InputBindingComposite<Vector2> { [InputControl(layout = "Vector2")] public int part;
public override Vector2 ReadValue(ref InputBindingCompositeContext context)
{
// Return the Vector3 with the greatest magnitude.
return context.ReadValue<Vector2, Vector2MagnitudeComparer>(part);
}
}
Methods
Compare(Vector2, Vector2)
Declaration
public int Compare(Vector2 x, Vector2 y)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | x | |
Vector2 | y |
Returns
Type | Description |
---|---|
Int32 |