Hi, I have Unity Pro and I have created a game. I have downloaded a character from the asset store and I wanted to make a script for him, so he just follows the first person controller and will kill him if he gets to close. I am fairly new to scripting so yeah. Please help, thanks.
As @whydoidoit stated, this is for more specified question…however i know that the question you are looking for has been answered more than completely time and time again. I suggest doing some searching… heres something to get you started
public var player:Transform;
private var dist:Vector3;
function Start()
{
dist=(player.position-transform.position).magnitude;
}
function Update ()
{
if (dist < 10)
{
//attack enemy
}
}
Something that I found a while ago and has helped me with a lot of my other work.
I hope this helps.