/// <summary> /// Gets the name of the axis /// </summary> /// <param name="axis">Target axis</param> /// <param name="playerIndex">Index of the player</param> /// <returns>The name of the axis</returns> public static string GetAxisName(Axises axis, int playerIndex) { return(axis.ToString() + playerIndex); }
private void FixedUpdate() { float v = Input.GetAxisRaw(axis.ToString()); GetComponent <Rigidbody2D>().velocity = new Vector2(0, v) * speed; }