You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
426 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class LookAtCamera : MonoBehaviour {
  5. // Update is called once per frame
  6. void Update () {
  7. if (Camera.main != null)
  8. {
  9. transform.rotation = Quaternion.LookRotation(transform.position - Camera.main.transform.position);
  10. }
  11. else
  12. {
  13. Debug.Log("Cannot find Camera");
  14. }
  15. }
  16. }