- Home /
Enable Draw Halo in Light Component via Script
I have a script attached to a gameobject. In the script I create a new light component.
How do I enable the "Draw Halo" button you can see in the Unity Editor via Script (C#)
(To clarify, this is not in regards to the Halo Component which cannot be edited via script, this is to enable the Draw Halo boolean in the Light Component.)
Comment
Best Answer
Answer by Rickywild · Feb 05, 2017 at 07:33 PM
Try this,
private void SetHalo(bool turnOn)
{
Component halo = _haloObj.GetComponent("Halo");
if(turnOn)
{
halo.GetType().GetProperty("enabled").SetValue(halo, true, null);
}
else
{
halo.GetType().GetProperty("enabled").SetValue(halo, false, null);
}
}
You may need to uncheck draw halo and add your own Halo component on the gameobject.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Change the Halo Component (not the default) in a light in C#??? 0 Answers
Halo not appearing. Standard solution doesn't work 1 Answer
Adjusting size of a halo in C# 0 Answers