- Home /
(C#) Follow target (script) transform target PREFAB
Hi everyone! I want to use the script "follow target" with a prefab but I don't arrive to select my prefab. Why?
The script:
using System; using UnityEngine;
namespace UnityStandardAssets.Utility { public class FollowTarget : MonoBehaviour { public Transform target; public Vector3 offset = new Vector3(0f, 7.5f, 0f);
private void LateUpdate()
{
transform.position = target.position + offset;
}
}
}
follow-target.png
(273.3 kB)
prefab.png
(117.8 kB)
Comment
Your answer
Follow this Question
Related Questions
Find transform.position of Another Game Object 1 Answer
How to Make the SmoothFollow Script Follow Faster? 1 Answer
Camera focusing on an object specified in a script 1 Answer
Move camera when mouse is near the edges of the screen 1 Answer
Set Position and Rotation with another GameObject as Pivot (Script) 0 Answers