mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2024-12-23 01:59:40 +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)
|
||||
{
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user