Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Toggle Halo from script?

Discussion in 'Editor & General Support' started by SpookyCat, Feb 23, 2010.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,679
    Hi All
    Hope someone can point me in the right direction, I can't seem to find any method to turn the Halo on and off from a script on a light, also cant find how to change the projection method or the shadowquality setting per light either. Is this not allowed from scripts?
    Thanks
    Chris
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    I don't think there is any way to change the other settings, but you should be able to remove the halo by setting the flare property to null.
     
  3. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    162
    It's possible with C# and System.Reflection:

    var haloComponent= GetComponent("Halo");
    var haloEnabledProperty = haloComponent.GetType().GetProperty("enabled");
    haloEnabledProperty.SetValue(haloComponent, enable, null);