Horje
how do you make a 2D object follow another 2D object in unity 2D Code Example
how do you make a 2D object follow another 2D object in unity 2D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FishFollow : MonoBehaviour
{
    public float Speed =;

    private Transform target;


    void Start() 
    {
        target = GameObject.FindGameObjectWithTag("Player").GetCOmponent<transform>();
    }

    void Update()
    {

        transform.position = Vector2.MoveTowards(transform.position, target.position, Speed * Time.deltaTime);
    }
}




Csharp

Related
vb.net add row to datagridview programmatically Code Example vb.net add row to datagridview programmatically Code Example
c# debug writeline Code Example c# debug writeline Code Example
unity c# change animation Code Example unity c# change animation Code Example
string to camel case c# Code Example string to camel case c# Code Example
detect keypress c# Code Example detect keypress c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9