How can i disable a script with other script with a collider detector?

I use this but its says that its no the method for this context

void OnTriggerEnter ( Collider other )
{
   GameObject.Find("cadena").GetComponent<PlayerMovement>.enabled=false;
}

2 Answers

2

Hello @hoenheim03,

When using GetComponent (which is a function) you need to have the “()” after the type of component you are trying to retrieve:

GameObject.Find("cadena").GetComponent<PlayerMovement>().enabled = false;

Thanks now i have other problem XD

Don't hesitate to make new posts to share your bugs if you get stuck :)