How to attach text to moving prefab so that both move together?

Hi, I am new to Unity and got started with a space shooter 2d tutorial on YouTube. I wanted to modify it so that a text is displayed on each enemy. How can I do this?

Try childing a the text canvas to your enemy prefab :slight_smile:

You could also write a short script like

public class Example : Monobehavior {

public Transform target; 
//Or
public GameObject target;

void Update () {
     transform.position = (target.transform.position + offset);
     public Vector2 offset = new Vector2 (example x, example y)
     }
}

Where either target would be the enemy prefab. I don’t know if transform.position works for text though. If it does it will probably have to be set to world space in the inspector^^