fork download
  1. using UnityEngine;
  2.  
  3. public class LookAtTarget : MonoBehaviour {
  4.  
  5. public Transform Target;
  6.  
  7. void Start () {
  8.  
  9. }
  10.  
  11. void Update () {
  12. var targetPos = new Vector3(4.0f * Mathf.Sin(Time.frameCount / 50.0f),
  13. 4.0f,
  14. 4.0f * Mathf.Cos(Time.frameCount / 50.0f));
  15. Target.position = targetPos;
  16.  
  17. var dir = transform.position - Target.position;
  18. var yUp = Quaternion.AngleAxis(90.0f, Vector3.right);
  19. var rot = Quaternion.LookRotation(dir);
  20.  
  21. transform.rotation = rot * yUp;
  22. }
  23. }
  24.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(3,29): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(5,9): error CS0246: The type or namespace name `Transform' could not be found. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty