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 6
6
using UnityEngine . Playables ;
7
7
using UnityEngine . SceneManagement ;
8
8
using UnityEngine . Serialization ;
9
+ using UnityEngine . Timeline ;
9
10
using UnityEngine . UIElements ;
10
11
11
12
namespace Benchmarking
@@ -266,6 +267,18 @@ IEnumerator LoadAndInit()
266
267
_playableDirector = directors . First ( d => ( d . gameObject . name == "CinematicTimeline" ) || d . gameObject . CompareTag ( "BenchmarkTimeline" ) ) ;
267
268
else if ( directors . Length > 0 )
268
269
_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
+ }
269
282
270
283
if ( _playableDirector != null )
271
284
{
You can’t perform that action at this time.
0 commit comments