A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections.Generic;
3#if UNITY_EDITOR
4using UnityEditor;
5#endif
6using UnityEngine;
7
8[ExecuteInEditMode]
9public class AlignSceneView : MonoBehaviour
10{
11
12 // Start is called before the first frame update
13 void Awake()
14 {
15 AlignCamera(transform);
16 }
17
18
19 private static void AlignCamera(Transform target)
20 {
21#if UNITY_EDITOR
22 SceneView view = SceneView.lastActiveSceneView;
23 if (view == null) return;
24 Camera sceneCam = view.camera;
25 if(sceneCam == null) return;
26 sceneCam.transform.position = target.position;
27 sceneCam.transform.rotation = target.rotation;
28 view.AlignViewToObject(sceneCam.transform);
29#endif
30 }
31
32}
33
34
35