Skip to main content
Became Hot Network Question
Cleanup
Source Link
DMGregory
  • 136.3k
  • 22
  • 247
  • 373

Change color of point lights changing automaticalyautomatically over time

imI'm using a gradient script to change dethe color of a sphere over time, but iI want a point light asociatedassociated to it to change too. the

The script imI'm using is this:

public class gradient : MonoBehaviour { public Gradient myGradient; public float strobeDuration = 2f;

public class gradient : MonoBehaviour
{
    public Gradient myGradient;
    public float strobeDuration = 2f;

    public void Update()
    {
        float t = Mathf.PingPong(Time.time / strobeDuration, 1f);
        GetComponent<Renderer>().material.color= myGradient.Evaluate(t);
    }
}

}

the The light object accepts the script but it doesntdoesn't affect the color, i asume its.

I assume it's because this script is asociatedassociated to materials and light has no material... thanks!

color of point lights changing automaticaly over time

im using a gradient script to change de color of a sphere over time, but i want a point light asociated to it to change too. the script im using is this:

public class gradient : MonoBehaviour { public Gradient myGradient; public float strobeDuration = 2f;

public void Update()
{
    float t = Mathf.PingPong(Time.time / strobeDuration, 1f);
    GetComponent<Renderer>().material.color= myGradient.Evaluate(t);
}

}

the light object accepts the script but it doesnt affect the color, i asume its because this script is asociated to materials and light has no material... thanks!

Change color of point lights automatically over time

I'm using a gradient script to change the color of a sphere over time, but I want a point light associated to it to change too.

The script I'm using is this:

public class gradient : MonoBehaviour
{
    public Gradient myGradient;
    public float strobeDuration = 2f;

    public void Update()
    {
        float t = Mathf.PingPong(Time.time / strobeDuration, 1f);
        GetComponent<Renderer>().material.color= myGradient.Evaluate(t);
    }
}

The light object accepts the script but it doesn't affect the color.

I assume it's because this script is associated to materials and light has no material...

Source Link

color of point lights changing automaticaly over time

im using a gradient script to change de color of a sphere over time, but i want a point light asociated to it to change too. the script im using is this:

public class gradient : MonoBehaviour { public Gradient myGradient; public float strobeDuration = 2f;

public void Update()
{
    float t = Mathf.PingPong(Time.time / strobeDuration, 1f);
    GetComponent<Renderer>().material.color= myGradient.Evaluate(t);
}

}

the light object accepts the script but it doesnt affect the color, i asume its because this script is asociated to materials and light has no material... thanks!