Hey,
im trying to disable OnMouseDown only if the script that contains this function is disabled. But if it is not I want it to function.
But with the code I’m using below, mouse down isn’t working at all when I enable the script. HELP!!
Hi, try this:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class ExampleClass : MonoBehaviour
{
void OnMouseDown()
{
if(gameObject.GetComponent<Destroyer>().enabled == true)
Destroy(gameObject);
}
}