public void OnProcessScene(Scene scene, BuildReport report) { var timelines = UnityEngine.Object.FindObjectsOfType <PlayableDirector>().Select(pd => pd.playableAsset).OfType <TimelineAsset>().Distinct(); foreach (var timeline in timelines) { if (_timelineSceneInfo.uniqueDirectors.Add(timeline)) { _timelineSceneInfo.numTracks += timeline.flattenedTracks.Count(); _timelineSceneInfo.minDuration = Math.Min(_timelineSceneInfo.minDuration, (int)(timeline.duration * 1000)); _timelineSceneInfo.maxDuration = Math.Max(_timelineSceneInfo.maxDuration, (int)(timeline.duration * 1000)); _timelineSceneInfo.minNumTracks = Math.Min(_timelineSceneInfo.minNumTracks, timeline.flattenedTracks.Count()); _timelineSceneInfo.maxNumTracks = Math.Max(_timelineSceneInfo.maxNumTracks, timeline.flattenedTracks.Count()); foreach (var track in timeline.flattenedTracks) { string key = track.GetType().Name; if (_timelineSceneInfo.trackCount.ContainsKey(key)) { _timelineSceneInfo.trackCount[key]++; } else { if (TimelineEventInfo.IsUserType(track.GetType())) { _timelineSceneInfo.trackCount["UserType"]++; if (_timelineSceneInfo.userTrackTypesCount.ContainsKey(key)) { _timelineSceneInfo.userTrackTypesCount[key]++; } else { _timelineSceneInfo.userTrackTypesCount[key] = 1; } } else { _timelineSceneInfo.trackCount["Other"]++; } } if (track.clips.Any(x => x.recordable)) { _timelineSceneInfo.numRecorded++; } else { var animationTrack = track as AnimationTrack; if (animationTrack != null) { if (animationTrack.CanConvertToClipMode()) { _timelineSceneInfo.numRecorded++; } } } } } } }
public void OnPostprocessBuild(BuildReport report) { if (_timelineSceneInfo.uniqueDirectors.Count > 0) { var timelineEvent = new TimelineEventInfo(_timelineSceneInfo); EditorAnalytics.SendEventTimelineInfo(timelineEvent); } }
public void OnPostprocessBuild(BuildTarget target, string path) { if (TimelineAnalytics._timelineSceneInfo.uniqueDirectors.Count > 0) { TimelineEventInfo timelineEventInfo = new TimelineEventInfo(TimelineAnalytics._timelineSceneInfo); EditorAnalytics.SendEventTimelineInfo(timelineEventInfo); } }
public void OnProcessScene(Scene scene) { IEnumerable <TimelineAsset> enumerable = (from pd in Object.FindObjectsOfType <PlayableDirector>() select pd.get_playableAsset()).OfType <TimelineAsset>().Distinct <TimelineAsset>(); foreach (TimelineAsset current in enumerable) { if (TimelineAnalytics._timelineSceneInfo.uniqueDirectors.Add(current)) { TimelineAnalytics._timelineSceneInfo.numTracks += current.flattenedTracks.Count <TrackAsset>(); TimelineAnalytics._timelineSceneInfo.minDuration = Math.Min(TimelineAnalytics._timelineSceneInfo.minDuration, (int)(current.get_duration() * 1000.0)); TimelineAnalytics._timelineSceneInfo.maxDuration = Math.Max(TimelineAnalytics._timelineSceneInfo.maxDuration, (int)(current.get_duration() * 1000.0)); TimelineAnalytics._timelineSceneInfo.minNumTracks = Math.Min(TimelineAnalytics._timelineSceneInfo.minNumTracks, current.flattenedTracks.Count <TrackAsset>()); TimelineAnalytics._timelineSceneInfo.maxNumTracks = Math.Max(TimelineAnalytics._timelineSceneInfo.maxNumTracks, current.flattenedTracks.Count <TrackAsset>()); foreach (TrackAsset current2 in current.flattenedTracks) { string name = current2.GetType().Name; if (TimelineAnalytics._timelineSceneInfo.trackCount.ContainsKey(name)) { Dictionary <string, int> dictionary; string key; (dictionary = TimelineAnalytics._timelineSceneInfo.trackCount)[key = name] = dictionary[key] + 1; } else if (TimelineEventInfo.IsUserType(current2.GetType())) { Dictionary <string, int> dictionary; (dictionary = TimelineAnalytics._timelineSceneInfo.trackCount)["UserType"] = dictionary["UserType"] + 1; if (TimelineAnalytics._timelineSceneInfo.userTrackTypesCount.ContainsKey(name)) { string key2; (dictionary = TimelineAnalytics._timelineSceneInfo.userTrackTypesCount)[key2 = name] = dictionary[key2] + 1; } else { TimelineAnalytics._timelineSceneInfo.userTrackTypesCount[name] = 1; } } else { Dictionary <string, int> dictionary; (dictionary = TimelineAnalytics._timelineSceneInfo.trackCount)["Other"] = dictionary["Other"] + 1; } if (current2.clips.Any((TimelineClip x) => x.recordable)) { TimelineAnalytics._timelineSceneInfo.numRecorded++; } else { AnimationTrack animationTrack = current2 as AnimationTrack; if (animationTrack != null) { if (animationTrack.CanConvertToClipMode()) { TimelineAnalytics._timelineSceneInfo.numRecorded++; } } } } } } }