using UnityEngine;
using System.Collections;
public class hitBySpell : MonoBehaviour {
public float Health = 100;
public GameObject Target;
// Use this for initialization
void Start () {
Target = GameObject.FindWithTag ("Player");
}
// Update is called once per frame
void Update () {
transform.LookAt (Target.transform); // It happends right here
if(Health <= 0){
Destroy (gameObject);
}
}
void OnTriggerEnter2D (Collider2D hit)
{
if (hit.gameObject.tag == "damageFireball") {
Health -= 50;
Debug.Log(Health);
}
}
}
Why is that when i include this code " transform.LookAt (Target.transform) ", then this problem (See attached file).
But as soon i remove the code, i dont get the problem