i want to make a kind of virtual joystick that also works on the mouse for my fighting game. so that after if it is on plus or minus and what side is dominant i can change the attack happening.
If i understand correctly.
You can use Quaternion.eulerAngles:
Than just catch the info.
You can probably just get the mouse position relative to the center of the screen.
var mousePos = Input.mousePosition; mousePos.x -= Screen.width / 2; mousePos.y -= Screen.height / 2;
Then something like
if (mousePos.x < 0)
{
//Attack left
}
else if (mousePos.x > 0)
{
//Attack right
}
if (mousePos.y < 0)
{
//Attack down
}
else if (mousePos.y > 0)
{
//Attack up
}