How to change a point light intensity with an updating float

For reference, speedMultiplier = 200 and the intensity fo the point light is 5000. (lux) My engine object has a point light child and this script. Speed Multiplier is the speed of another object, which I want to use to control the light intensity. multiplierUpdate defines and displays the float values, while UpdateValues overrides the light.intensity.
When I start the game, the point light disappears from the inspector, and lightIntensity says 318 for some reason. When I delete UpdateValues to see what happens, the point light stays in the inspector when I start, but lightIntensity still says 318, clearly referring to something else.

public class Engine_Controller : MonoBehaviour
{
    public Free_Roam freeRoam;
    public Light lightObject;
    public float lightIntensity;
    public float speedMultiplier;
    

    public void Update()
    {
        multiplierUpdate();
        UpdateValues();
    }

    public void multiplierUpdate()
    {
        lightIntensity = lightObject.intensity;
        speedMultiplier = freeRoam.speed;
    }
    
    void UpdateValues()
    {
        lightObject = gameObject.GetComponent<Light>();
        lightObject.intensity = lightIntensity * speedMultiplier;
    }
    
}

You are setting lightIntensity = lightObject.intensity and then assigning it back to lightObject.intensity = lightIntensity * speedMultiplier. This means that on the next update, you are doing lightIntensity = lightObject.intensity again which gives you the already multiplied value, and you multiply it again, and so on.


You probably just want to remove lightIntensity = lightObject.intensity and instead do lightObject.intensity = lightObject.intensity * speedMultiplier.