Hello all… im trying to access another scripts function “hit” when the OnMouseDown hits an object with the tag “Enemy”… here is my very sloppy script… Please tell me how i can fix this!!
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ScoreScript : MonoBehaviour {
public Text scoreText;
public GameObject enemy1;
private int score;
private EnemyScript enemyScript;
void Awake()
{
enemyScript = GetComponent<EnemyScript>();
}
void Start ()
{
score = 1;
}
void OnMouseDown ()
{
if (enemy1.tag == "Enemy")
{
enemy1.GetComponent<EnemyScript>().Hit;
}
}
}