public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);
            var meshFilter = component as MeshFilter;

            meshFilter.mesh = mesh?.Instantiate();
        }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var light = component as Light;

            light.type      = type;
            light.range     = range;
            light.spotAngle = spotAngle;

            light.color           = color;
            light.intensity       = intensity;
            light.bounceIntensity = bounceIntensity;

            light.shadows          = shadows;
            light.shadowStrength   = shadowStrength;
            light.shadowResolution = shadowResolution;
            light.shadowBias       = shadowBias;
            light.shadowNormalBias = shadowNormalBias;
            light.shadowNearPlane  = shadowNearPlane;

            light.cookie      = cookie?.Value.Instantiate();
            light.cookieSize  = cookieSize;
            light.renderMode  = renderMode;
            light.cullingMask = cullingMask;
        }
 public void InstantiateRootGameObjects(Transform parent, RestorePostProcess postProcess)
 {
     foreach (var ser in rootGameObjects)
     {
         var obj = ser.Instantiate(postProcess);
         obj.transform.SetParent(parent, false);
     }
 }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var raycaster = component as GraphicRaycaster;

            raycaster.blockingObjects = blockingObjects;
        }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var graphic = component as MaskableGraphic;

            graphic.maskable = maskable;
        }
Exemple #6
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var renderer = component as MeshRenderer;

            renderer.additionalVertexStreams = additionalVertexStreams?.Instantiate();
        }
Exemple #7
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);
            var t = component as Transform;

            t.localPosition = localPosition;
            t.localRotation = localRotation;
            t.localScale    = localScale;
        }
Exemple #8
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var shadow = component as Shadow;

            shadow.effectColor     = effectColor;
            shadow.effectDistance  = effectDistance;
            shadow.useGraphicAlpha = useGraphicAlpha;
        }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var graphic = component as Graphic;

            graphic.raycastTarget = raycastTarget;
            graphic.material      = material?.Instantiate();
            graphic.color         = color;
        }
        public GameObject Instantiate(RestorePostProcess postProcess)
        {
            var obj = new GameObject(name)
            {
                isStatic = isStatic
            };

            // 参照を復元するために元の InstanceID を保持させる
            var id = obj.AddComponent <Identifier>();

            id.gameObjectInstanceID = instanceID;

            obj.SetActive(active);

            foreach (var componentUnion in components)
            {
                var c = componentUnion.Value;
                var t = c.GetOriginalType();
                if (t != null)
                {
                    Component component;
                    if (t == typeof(Transform))
                    {
                        component = obj.transform;
                    }
                    else
                    {
                        component = obj.AddComponent(t);
                        if (component == null)
                        {
                            var debug = obj.AddComponent <DebugComponent>();
                            debug.componentType = t.FullName;
                        }
                    }

                    if (component != null)
                    {
                        c.Restore(component, postProcess);
                    }
                }
                else
                {
                    Debug.LogWarning($"Could not instantiate type for {c.GetType().FullName}");
                }
            }

            foreach (var c in transformChildren)
            {
                var child = c.Instantiate(postProcess);
                child.transform.SetParent(obj.transform, false);
            }

            return(obj);
        }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var renderer = component as CanvasRenderer;

            renderer.cull              = cull;
            renderer.popMaterialCount  = popMaterialCount;
            renderer.materialCount     = materialCount;
            renderer.hasPopInstruction = hasPopInstruction;
        }
Exemple #12
0
 public void Restore(RestorePostProcess postProcess, Action <Transform[]> callback)
 {
     postProcess.Register(root =>
     {
         var identifiers = root.GetComponentsInChildren <Identifier>();
         var transforms  = gameObjectInstanceIDs
                           .Select(gameObjectInstanceID => identifiers.FirstOrDefault(id => id.gameObjectInstanceID == gameObjectInstanceID))
                           .Select(obj => obj.transform)
                           .ToArray();
         callback(transforms);
     });
 }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var renderer = component as SkinnedMeshRenderer;

            renderer.quality                               = quality;
            renderer.updateWhenOffscreen                   = updateWhenOffscreen;
            renderer.sharedMesh                            = sharedMesh?.Instantiate();
            renderer.skinnedMotionVectors                  = skinnedMotionVectors;
            renderer.localBounds                           = localBounds;
            bones?.Restore(post, t => renderer.bones       = t);
            rootBone?.Restore(post, t => renderer.rootBone = t);
        }
Exemple #14
0
 public void Restore(RestorePostProcess postProcess, Action <T> callback)
 {
     postProcess.Register(root =>
     {
         var referenceObject = root.GetComponentsInChildren <Identifier>().FirstOrDefault(id => id.gameObjectInstanceID == gameObjectInstanceID);
         if (referenceObject != null)
         {
             callback(referenceObject.GetComponent <T>());
         }
         else
         {
             Debug.LogWarning($"Reference Not Found: {typeof(T).FullName} ({gameObjectInstanceID})");
         }
     });
 }
Exemple #15
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var scaler = component as CanvasScaler;

            scaler.uiScaleMode            = uiScaleMode;
            scaler.referenceResolution    = referenceResolution;
            scaler.screenMatchMode        = screenMatchMode;
            scaler.matchWidthOrHeight     = matchWidthOrHeight;
            scaler.defaultSpriteDPI       = defaultSpriteDPI;
            scaler.fallbackScreenDPI      = fallbackScreenDPI;
            scaler.referencePixelsPerUnit = referencePixelsPerUnit;
            scaler.dynamicPixelsPerUnit   = dynamicPixelsPerUnit;
            scaler.physicalUnit           = physicalUnit;
            scaler.scaleFactor            = scaleFactor;
        }
Exemple #16
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var canvas = component as Canvas;

            canvas.sortingLayerName         = sortingLayerName;
            canvas.additionalShaderChannels = additionalShaderChannels;
            canvas.sortingLayerID           = sortingLayerID;
            canvas.targetDisplay            = targetDisplay;
            canvas.sortingOrder             = sortingOrder;
            canvas.overrideSorting          = overrideSorting;
            canvas.planeDistance            = planeDistance;
            canvas.overridePixelPerfect     = overridePixelPerfect;
            canvas.referencePixelsPerUnit   = referencePixelsPerUnit;
            canvas.scaleFactor = scaleFactor;
            worldCamera?.Restore(post, camera => canvas.worldCamera = camera);
            canvas.renderMode   = renderMode;
            canvas.pixelPerfect = pixelPerfect;
        }
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var text = component as Text;

            text.alignment            = alignment;
            text.alignByGeometry      = alignByGeometry;
            text.fontSize             = fontSize;
            text.horizontalOverflow   = horizontalOverflow;
            text.verticalOverflow     = verticalOverflow;
            text.lineSpacing          = lineSpacing;
            text.resizeTextMaxSize    = resizeTextMaxSize;
            text.fontStyle            = fontStyle;
            text.resizeTextMinSize    = resizeTextMinSize;
            text.supportRichText      = supportRichText;
            text.resizeTextForBestFit = resizeTextForBestFit;
            text.font = font?.Instantiate();
            text.text = this.text;
        }
Exemple #18
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);
            var renderer = component as Renderer;

            renderer.sortingLayerName            = sortingLayerName;
            renderer.sortingLayerID              = sortingLayerID;
            renderer.sortingOrder                = sortingOrder;
            renderer.lightmapIndex               = lightmapIndex;
            renderer.realtimeLightmapIndex       = realtimeLightmapIndex;
            renderer.lightmapScaleOffset         = lightmapScaleOffset;
            renderer.realtimeLightmapScaleOffset = realtimeLightmapScaleOffset;
            renderer.reflectionProbeUsage        = reflectionProbeUsage;
            renderer.lightProbeUsage             = lightProbeUsage;
            renderer.enabled = enabled;

            renderer.materials                  = materials?.Select(m => m.Instantiate()).ToArray();
            renderer.shadowCastingMode          = shadowCastingMode;
            renderer.receiveShadows             = receiveShadows;
            renderer.motionVectorGenerationMode = motionVectorGenerationMode;
        }
Exemple #19
0
        public override void Restore(Component component, RestorePostProcess post)
        {
            base.Restore(component, post);

            var camera = component as Camera;

            camera.clearFlags          = clearFlags;
            camera.backgroundColor     = backgroundColor;
            camera.cullingMask         = cullingMask;
            camera.eventMask           = eventMask;
            camera.layerCullSpherical  = layerCullSpherical;
            camera.cameraType          = cameraType;
            camera.useOcclusionCulling = useOcclusionCulling;
            camera.projectionMatrix    = projectionMatrix;
            camera.fieldOfView         = fieldOfView;
            camera.depthTextureMode    = depthTextureMode;
            camera.targetDisplay       = targetDisplay;
            camera.rect          = rect;
            camera.nearClipPlane = nearClipPlane;
            camera.farClipPlane  = farClipPlane;
            camera.depth         = depth;
        }
 public virtual void Restore(Component component, RestorePostProcess post)
 {
     base.Restore(component, post);
     component.tag = tag;
 }
Exemple #21
0
 public override void Restore(Component component, RestorePostProcess post)
 {
     base.Restore(component, post);
 }
Exemple #22
0
 public virtual void Restore(Object obj, RestorePostProcess post)
 {
     obj.name      = name;
     obj.hideFlags = hideFlags;
 }