GetComponent: Easy help

this is javascript

if(GameObject.Find(“Controller”).GetComponent(“_HealthGui”).health <4){

“‘health’ is not a valid member of ‘UnityEngine.Component’. (BCE0019)”

…Why? All I’m trying to do is get a variable from a separate object from the Hiearchy! :confused:

I don’t understand.

maybe your Controller object doesn’t have the _HealthGui script attached to it. Or the _HealthGui variable “health” doesn’t exist or is private.