mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-01 11:12:49 +08:00
Fix potential NullReference in UpdateMouseInspect
This commit is contained in:
@ -35,6 +35,15 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
|
|
||||||
public override void UpdateMouseInspect(Vector2 mousePos)
|
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);
|
var ray = MainCamera.ScreenPointToRay(mousePos);
|
||||||
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user