2 answers ·
asked February 4, 2018 5:01pm
· Lesson: Adding Muzzle Flashes · Course: Fundamentals of Weapon Mechanics in Unity
Hi! For some reason my gun just shows the muzzle flash not when I fire, but while i'm in idle or playing the reloading animation.
Make sure the particle system of the muzzle flash is not set to "Play On Awake". It's a checkbox in the first section of the particle system. Either that, or after you first fire it stays on and you're not turning it off again.
I might also suggest using a single image as a muzzle flash. Previously I used particle effects for it, but sometimes these appear on screen so quickly that it can cause issues getting them to play properly. A single image of a muzzle flash appearing on screen when you fire then disappearing afterward would be better. Just rotate/scale it randomly every time you fire.
Changing the Start Lifetime of the particle system worked for me.