I need some help with onTriggerEnter, I want to be able to have attack the enemy (with Input.GetMouseButtonDown(0) and also need to have to have a collision with the ShortSword game object, but it is not working! I want my enemy to loose health if he gets touched by the ShortSword and mousebutton is down. Also I am working in 2D. thx for the help :slight_smile:

using UnityEngine;
using System.Collections;

public class Enemy : MonoBehaviour {
	public float Health = 100;
	public GameObject ShortSword;
	// Use this for initialization
	void Start () {

	// Update is called once per frame
	void Update () {
		if(Input.GetMouseButtonDown(0) && OnTriggerEnter(ShortSword))
			Health=Health - 10;

Since your working in 2D, your gonna want to use the function OnTriggerEnter2D.
Here it is in the Unity Scripting Reference.

And this tutorial may help you gain understand on how you use the OnTrigger functions.

Hope this helps. :smiley: