Unity 6.0 URP Additional Lights - Turn on and off

I’m having a problem with making my own custom lighting shader in Unity 6.0(6000.054f1) using URP, I know there is a newer version where it has been made easier to make custom lighting, but I would like to make it work in this version for reasons

LightFlicker

I only have two spot lights and the directional light, so it cant be that its getting over the light limit per object?

Dont know if I’m missing a boolean keyword? dont know much about it in general, I have just been following Ben Clowards Custom Lighting tutorial

the code for my additional light:

Diffuse = MainDiffuse;
Specular = MainSpecular;
Color = MainColor \* (MainDiffuse + MainSpecular);

#ifndef SHADERGRAPH_PREVIEW

uint pixelLightCount = GetAdditionalLightsCount();

LIGHT_LOOP_BEGIN(pixelLightCount) //repeats for each additional light
    //get light color and direction
    lightIndex = GetPerObjectLightIndex(lightIndex);
    Light light = GetAdditionalPerObjectLight(lightIndex, WorldPosition);

    //calculate Shadows
    light.shadowAttenuation = AdditionalLightRealtimeShadow(lightIndex, WorldPosition, light.direction);
    float atten = light.distanceAttenuation * light.shadowAttenuation;

    //calculate diffuse and specular
    float NdotL = saturate(dot(WorldNormal, light.direction));
    float thisDiffuse = atten * NdotL;
    float3 thisSpecular = LightingSpecular(thisDiffuse, light.direction, WorldNormal, WorldView, 1, Smoothness);

    //accumulate light
    Diffuse += thisDiffuse;
    Specular += thisSpecular;
    Color += light.color * (thisDiffuse + thisSpecular);
LIGHT_LOOP_END

float total = Diffuse + dot(Specular, float3(0.333, 0.333, 0.333));
Color = total <= 0 ? MainColor : Color / total;

#endif