GetComponent confusion

Ever since they updated this part I get confused with this function. After trial and error this is the line that compiled correctly:

rb = GetComponent.();

I didn’t see anywhere online that there is supposed to be a dot between getcomponent and the <> thing. The manual seems to be completely outdated. Finding this out by trial and error is not fun. I’m just confused. Is this supposed to look like this?

edit: that’s javascript, by the way.

the dot is in js
no dot in cs

That’s odd. By my understanding the dot shouldn’t compile in any language.

GetComponent<Rigidbody>()
GetComponent(Rigidbody)

iono mang
It’s because generics
http://docs.unity3d.com/Manual/GenericFunctions.html
And dont forget, this ‘js’ isn’t javascript

It does, at least in UnityScript when you use the generic version. I find that pretty inconvenient though. Good that I’m only using C# :slight_smile:

its a weird syntax hack, since this isnt real JS. Since proper JS has no need for generics, but it is a need of untiyscript.

Thanks for clarifying, everyone. It’s still confusing, to be honest, but as long as it works I’m ok.