How to I "spawn" a Halo?

I'm trying to "light up" options on my front-end menu using a self illuminating material, and I'd like to use a Halo on each letter too.

Halo's are easy to set up from the inspector, but all my menus are driven by code (for localisation purposes), so I need to be able to "spawn" a halo on each letter as I change it's material.

My initial idea is to add a halo but "disable" it when I create the letter in the first place - the problem is, I can find no documentation anywhere about how to actually create a halo from scratch!

Any ideas anyone?

Cheers,

SB

As far as I can see, there appears to be no scripting interface to the "halo" setting on the light objects.

Perhaps you could instantiate a new Light prefab for each new halo that you want to display? I.e. first you'd create a prototype light, with the halo switched on, and the "culling mask" et to "nothing" (because you only want to show a halo, not to actually light your geometry with these instances).

Then create a new prefab in your project pane, and drag the light gameobject onto that. Then delete the 'prototype' from your hierarchy.

You can then use Instantiate to create a new instance of your Light prefab (which doesn't actually apply lighting because of its layermask setting), to show a halo at whatever position you like.

I know this isn’t the exact script you are looking for, but it is something you could modify to work for lights. This is a flickering light script I made for fire and explosions. Just attach this to a Light with a halo on it. It will switch on and off depending on how you set the code.

var illuminate : boolean;

var min : float;

var max : float;

function Start()

{
illuminate = true;
}

function Update()
{
if(illuminate)
{
GetComponent(“Light”).enabled = true;
}

 else
 {
      GetComponent("Light").enabled = false;
 }
 Flicker();

}

function Flicker()
{
var flicker_time = Random.Range(min, max);

yield new WaitForSeconds(flicker_time);

illuminate = !illuminate;

}

Ahh, Halo is not only a component of light! You can have a light, and a separate halo component!

gameObject.AddComponent(“Halo”);

to disable / enable

GetComponent(“Halo”).enabled = true;
GetComponent(“Halo”).enabled = false;

or something like a boolean would work.

var halo_on : boolean;

function Update()
{
if(halo_on)
{
GetComponent(“Halo”).enabled = true;
}

 else
 {
      GetComponent("Halo").enabled = false;
 }

}