|
Post by britannis on Apr 7, 2016 22:04:47 GMT
My problem is a bit complicated, but I will try to simplify it as much as I can. I made a level in a level editor: I saved the level as a prefab and moved it to my game scene: (I'm not sure why my tiles are tan in my level editor when the directional light in both scenes is the same color, but that's another matter.) Here's the issue: My level editor lerps the material colors from a foreground color to a background color, which is why the blocks in the level editor appear to have a gradient. However, when I save the level as a prefab and move it to my game scene, the blocks revert to their original material color (black) instead of preserving the lerped material color. Is there a way to preserve the lerped colors? One way I can think of is to scrap the level prefab and use a script to regenerate the level by feeding my level editor script certain values. However, this would require my level editor object (and script) to be present in my game scene so the level can be generated. How would you approach properly saving a level?
|
|
|
Post by Admin on Apr 8, 2016 14:18:20 GMT
I have seen that lighting issue before - even when reloading a scene. It has something to do with global illumination and auto-baking I believe.
If you save your level as a prefab, then you should expect it to instantiate the way it was when you created it. If I wanted to save a "state" for the level then I would do so as a separate data file. For example, you could create a data model that holds an array of the colors to apply to each block. The game should be responsible for saving this state data because it is a run-time issue not a design time issue. I have some posts on saving data on my blog which can help give you an idea of some possible approaches for this kind of task.
|
|