mirror of
https://github.com/Xevion/Boids.git
synced 2025-12-05 23:14:21 -06:00
fix NullReferenceExceptions with focused boids during maximized play
during maximized play, focusing a Boid would cause NullReferenceExceptions as there was no active SceneView in the Unity Editor. Thus, without a SceneView, attempting to acquire one would return null. No test was done prior to acting on the Nullable return.
This commit is contained in:
@@ -75,7 +75,7 @@ public class BoidController : MonoBehaviour {
|
||||
|
||||
// Focus on the boid in scene view when one is focused
|
||||
#if UNITY_EDITOR
|
||||
if(focusedBoid != null)
|
||||
if(focusedBoid != null && SceneView.lastActiveSceneView != null)
|
||||
SceneView.lastActiveSceneView.LookAtDirect(focusedBoid.transform.position, Quaternion.identity);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user