< Summary

Class:GDX.GameObjectExtensions
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/GameObjectExtensions.cs
Covered lines:0
Uncovered lines:18
Coverable lines:18
Total lines:121
Line coverage:0% (0 of 18)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:2
Method coverage:0% (0 of 2)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetFirstComponentInChildrenComplex[T](...)0%30500%
GetOrAddComponent[T](...)0%6200%

File(s)

./Packages/com.dotbunny.gdx/GDX/GameObjectExtensions.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5#if !UNITY_DOTSRUNTIME
 6
 7using System.Diagnostics.CodeAnalysis;
 8using System.Runtime.CompilerServices;
 9using UnityEngine;
 10
 11namespace GDX
 12{
 13    /// <summary>
 14    ///     <see cref="UnityEngine.GameObject" /> Based Extension Methods
 15    /// </summary>
 16    /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception>
 17    [VisualScriptingCompatible(2)]
 18    public static class GameObjectExtensions
 19    {
 20        /// <summary>
 21        ///     Destroy child <see cref="GameObject" />.
 22        /// </summary>
 23        /// <param name="targetGameObject">The parent <see cref="GameObject" /> to look at.</param>
 24        /// <param name="deactivateBeforeDestroy">
 25        ///     Should the <paramref name="targetGameObject" />'s children be deactivated before
 26        ///     destroying? This can be used to immediately hide an object, that will be destroyed at the end of the fra
 27        /// </param>
 28        /// <param name="destroyInactive">Should inactive <see cref="GameObject" /> be destroyed as well?</param>
 29        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 30        [ExcludeFromCodeCoverage]
 31        public static void DestroyChildren(this GameObject targetGameObject, bool deactivateBeforeDestroy = true,
 32            bool destroyInactive = true)
 33        {
 34            targetGameObject.transform.DestroyChildren(deactivateBeforeDestroy, destroyInactive);
 35        }
 36
 37        /// <summary>
 38        ///     A slightly more complex version of <see cref="Component.GetComponentInChildren{T}(bool)" /> which allows
 39        ///     different hinted search options.
 40        /// </summary>
 41        /// <remarks>