- Home /
Question by
ina · Nov 12, 2012 at 01:51 PM ·
getcomponentgenerics
Why use generics GetComponent() and what are generics
Why is it preferable to use the generic form of GetComponent() over the string version?
And, what are generics, exactly?
Comment
@ina you are asking a lot of question that are general program$$anonymous$$g questions. Open a book about OOP and C# and you will get everything you need.
Actually I was hoping to raise my accept-% with an easy question...
Answer by Graham-Dunnett · Nov 12, 2012 at 02:33 PM
Because you leave the compiler to work out what the type is, and you do not have to provide it in the source code.
See http://msdn.microsoft.com/en-us/library/512aeb7t.aspx for more details.
Graham, can you please answer the harder questions? http://answers.unity3d.com/questions/346881/how-does-unity-compilation-work.html