CameraFollowSetup.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. ------------------- Code Monkey -------------------
  3. Thank you for downloading the Code Monkey Utilities
  4. I hope you find them useful in your projects
  5. If you have any questions use the contact form
  6. Cheers!
  7. unitycodemonkey.com
  8. --------------------------------------------------
  9. */
  10. using System.Collections.Generic;
  11. using UnityEngine;
  12. namespace CodeMonkey.MonoBehaviours {
  13. /*
  14. * Easy set up for CameraFollow, it will follow the transform with zoom
  15. * */
  16. public class CameraFollowSetup : MonoBehaviour {
  17. [SerializeField] private CameraFollow cameraFollow = null;
  18. [SerializeField] private Transform followTransform = null;
  19. [SerializeField] private float zoom = 50f;
  20. private void Start() {
  21. if (followTransform == null) {
  22. Debug.LogError("followTransform is null! Intended?");
  23. cameraFollow.Setup(() => Vector3.zero, () => zoom, true, true);
  24. } else {
  25. cameraFollow.Setup(() => followTransform.position, () => zoom, true, true);
  26. }
  27. }
  28. }
  29. }