Question by
samuelviveros3 · Jul 30, 2020 at 12:34 AM ·
c#vector2directional
How to Get Directional Words with Vector2?
Hello, I am new to Unity and need some help.
Currently, I am making a 2D fighting game and am currently trying to get the Console to log if I move left, or right, up, down, etc.
This is my code (ignore the weird name):
void Awake () {
controls = new InputMaster();
controls.Freez.Movement.performed += context => Move(context.ReadValue<Vector2>());
controls.Freez.StandardAttack.performed += context => Attack();
controls.Freez.SpecialAttack.performed += context => Attack();
}
void Move(Vector2 direction) {
Debug.Log("Freez moved" + direction);
}
Currently, when I run the "game", I get "Freez moved (1.0, 0.0) (-1.0, 0.0).
I know the coordinates mean left and right, but is there any way I can get it to display "left"/right"?
Comment