UnassignedReferenceException: The variable muzzleFlash of ‘Gun’ has not been assigned.
You probably need to assign the muzzleFlash variable of the Gun script in the inspector.
Gun.Start () (at Assets/Standard Assets/Scripts/General Scripts/Gun.js:41)
is what i got and here is the line of code
muzzleFlash.renderer.enabled = false;
Well…
Is the MuzzelFlash attached the gun as a child object .
A really lazy way to do this would to add a public var to the top of your script to reference the object you need to disable
var Muzzel : GameObject;
function Shoot() {
Muzzel.renderer.enabled = true ;
//
yield WaitForSecounds(0.01) ;
Muzzel.renderer.enabled = false ;
}
We call this function whenever we need to fire off the gun .
And line Daniel said you probably just need to assign it .
It’s already like that. Otherwise the error wouldn’t have reminded him to assign it.
Hmm, good point, other wise it would of given him an unassigned local variable error