public void ProcessSceneHierarchyFromComponentToRoot(IYamlDocument startComponent, IUnityCachedSceneProcessorConsumer consumer) { myShellLocks.AssertReadAccessAllowed(); var sourceFile = startComponent.GetSourceFile(); var anchor = UnitySceneDataUtil.GetAnchorFromBuffer(startComponent.GetTextAsBuffer()); if (sourceFile == null || anchor == null) { return; } ProcessSceneHierarchyFromComponentToRoot(sourceFile, new FileID(null, anchor), consumer); }
public static bool CanContainReference([NotNull] IYamlDocument document) { // This document can only contain a reference if it represents a MonoBehaviour (which includes compiled // MonoBehaviours such as Button) and if it has the `m_MethodName` property. So, check the text of the // closed chameleon for "!u!114" and "m_MethodName". // TODO: Can we improve this? // When the chameleon is closed, GetTextAsBuffer returns a ProjectedBuffer over the source file element. // When open, it's a bit more expensive, by creating a StringBuffer over the result of GetText, which is // calculated by pre-initialising a StringBuilder to the correct length and calling GetText(StringBuilder) // on the child nodes. // Then we search the buffer, potentially twice. We'll limit the tag searcher to the first 100 characters of // the buffer var buffer = document.GetTextAsBuffer(); return(CanContainReference(buffer)); }
public static bool CanContainReference([NotNull] IYamlDocument document) { var buffer = document.GetTextAsBuffer(); return(CanContainReference(buffer)); }