I'm trying to make a game object flee away. How can i create a fleeing AI?
The simplest method would be to compute the 'flee direction' as follows:
// Assumes object positions are not coincident or nearly coincident:
Vector3 fleeDirection = transform.position - objectToFleeFrom.transform.position;
fleeDirection.Normalize();
And then use the computed direction vector to move the object using whatever method is appropriate (e.g. apply a force for a rigid body, incorporate into the movement vector for a character controller, etc.).