Compile Error + GetComponent + boolean + parent and child object compination

Hello,

I have a parrent object with some children attached. It’s possible to shoot the children objects and the parent object handle the look of the children if one of them get hit. For that, each children has his own OnTriggerEnter script attached. After they got hit, they set the boolean of the main script of the parrent object to “true”. The children activate the boolean of the main object with the GetComponent function.

When I try to compile my project I got a compile error.

Thats the error:
Assets/Resources/Prefabs/Enemy/Enemy_Bottom_Left.js(30,69): BCE0019: ‘CHILD_OBJECT_Bottom_Left’ is not a member of ‘UnityEngine.Component’.

It’s a bit strange because in the preview window everything runs fine. The child successful activate the boolean of the parent object in the main script.

The part of the script from the child object:

var PARENT_OBJECT : GameObject; // define the parent object

function OnTriggerEnter (other : Collider)
{

	if (other.CompareTag ("Shoot")) // if children get hit by the shoot object
	{
	
	var hit = PARENT_OBJECT; // store the parent object in "hit"
	hit.GetComponent("PARENT_OBJECT_MAIN_SCRIPT").CHILD_OBJECT_Bottom_Left = true;  //set the boolaen "CHILD_OBJECT_Bottom_Left " of the PARENT_OBJECT to true

	}

}

Can anyone help me out?

Best regards

maglat

Where does PARENT_OBJECT come from? is it assigned via the inspector?
I don’t understand what this line is supposed to be doing.

var hit = PARENT_OBJECT;

Yes it is assigned via the inspector.

and later I store the parten object in var hit = PARENT_OBJECT;

maybe split it up so you can see what the problem is

var theScript : PARENT_OBJECT_MAIN_SCRIPT = hit.GetComponent(PARENT_OBJECT_MAIN_SCRIPT);
theScript.CHILD_OBJECT_Bottom_Left = true;

and try -

PARENT_OBJECT.GetComponent(PARENT_OBJECT_MAIN_SCRIPT);