I want to click on a UI button to enable a script on some cloned prefabs
I drag the script on the button and activate via event triggers but only the debug message shows. When the script is on the prefabs and I use OnStart then it enables. Here is my script: This is my script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class EndTurns : MonoBehaviour {
public void SwitchOnRed()
{
Debug.Log("Clicked");
GetComponent<InputManager_Red>().enabled = true;
}
//public void SwitchOnGreen()
// { // Debug.Log("Clicked"); //GetComponent().enabled = false; //GetComponent().enabled = false; // } }
Your answer

Follow this Question
Related Questions
How can i change a state when a button is pressed? 1 Answer
My lights don't work with On Click() when I click the button. 1 Answer
Following an old touch tutorial, having errors with deprecated code 1 Answer
Im trying to make gameObject move only if specific button is pressed 1 Answer
How to wait for a button response 0 Answers