Exemple #1
0
 public Prefab(AssetInfo assetInfo) :
     base(assetInfo)
 {
     Modification   = new PrefabModification(AssetsFile);
     ParentPrefab   = new PPtr <Prefab>(AssetsFile);
     RootGameObject = new PPtr <GameObject>(AssetsFile);
     ThisPrefab     = new InnerPPtr <Prefab>(this);
 }
Exemple #2
0
        public Prefab(GameObject root) :
            base(CreateAssetsInfo(root))
        {
            Modification    = new PrefabModification(AssetsFile);
            ParentPrefab    = new PPtr <Prefab>(AssetsFile);
            RootGameObject  = new PPtr <GameObject>(root);
            ThisPrefab      = new InnerPPtr <Prefab>(this);
            IsPrefabParent  = true;
            ObjectHideFlags = 1;

            if (Config.IsGenerateGUIDByContent)
            {
                CalculatePrefabHash();
            }
        }
Exemple #3
0
        public static void GenerateTypeTree(TypeTreeContext context, string name)
        {
            string className = GetPrefabInstanceName(context.Version);

            context.AddNode(className, name, 0, ToSerializedVersion(context.Version));
            context.BeginChildren();
            if (IsModificationsFormat(context.Version))
            {
                Object.GenerateTypeTree(context);

                bool hasRootGameObject     = IsRootGameObjectRelevant(context.Flags);
                bool isRootGameObjectFirst = IsRootGameObjectFirst(context.Version);
                if (hasRootGameObject && isRootGameObjectFirst)
                {
                    context.AddPPtr(nameof(GameObject), RootGameObjectName);
                }

                PrefabModification.GenerateTypeTree(context, ModificationName);
                context.AddPPtr(className, GetSourcePrefabName(context.Version));
                if (hasRootGameObject && !isRootGameObjectFirst)
                {
                    context.AddPPtr(nameof(GameObject), RootGameObjectName);
                }
                if (IsPrefabAssetRelevant(context.Version))
                {
                    context.AddBool(GetIsPrefabAssetName(context.Version));
                }
                if (IsExplodedRelevant(context.Version))
                {
                    context.AddBool(IsExplodedName);
                }
                context.Align();
            }
            else
            {
                GUID.GenerateTypeTree(context, LastMergeIdentifierName);
                if (HasLastTemplateIdentifier(context.Version))
                {
                    GUID.GenerateTypeTree(context, LastTemplateIdentifierName);
                }
                context.AddArray(ObjectsName, PPtr <EditorExtension> .GenerateTypeTree);
                context.AddPPtr(className, FatherName);
                context.AddBool(IsDataTemplateName, TransferMetaFlags.AlignBytesFlag);
                NamedObject.GenerateTypeTree(context);
            }
            context.EndChildren();
        }
Exemple #4
0
 public PrefabInstance(AssetLayout layout) :
     base(layout)
 {
     Objects      = Array.Empty <PPtr <EditorExtension> >();
     Modification = new PrefabModification(layout);
 }
Exemple #5
0
 public PrefabInstance(Version version) :
     base(version)
 {
     Objects      = Array.Empty <PPtr <EditorExtension> >();
     Modification = new PrefabModification(version);
 }