Activating another script by clicking a button?

I want to be able to activate another script by pressing a button when i get close to the object. I use to know how to do it but, now I can’t remember =/ anyways the way I had it set up before is…

Get close to the object GUI appears with instructions
Press the key in the instructions and, another script activates

Forgot to mention C# please :slight_smile:

I’m messing around and, am trying to get back in the “swing of things”

In the same scene, you can create an empty gameobject with your script as a component.

The only thing you have to do is to deactivate the gameobject (or the script) at the start of the scene, and reactivate it when the button is pressed.

This script should be placed on a gameobject with a trigger collider. Code is called when your object get close to this one.

void OnTriggerEnter()
	{
		if(Input.GetKeyUp(KeyCode.A))
		{
			gameObject*.GetComponent<Yourscript**>().enable();
		}
	}

*Replace gameObject with a reference to where the other component resides
** Replaced Yourscript with name of script you want to activate