Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

make an enemy go towards player unity

float speed = whatever;
Vector2 positionToMoveTo = (whatever, whatever);

void Update()
{
  transform.position = Vector2.MoveTowards(transform.position, positionToMoveTo, speed * Time.deltaTime);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: initialise icollection c# 
Csharp :: c# get last character of string 
Csharp :: unity change text color 
Csharp :: c# wait seconds 
Csharp :: format phone number in c# .net 
Csharp :: c# datetime current 
Csharp :: convert int to double c# 
Csharp :: unity instantiate empty gameobject 
Csharp :: c# cast string to double 
Csharp :: unity c# get bool from another script 
Csharp :: c# remove non-alphanumeric characters from string 
Csharp :: c# reverse list 
Csharp :: unity copy to clipboard 
Csharp :: c# insert into database 
Csharp :: unity detect number key 
Csharp :: swagger authentication bearer .net core 
Csharp :: raycast unity 
Csharp :: c# counting lines 
Csharp :: month number to text in c# 
Csharp :: unity convert mouse position to world position in editor mode 
Csharp :: iterate through dictionary c# 
Csharp :: c# array last element 
Csharp :: jitter on collision for 2 rigid bodies 
Csharp :: unity3d quaternion add 90 degrees 
Csharp :: how to open any file on button click in winforms 
Csharp :: xamarin overlay 
Csharp :: generate a random number in c# 
Csharp :: how to convert a number to 2 decimal places in c# 
Csharp :: object list to csv c# 
Csharp :: unity c# check if multiple keys are pressed 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =