Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

presisting the level grid #6

Open
sweetclimusic opened this issue Jan 30, 2017 · 0 comments
Open

presisting the level grid #6

sweetclimusic opened this issue Jan 30, 2017 · 0 comments

Comments

@sweetclimusic
Copy link

I just wanted to confim a theory or If my code is incorrect somewhere. I have notice that the level gird is reset and reinitiated when the level object loses focus. This means if I clicked in the console, then back to the level object and try to edit an existing painted prefab. There was previously a nullException but I have changed my code to handle a null cell. So am I correct that I need to save my grid in the OnDisable and on OnEnable reload my existing grid? If yes, and serialization is the correct apporach. How would I serialize my List object? I have add the [serialize] paramater heading to the levelPieces class. What I am unsure of is if I have to nest levelPieces to do serialization correctly?

What I mean is instead of serializing levelPieces. I would create a 2nd class that was serialized that only containes a list of levelPieces. (Would I mark the List propety object as a serialize field?). Then in the LevelInspector class create a List<2ndClass>() object that created instance of a levelPiece? Is this step needed?

Or did I miss something in the book and the level and all the data in the array is suppose to remain in memory when you click out of unity or deselect the Level object? If so which page and chapter is that so I can go back and check?

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant