save one big json string vs multi seperate json strings in playerprefs
Suppose we want to make an RTS game. The user has several soldier cards like clash royale. The soldiers have many attributes. (attack point,health,attack ration etc in one class Soldier serialized) Is it better to save all cards of a user (one array objects converted to string json) in playerprefs or save cards one by one (not array). when we change one special soldier card (upgrade this card),if we use one array of objects(array of soldier classes), then we need to save the array completely Playerprefs.Setstring("soldierArray",json_soldierArray);
but if we use multi objects saving into playerprefs seperately we only need to save the special soldier(that was upgraded) but we need to have many string json for each of them(100 soldier cards need 100 string json) Playerprefs.Setstring("soldier1",json_soldier1); Playerprefs.Setstring("soldier2",json_soldier2); ... Playerprefs.Setstring("soldier100",json_soldier100);
which is better and known(common strategy) in performance and speed.
The wording on this question is extremely confusing, I can't tell what you're asking here. Are you trying to set the stats for individual soldiers? Or all soldiers of a specific type?
Thank you.yes suppose you have only one class soldier and an array of soldier objects. you sometimes need to change only one element of the array and sometimes several elements of it. $$anonymous$$y question is not how to change the array. $$anonymous$$y queation is how to save them in playerprefs (individually or not one array) Suppose I need to change only one soldier stats when it is upgraded but I sometimes need to change some soldier stats. let I explain. Like clash royale game, when you upgrade one soldier so you need to change the soldier stats and save them into playerprefs (I know it has an online server it is only an example) but you sometimes need to change some soldiers stats for example when chests become open and you get several soldiers upgrade cards for example for giant,Goblins,Barbarian. I must implement playerprefs.setstring for each soldier individually or use array of them and every time update this array and send to playerprefs completely
Your answer
Follow this Question
Related Questions
How to prevent to save or send a big json string? 0 Answers
Can't save serialized data (loading work) in Playerprefs for WebGL Build. 0 Answers
How do I recover my project? 0 Answers
How to read specific line with Streamreader in c#? 1 Answer
JSON to Object error Object reference not set to an instance of an object 1 Answer