2D Shooter bullets don't render properly

Hi all,

First post here and also very early days teaching myself unity so please bare with me.

I’m using the new input system. I have a weaponSprite, a firePoint sprite and a bullet prefab.
I have a playerMovement, which is attached to my player sprite. Inside of which I have a:

public InputAction playerShootIn the Inspector i’ve mapped this to my Gamepads “right trigger”

I also have a:

[Serialized] public Weapon weapon = new Weapon();

which has my weapon.cs attached to it

My Update() method contains the following:
playerShoot.performed += _ => weapon.Fire();
which i borrowed from here

And finally my weapon.cs’s Fire() method looks like this:

    public void Fire()
    {
        GameObject bullet = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
        bullet.GetComponent<Rigidbody2D>().AddForce(firePoint.up * 1000, ForceMode2D.Impulse);
    }

The problem i have is when i press the right trigger, i see in the hirachy my bullets are spawning very quickly and dissappearing (this is fine, i’m destroying the object using OnBecameInvisible. but i can’t actually see the bullets properly, the seem to glitch - I feel like maybe i’m rendering them too fast or something?

I’ve attached a gif showing what my issue is, as you can see the black bullet spawns on the firePoint but doesn’t seem to render the animation of force

If there’s any more information I9229506--1289139--2023-08-17 14-22-53.gif can provide just ask, thanks !

You’re trying to move the bullet at 1000m/s which is crazy fast. I would suggest that you need to scale down the size of your visuals if you’re moving stuff that fast.

AHA, thanks i didn’t make that connection, setting it to 20f gives me a more reasonable bullet speed now thanks!

Next question if you don’t mind, what would be the correct approach to introduce rate of fire? I’m assuming some kind of delay bettween spawning each bullet. I know dotnet has thread.sleep for example but i don’t see anything similar in mono?

Cooldown timers, gun bullet intervals, shot spacing, rate of fire:

https://discussions.unity.com/t/821482/2

GunHeat (gunheat) spawning shooting rate of fire:

https://discussions.unity.com/t/824570/2

Thanks!