Hello,
I added a light component to a muzzle flash and in the script i added an intensity modifier. It actually works great and looks nice, not being on all the time and it only appears with the muzzle flash, but i am getting a null reference still, i am not sure why…i tried adding a point light instead to the parent objects but that dint kill the call for null…so i am thinking its a small variance in the specifics of the code at the light intensity call…Can anyone help me see whats up here please?hmmm
The code is in the late update
function LateUpdate() {
if (muzzleFlash) { // We shot this frame, enable the muzzle flash
if (m_LastFrameShot == Time.frameCount) {
muzzleFlash.transform.localRotation = Quaternion.AngleAxis(Random.value * 90, Vector3.forward);
muzzleFlash.enabled = true;
//lightGameObject.AddComponent(Light);
muzzleFlash.light.intensity = 3;
} else { // no shot, disable the muzzle flash
muzzleFlash.enabled = false;
enabled = false;
muzzleFlash.light.intensity = 0;
if (bulletsLeft == 0){
Reload();}
}
}
}