Skip to content

Instantly share code, notes, and snippets.

View nebadon2025's full-sized avatar

Michael Cerquoni nebadon2025

View GitHub Profile
@HilariousCow
HilariousCow / InteractionRaycaster.cs
Last active October 15, 2023 23:29
If you are finding that PhysicsRaycaster isn't working when you use Cursor.lockstate (i.e. an FPS game), use this instead.
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;
//I used ILSpy on the Unity UI dll to copy out the Physicsraycaster code and fix where the ray eminates from (in this case, always the center of the screen)
public class InteractionRaycaster : PhysicsRaycaster {
[Range(0.0f, 0.5f)]