Problem creating a gameobject radius when I trigger a button

Hello, I’m new to this group and a beginner in using Unity 2D.

I have a problem:

I can’t create a circular bullet that increases its radius when I press a key button and gets destroyed when it reaches the maximum radius or size.

here my codes:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class whiteTrigger : MonoBehaviour
{
    [SerializeField]
    private GameObject _bulletPrefab;

    [SerializeField]
    private float _bulletSpeed;

    [SerializeField]
    private Transform _gunOffset;

    [SerializeField]
    private float _timeBetweenShots;

    [SerializeField]
    private float _bulletLifespan = 10f;

    [SerializeField]
    private float growthRate = 1f;

    [SerializeField]
    private float currentRadius = 1.0f;

    private bool _fireContinuously;
    private bool _fireSingle;
    private float _lastFireTime;

    void Update()
    {
        if (_fireSingle)
        {
            float timeSinceLastFire = Time.time - _lastFireTime;

            if (timeSinceLastFire >= _timeBetweenShots)
            {
                FireBullet();

                _lastFireTime = Time.time;
                _fireSingle = false;
            }
        }

        // Increase the radius over time
        currentRadius += growthRate * Time.deltaTime;
    }

    private void FireBullet()
    {
        GameObject bullet = Instantiate(_bulletPrefab, _gunOffset.position, transform.rotation);
        Rigidbody2D rigidbody = bullet.GetComponent<Rigidbody2D>();

        // Set the velocity of the bullet
        rigidbody.velocity = _bulletSpeed * transform.up;

        // Update the scale of the circle based on the new radius
        bullet.transform.localScale = new Vector3(currentRadius, currentRadius, 1.0f);

        // Check if the radius exceeds 100 and destroy the GameObject
        Destroy(bullet, _bulletLifespan);
    }

    private void OnFire(InputValue inputValue)
    {
        // _fireContinuously = inputValue.isPressed;

        if (inputValue.isPressed)
        {
            _fireSingle = true;
        }
    }
}

Here the video of the problem:

Here the videos that I want to happen

With your script above, currentRadius will always be continuously increasing because you are applying the growth rate on every Update(). When a new bullet is spawned in FireBullet() it will be much larger than the initial radius you intend.

If you want each bullet’s radius to independently increase over time, then you will need to control the bullet’s radius from a script on the bullet. Since you may have multiple bullets active at different sizes, they each need to track their own radius.