mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 06:08:16 +08:00
Fix potential NullReference in UpdateMouseInspect
This commit is contained in:
parent
9f1df11940
commit
c927ac54be
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user