32 lines
743 B
C#
Raw Normal View History

2024-10-23 09:14:01 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dame : MonoBehaviour
{
void Start()
{
}
// Update is called once per frame
void Update()
{
// 检查鼠标左键点击
if (Input.GetMouseButtonDown(0))
{
// 获取鼠标点击的屏幕坐标
Vector3 mousePosition = Input.mousePosition;
// 将屏幕坐标转换为世界坐标
Vector3 worldPosition = Camera.main.ScreenToWorldPoint(mousePosition);
// 显示屏幕坐标和世界坐标
Debug.Log("Screen Position: " + mousePosition);
Debug.Log("World Position: " + worldPosition);
}
}
}