- Home /
AI Enemies?
im looking for information on how to create a simple enemy. nothing special, just one that follows you and kills you on contact. iv'e been having trouble finding a good tutorial, and some of the ones on unity didn't help. if you know, or know a good tutorial please inform me.
I like the ones from 3D Platform Tutorial (the Lerpz one) and First Person Shooter Tutorial. Both are in stores as example projects.
Answer by iwaldrop · Feb 10, 2013 at 07:13 AM
A super simple script would look like:
Transform player;
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player").transform;
}
void Update()
{
transform.LookAt(player);
transform.Translate(Vector3.forward);
}
it doesnt work, it keeps bothering me to put a semicolon at the end, i keep trying to fix but it wont go away
Well, you'd have to put it in a class that inherits from monobehaviour. Create a new c# script in Unity and paste this in to it. I took it for granted that you'd already have one.
wow this is a late reply ;_; but i see why it wasnt working now ^^
Your answer
![](https://koobas.hobune.stream/wayback/20220613092433im_/https://answers.unity.com/themes/thub/images/avi.jpg)