示例#1
0
        private static void Write(UnsafeWriter writer, AssetDocumentHierarchyElement value)
        {
            writer.Write(value.myOtherBoxedElements.Count);
            writer.Write(value.myGameObjectHierarchies.Count);
            writer.Write(value.myTransformElements.Count);
            writer.Write(value.myScriptComponentElements.Count);
            writer.Write(value.myComponentElements.Count);

            foreach (var v in value.myOtherBoxedElements)
            {
                WriteHierarchyElement(writer, v);
            }

            foreach (var v in value.myGameObjectHierarchies)
            {
                GameObjectHierarchy.Write(writer, v);
            }

            foreach (var v in value.myTransformElements)
            {
                TransformHierarchy.Write(writer, v);
            }

            foreach (var v in value.myScriptComponentElements)
            {
                ScriptComponentHierarchy.Write(writer, v);
            }

            foreach (var v in value.myComponentElements)
            {
                ComponentHierarchy.Write(writer, v);
            }
        }
示例#2
0
        private static void WriteHierarchyElement(UnsafeWriter writer, IHierarchyElement hierarchyElement)
        {
            switch (hierarchyElement)
            {
            case GameObjectHierarchy gameObjectHierarchy:
                writer.Write(0);
                GameObjectHierarchy.Write(writer, gameObjectHierarchy);
                break;

            case ComponentHierarchy componentHierarchy:
                writer.Write(1);
                ComponentHierarchy.Write(writer, componentHierarchy);
                break;

            case PrefabInstanceHierarchy prefabInstanceHierarchy:
                writer.Write(2);
                PrefabInstanceHierarchy.Write(writer, prefabInstanceHierarchy);
                break;

            case ScriptComponentHierarchy scriptComponentHierarchy:
                writer.Write(3);
                ScriptComponentHierarchy.Write(writer, scriptComponentHierarchy);
                break;

            case StrippedHierarchyElement strippedHierarchyElement:
                writer.Write(4);
                StrippedHierarchyElement.Write(writer, strippedHierarchyElement);
                break;

            case TransformHierarchy transformHierarchy:
                writer.Write(5);
                TransformHierarchy.Write(writer, transformHierarchy);

                break;
            }
        }