Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Can't add a script because it doesn't "exist"

$
0
0
"Can't add component ".." because it doesn't exist." the code of the script: using UnityEngine; using System.Collections; public class EnemyAI : MonoBehaviour { public Transform Target; private GameObject Enemy; private GameObject Player; private float Range; public float Speed; // Use this for initialization void Start () { Enemy = GameObject.FindGameObjectWithTag ("Enemy"); Player = GameObject.FindGameObjectWithTag ("Player"); } // Update is called once per frame void Update () { Range = Vector2.Distance (Enemy.transform.position, Player.transform.position); if (Range <= 15f) { transform.Translate(Vector2.MoveTowards (Enemy.transform.position, Player.transform.position, Range) * Speed * Time.deltaTime); } } } Image link: http://gyazo.com/6db3e63313271ff46b98de57db3299eb

Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>