Only part of my collision event is happening?

Trying to create a thunder and lightning effect which will start as the player enters a certain area. Was using two very simple scripts before to get the effects I need and separately both did what was expected.
Now I want both effects to happen at the same time in conjunction with a trigger.

My problem being is that now the light effect doesn’t flicker, it simply (randomly) either turns on or not once the trigger is activated.
I’m not getting any errors and everything runs fine, just the damn light doesn’t flicker ?

Sound effect code-

#pragma strict

var Thunder1 : AudioClip;

function OnTriggerEnter()
{
    audio.PlayOneShot(Thunder1);
}

Light flicker code-

var FlashingLight : Light;

FlashingLight.enabled = false;


function FixedUpdate ()
{

    var RandomNumber = Random.value;

    if(RandomNumber<=.4)
        {
            FlashingLight.enabled = true;
        }
   
        else
   
        FlashingLight.enabled=false;

}

This is the hybrid script (obviously I’m doing something wrong)?

#pragma strict

var Thunder1 : AudioClip;
var FlashingLight : Light;

FlashingLight.enabled = false;

function OnTriggerEnter()

{
    audio.PlayOneShot(Thunder1);
   
    var RandomNumber = Random.value;

    if(RandomNumber<=.4)
        {
            FlashingLight.enabled = true;
        }
   
        else
   
        FlashingLight.enabled=false;
}

Any help would be appreciated guys?

Anybody?

The original light flicker code is called in FixedUpdate (every physics step), whereas in the hybrid script it’s called only once when the trigger is entered.

You probably want to put the audio in OnTriggerEnter and the light flicker code in OnTriggerStay.

Yeah that pretty much sorted it.
Using your suggestion I basically split the audio and light effects and call/instantiate each separately which works fine.

Thanks for the reply