using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraSlotClickDetect : MonoBehaviour { public Camera mainCamera; public LayerMask layerMask; void Update() { if (Input.GetMouseButtonDown(0)) { ShootRay(); } } void ShootRay() { Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask)) { var slotInfo = hit.collider.gameObject.GetComponentInParent(); Debug.Log($"Hit PlacementSlot! At ({slotInfo.x}, {slotInfo.y})"); } } }