0

For my game in Unity 2017.2, I am trying to save the prefabs that I just bought in the games store (not IAP) and load them to a garage type scene.

I was first thinking I could get the name of the prefab and save the name to an array or list and save it and encrypt it if possible (haven't seen a saving asset for arrays).

Then I can check the array and find the game objects/prefabs by name and spawn them in the scenes that I choose. And also be able to load a specific name from the array and just use that prefab to spawn.

How would I go by doing this? Please any help? I am able to save strings and other variables by using the Asset SecurePlayerPrefs but does not support arrays/list.

WokerHead
  • 947
  • 2
  • 15
  • 46
  • Huh what? You want to get *prefabs that you bought* (on the asset store?) into a scene? (Not sure the dupe target is appropriate). I don't understand what your goal is. – Draco18s no longer trusts SE Mar 07 '18 at 00:13
  • Just prefabs that I dragged into my scene, letting the user either buy or sell, buying it should save it somewhere to be able to fetch all the objects that the user bought. To be able to spawn the bought objects – WokerHead Mar 07 '18 at 00:15
  • 1
    Do not save prefabs. Just save the name of the prefabs in an array then use their names to load them later on. Imagine having 15 prefabs in your Resources older then having about 100 instance of them then saving each one? That's not the way to do this. – Programmer Mar 07 '18 at 00:15
  • @Programmer yes that's what I want to do. How would I save this string array? – WokerHead Mar 07 '18 at 00:17
  • 1
    Put it in a class then serialize and save it. See the duplicate. It has a wrapper and example on how to use that. – Programmer Mar 07 '18 at 00:18
  • @Programmer thank you! Lets see if I can get this to save – WokerHead Mar 07 '18 at 00:22
  • Go ahead. If you can't, you can always edit your question and the code that's not saving. – Programmer Mar 07 '18 at 00:26

0 Answers0