![]() You'll need to write a script that maintains a list of objects that have been newly instantiated in the scene. When the player drops an item into the scene, add it to the list. When the player picks up an item, remove it from the list. You'll probably want to keep track of the type of item, its world position, and (if it's a weapon or clip) how much ammo it contains. Then add two methods to this script: OnRecordPersistentData() and OnApplyPersistentData(). This will turn the script into a Persistent Data Component. In OnRecordPersistentData(), record the list into the Dialogue System's Lua environment. One way to do this is to use Unity's JsonUtility class to convert your list into a string. Then use DialogueLua.SetVariable() to record the string into the Lua environment. Since the Lua environment is included in saved game data, this will save your list.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |