BCE0019: Component is not a member of 'UnityEngine.Component' - Android Build

After browsing the other threads regarding this error, I didn’t see anything that seemed to indicate a solution to my issue :frowning:

I’m attempting to call function from another script, but keep getting the BCE0019 error, most likely due to the lack of dynamic typing on android. Here’s the code:

gameObject.Find(“GameController”).GetComponent(GameController).Respawn();

I have several instances where I’m calling functions within other scripts, and these seem to be the only errors i’m having, so It’d be great to get this sorted out!

You hit the nail right on the head. GetComponent() returns a Component, not an instance of GameController, and Component doesn’t have a definition for Respawn(). There is a new way and an old way of getting the object cast to GameController and I’m going to give you the new version.

 //js
 GetComponent.<GameController>().Respawn();

Generics are a new feature in unityscript and they work just like the C# ones except that you add a period after “GetComponent” that isn’t there in C#.