Fix potential NullReference in UpdateMouseInspect

This commit is contained in:
Sinai 2022-01-09 19:20:17 +11:00
parent 9f1df11940
commit c927ac54be

View File

@ -35,6 +35,15 @@ namespace UnityExplorer.Inspectors.MouseInspectors
public override void UpdateMouseInspect(Vector2 mousePos)
{
if (!MainCamera)
MainCamera = Camera.main;
if (!MainCamera)
{
ExplorerCore.LogWarning("No Main Camera was found, unable to inspect world!");
InspectUnderMouse.Instance.StopInspect();
return;
}
var ray = MainCamera.ScreenPointToRay(mousePos);
Physics.Raycast(ray, out RaycastHit hit, 1000f);