Answers for "How to get mouse position in unity"

22

unity get mouse position

Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Posted by: Guest on July-16-2020
11

how to find the mouse position unity

Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Posted by: Guest on March-12-2020
0

How to get mouse position in unity

using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Vector3 mousePos = Input.mousePosition;
            {
                Debug.Log(mousePos.x);
                Debug.Log(mousePos.y);
            }
        }
    }
}
Posted by: Guest on June-22-2021

Code answers related to "How to get mouse position in unity"

Browse Popular Code Answers by Language