diff --git a/Source/Editor/Editor.cs b/Source/Editor/Editor.cs index ce8805af0..5cada5d87 100644 --- a/Source/Editor/Editor.cs +++ b/Source/Editor/Editor.cs @@ -816,9 +816,16 @@ namespace FlaxEditor /// The bounding sphere. public static void GetActorEditorSphere(Actor actor, out BoundingSphere sphere) { - Internal_GetEditorBoxWithChildren(FlaxEngine.Object.GetUnmanagedPtr(actor), out var box); - BoundingSphere.FromBox(ref box, out sphere); - sphere.Radius = Math.Max(sphere.Radius, 15.0f); + if (actor) + { + Internal_GetEditorBoxWithChildren(FlaxEngine.Object.GetUnmanagedPtr(actor), out var box); + BoundingSphere.FromBox(ref box, out sphere); + sphere.Radius = Math.Max(sphere.Radius, 15.0f); + } + else + { + sphere = BoundingSphere.Empty; + } } /// @@ -828,7 +835,14 @@ namespace FlaxEditor /// The bounding box. public static void GetActorEditorBox(Actor actor, out BoundingBox box) { - Internal_GetEditorBoxWithChildren(FlaxEngine.Object.GetUnmanagedPtr(actor), out box); + if (actor) + { + Internal_GetEditorBoxWithChildren(FlaxEngine.Object.GetUnmanagedPtr(actor), out box); + } + else + { + box = BoundingBox.Zero; + } } ///