File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Assets/SharedAssets/Benchmark Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 66using UnityEngine . Playables ;
77using UnityEngine . SceneManagement ;
88using UnityEngine . Serialization ;
9+ using UnityEngine . Timeline ;
910using UnityEngine . UIElements ;
1011
1112namespace Benchmarking
@@ -266,6 +267,18 @@ IEnumerator LoadAndInit()
266267 _playableDirector = directors . First ( d => ( d . gameObject . name == "CinematicTimeline" ) || d . gameObject . CompareTag ( "BenchmarkTimeline" ) ) ;
267268 else if ( directors . Length > 0 )
268269 _playableDirector = directors [ 0 ] ;
270+
271+ if ( directors . Length <= 0 )
272+ {
273+ // create dummy PlayableAsset with benchmarkDuration
274+ var timelineAsset = ScriptableObject . CreateInstance < TimelineAsset > ( ) ;
275+ var track = timelineAsset . CreateTrack < ControlTrack > ( null , "Control Track" ) ;
276+ var clip = track . CreateDefaultClip ( ) ;
277+ clip . duration = 30 ;
278+
279+ _playableDirector = new GameObject ( "CinematicTimeline" ) . AddComponent < PlayableDirector > ( ) ;
280+ _playableDirector . playableAsset = timelineAsset ;
281+ }
269282
270283 if ( _playableDirector != null )
271284 {
You can’t perform that action at this time.
0 commit comments