@@ -14,7 +14,7 @@ public class CameraDirector : MonoBehaviour
14
14
/// Collection to add this camera to on awake
15
15
/// </summary>
16
16
[ SerializeField ]
17
- CameraCollection collection = null ;
17
+ private CameraCollection collection ;
18
18
19
19
/// <summary>
20
20
/// Unity events that recieve CameraDirector as an argument
@@ -25,12 +25,8 @@ public class CameraDirectorEvent : UnityEvent<CameraDirector>
25
25
}
26
26
27
27
[ SerializeField ]
28
- private CameraType cameraType = null ;
29
-
30
- public CameraType CameraType
31
- {
32
- get { return cameraType ; }
33
- }
28
+ private CameraType cameraType ;
29
+ public CameraType CameraType => cameraType ;
34
30
35
31
[ SerializeField ]
36
32
UnityEngine . Camera _camera ;
@@ -48,10 +44,16 @@ public UnityEngine.Camera Camera
48
44
}
49
45
}
50
46
51
- public bool canOverwriteExistingCamera = true ;
47
+ [ SerializeField ]
48
+ private bool canOverwriteExistingCamera = true ;
49
+ public bool CanOverwriteExistingCamera
50
+ {
51
+ get => canOverwriteExistingCamera ;
52
+ set => canOverwriteExistingCamera = value ;
53
+ }
52
54
53
- public CameraDirectorEvent OnDirectorEnabled = new CameraDirectorEvent ( ) ;
54
- public CameraDirectorEvent OnDirectorDisabled = new CameraDirectorEvent ( ) ;
55
+ public CameraDirectorEvent OnDirectorEnabled { get ; } = new CameraDirectorEvent ( ) ;
56
+ public CameraDirectorEvent OnDirectorDisabled { get ; } = new CameraDirectorEvent ( ) ;
55
57
56
58
protected virtual void Awake ( )
57
59
{
@@ -75,8 +77,12 @@ protected virtual void OnDisable()
75
77
76
78
protected virtual void OnDestroy ( )
77
79
{
78
- CameraDirector val = null ;
79
- if ( collection != null && collection . Items . TryGetValue ( CameraType , out val ) )
80
+ if ( collection == null )
81
+ {
82
+ return ;
83
+ }
84
+
85
+ if ( collection . Items . TryGetValue ( CameraType , out var val ) )
80
86
{
81
87
if ( val == this )
82
88
{
0 commit comments