public static UnitySceneData Build(IUnityYamlFile file) { Assertion.Assert(file.IsValid(), "file.IsValid()"); Assertion.Assert(file.GetSolution().Locks.IsReadAccessAllowed(), "ReadLock is required"); var interruptChecker = new SeldomInterruptChecker(); var unityPropertyValueCacheItem = new OneToListMap <MonoBehaviourProperty, MonoBehaviourPropertyValue>(); var sceneHierarchy = new SceneHierarchy(); var anchorToEventHandler = new OneToSetMap <string, string>(); var scriptMapping = new OneToSetMap <string, string>(); var eventHandlerToScriptTarget = new OneToSetMap <string, FileID>(); foreach (var document in file.DocumentsEnumerable) { interruptChecker.CheckForInterrupt(); var buffer = document.GetTextAsBuffer(); if (ourPrefabModificationSearcher.Find(buffer, 0, Math.Min(buffer.Length, 100)) > 0) { sceneHierarchy.AddPrefabModification(buffer); } else { var simpleValues = new Dictionary <string, string>(); var referenceValues = new Dictionary <string, FileID>(); UnitySceneDataUtil.ExtractSimpleAndReferenceValues(buffer, simpleValues, referenceValues, eventHandlerToScriptTarget); FillProperties(simpleValues, referenceValues, unityPropertyValueCacheItem); FillScriptMapping(simpleValues, referenceValues, scriptMapping); sceneHierarchy.AddSceneHierarchyElement(simpleValues, referenceValues); } } if (unityPropertyValueCacheItem.Count == 0 && sceneHierarchy.Elements.Count == 0) { return(null); } return(new UnitySceneData(unityPropertyValueCacheItem, eventHandlerToScriptTarget, scriptMapping, sceneHierarchy)); }