- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
manhtuan91 · Sep 12, 2014 at 10:43 AM ·
2dshooterhidemouse cursor
Hide mouse cursor but get mouse moving (up or down)
Hi guy, I'm making 2d shooter. I want the player's arm rotate when mouse up or down and hide mouse cursor.
I used Screen.showCursor = false but my game does not get mouse transform and when I press left click, mouse cursor is not hide.
How can I do that?
My English is not good, so sorry. Thank you.
Comment
Best Answer
Answer by orb · Sep 12, 2014 at 10:53 AM
This works for me:
using UnityEngine;
public class Activity : MonoBehaviour
{
void Start()
{
Screen.showCursor = false;
}
void Update()
{
float x = Input.GetAxis("Mouse X");
float y = Input.GetAxis("Mouse Y");
Debug.Log(x+", "+y);
}
}
There is no mouse transform, only movement values. The cursor should not be showing if you've hidden it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613162840im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shooting in direction of mouse cursor 2d 5 Answers
Writing weapon imprecision 1 Answer
[Top Down Shooter] Make bullets pass through some gameobjects 1 Answer
2D Aiming in Physics Based Racer 0 Answers
Its this possible? 1 Answer