- Home /
Making an object glow using texture.
Hey I am looking for a way to make an object give a glow for an instance which goes out like a halo and disappears.
I want it to glow out and fade like that and I want that transition to occur for a small instance like when the player gets a point. And I want to be able to control it using script and also its color. If I could get a little help would be awesome. Thanks.
Answer by clunk47 · Jun 04, 2013 at 04:15 AM
For a light to fade in and out, you could simply use light.intensity via script somewhat like:
C-sharp example:
using UnityEngine;
using System.Collections;
public class EXAMPLE : MonoBehaviour
{
float fade = 0.5f;
void Start()
{
StartCoroutine(Pulsate());
}
IEnumerator Pulsate()
{
while(true)
{
if(light.intensity > 0.0f)
light.intensity-= fade;
yield return new WaitForEndOfFrame();
}
}
}
To change colors, check out Color.Lerp.
Keep in mind the above code is just an example off the top of my head, will need tweaking to your own needs to work. Check out the links I posted for more help and better explaining. Hope this helps.
Your answer
Follow this Question
Related Questions
All my stuff become pink like if a pink light could be there. 0 Answers
Halo on GuiTexture 0 Answers
Light, halo and color 1 Answer
lightmap plus per material color 1 Answer
Texture color is not right after import 0 Answers