I want to create a muzzle flash for my gun, and I incorporated it into my shoot script. Here’s an excerpt:
if(Input.GetButton("Fire1") && Time.time > nextFire && bulletsLeft > 0 && !boosting) {
nextFire = Time.time + fireRate;
Instantiate (projectile, shootPointOne.position, transform.rotation);
Instantiate (muzzleFlash, shootPointOne.position, transform.rotation);
hasFired = true;
}
It all works except for the muzzleFlash. The muzzleFlash is a Texture2D and this seems the most logical way for making a muzzle flash without animations. Is this the correct way to approach this, or is their a better, more direct way?