GetComponent Help.

Hello, I’m having a problem with my “getcomponent” and I’m unsure what to do. Here is where it is giving me the error.
This is from java script it is trying to get a class out of a c# script.

var _NetworkRigidbody : NetworkRigidbody = GetComponent(“NetworkRigidbody”);

and this is the error its giving me.

Assets/NetworkFiles/Plugins/RigidAssign.js(14,27): BCE0018: The name ‘NetworkRigidbody’ does not denote a valid type (‘not found’). Did you mean ‘UnityEngine.NetworkReachability’?

Thanks if you help me.

If you have the C# script compiled earlier, then you can use

var _NetworkRigidbody = GetComponent(NetworkRigidbody);

If it’s not possible to have the C# script compiled earlier, then you have to do

var _NetworkRigidbody = GetComponent("NetworkRigidbody");

Using strings returns Component instead of the type, but that relies on dynamic typing, so _NetworkRigidbody becomes Object instead of NetworkRigidbody, which won’t work in a non-#pragma strict environment.