Example #1
0
        public void Restore(IRestoreData restoreData)
        {
            var data = restoreData as PostProcessingRestoreData;

            // Materials must be RestorableMaterial
            MaterialFactory factory = MaterialPool.Ensure(gameObject).factory;

            layers.Clear();
            foreach (var materialRestoreData in data.layersData)
            {
                var material = RestorableMaterial.RestoreMaterialFromData(materialRestoreData, factory);
                layers.Add(material);
            }
        }
        private void Awake()
        {
            renderer = GetComponent <Renderer>();
            if (renderer == null)
            {
                var textureChanger = GetComponent <GameOverlayTextureChanger>();
                if (textureChanger != null)
                {
                    renderer = textureChanger.actualImageObject.GetComponent <Renderer>();
                }
            }

            image = GetComponent <Image>();

            // Create MaterialPool to keep an instance of defaultMaterial
            MaterialPool.Ensure(gameObject);

            renderQueue = GetRenderQueue();
        }