Example #1
0
    public static T MissingComponent <T>([NotNull] this GameObject gameObject) where T : Component
    {
        if (gameObject is null)
        {
            throw new NullReferenceException(nameof(gameObject));
        }
        if (!gameObject)
        {
            throw new MissingReferenceException(nameof(gameObject));
        }

        return(GameObjectUtilities.MissingComponentWithoutChecks <T>(gameObject));
    }
Example #2
0
    public static Component MissingComponent([NotNull] this GameObject gameObject, Type componentType)
    {
        if (gameObject is null)
        {
            throw new NullReferenceException(nameof(gameObject));
        }
        if (!gameObject)
        {
            throw new MissingReferenceException(nameof(gameObject));
        }

        return(GameObjectUtilities.MissingComponentWithoutChecks(gameObject, componentType));
    }