Search Unity

How to add Halo by Script?

Discussion in 'Scripting' started by Dazzid, Jul 7, 2015.

  1. Dazzid

    Dazzid

    Joined:
    Apr 15, 2014
    Posts:
    61
    Hi All,
    My question is just that:
    GameObject.AddComponent<Halo>();
    How to make it work in C#? Seems that there is no code for that :(

    Thanks for the help
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    lowercase g

    Code (csharp):
    1.  
    2. gameObject.AddComponent<Halo>();
    3.  
    you want "this gameObject" not the "GameObject class"