cyhak
Full vMember
Posts: 80
|
Post by cyhak on Jul 19, 2018 8:51:21 GMT
Hello folks, i am trying to create a save load system but i think its i am not skilled enoguh With this code i get all the weapon ids that are quipped at the moment
foreach (var weapon in itemManager.items) {
Debug.Log (weapon.id);
}
when i add this into the loop:
Playerprefs.Getint("id",weapon); i can store it. But only the frist weapons id is saved. The rest is missing . I know that the foreach loop is not correct. But i dont know how to manage this How can i generate Playerprefs for each weapon id ?
My plan is to storte the ids in Player prefs and add the weapons via this code:
if (itemManager) {
var reference = new ItemReference (id);
reference.amount = 1;
reference.autoEquip = true;
itemManager.AddItem (reference);
But is i said i am a beginner and i am overwhelmed.
Thank you very much !!
|
|
|
Post by jrackley on Jul 19, 2018 13:02:13 GMT
not really sure how to do this in player prefs, haven't tried due to them not supporting list types. However I am using Save Game Pro right now for one of our games to save all inventory items as it is easy to work with and supports almost all types including custom. If you happen to get this asset then I can shoot you the script that works. Other than that there is @tharinu rpg pack addon that also has built in saving and works very well. Will look into it if I get some time today to try and help you out. If interested though here is the link for Save Game Pro www.assetstore.unity3d.com/en/#!/content/89198
|
|
cyhak
Full vMember
Posts: 80
|
Post by cyhak on Jul 19, 2018 14:08:34 GMT
thank you very much for replying. I tried with Tharindus rpg pack and it works but i have to try it if it also works on mobile devices.
|
|