- Home /
Question by
AngryCSharpNerd · Sep 25, 2012 at 12:55 AM ·
javascriptgetcomponentfind
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! :/
I don't understand.
Comment
Answer by justinl · Sep 28, 2012 at 07:11 AM
maybe your Controller object doesn't have the _HealthGui script attached to it. Or the _HealthGui variable "health" doesn't exist or is private.