CrossHair

PHOTO EMBED

Tue May 17 2022 21:19:01 GMT+0000 (UTC)

Saved by @BiscuitTinx #c#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Crosshair : MonoBehaviour
{
    public Camera Cam;
    public LayerMask buttons;

    void Start()
    {
        //Cursor.lockState = CursorLockMode.Locked;
       //Cursor.visible = false;
    }

    private void Update()
    {
        RaycastHit hit;
        Ray ray = Cam.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit) && Input.GetMouseButtonDown(0))
        {
            Transform objHit = hit.transform;
            Debug.Log(hit);
        }
    }

}
content_copyCOPY