File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
Input/Scripts/Utilities/Managers Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,16 @@ private void Start()
6666 return ;
6767 }
6868
69- teleportMarker = Instantiate ( TeleportMarker ) ;
70- teleportMarker . SetActive ( false ) ;
71-
72- animationController = teleportMarker . GetComponentInChildren < Animator > ( ) ;
73- if ( animationController != null )
69+ if ( TeleportMarker != null )
7470 {
75- animationController . StopPlayback ( ) ;
71+ teleportMarker = Instantiate ( TeleportMarker ) ;
72+ teleportMarker . SetActive ( false ) ;
73+
74+ animationController = teleportMarker . GetComponentInChildren < Animator > ( ) ;
75+ if ( animationController != null )
76+ {
77+ animationController . StopPlayback ( ) ;
78+ }
7679 }
7780 }
7881
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ namespace HoloToolkit.Unity
99{
1010 public class FadeScript : SingleInstance < FadeScript >
1111 {
12+ [ Tooltip ( "If true, the FadeScript will update the shared material. Useful for fading multiple cameras that each render different layers." ) ]
13+ public bool FadeSharedMaterial = false ;
1214 Material fadeMaterial ;
1315 Color fadeColor = Color . black ;
1416
@@ -46,7 +48,14 @@ void Start()
4648#endif
4749
4850 currentState = FadeState . idle ;
49- fadeMaterial = GetComponentInChildren < MeshRenderer > ( ) . material ;
51+ if ( FadeSharedMaterial )
52+ {
53+ fadeMaterial = GetComponentInChildren < MeshRenderer > ( ) . sharedMaterial ;
54+ }
55+ else
56+ {
57+ fadeMaterial = GetComponentInChildren < MeshRenderer > ( ) . material ;
58+ }
5059 }
5160
5261 void Update ( )
@@ -90,7 +99,7 @@ void CalculateFade()
9099
91100 protected override void OnDestroy ( )
92101 {
93- if ( fadeMaterial != null )
102+ if ( fadeMaterial != null && ! FadeSharedMaterial )
94103 {
95104 Destroy ( fadeMaterial ) ;
96105 }
You can’t perform that action at this time.
0 commit comments