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 I
can provide just ask, thanks !