Search Unity

DataBase?

Discussion in 'Scripting' started by Azux, Sep 24, 2018.

  1. Azux

    Azux

    Joined:
    Mar 3, 2015
    Posts:
    19
    Hi im in progress of my main manu where i want to be able to chose a character and level. The question is how can i make a list of heroes chose a one and instantinate him onto another scene. I do have a spawn point for a hero but i dont know how to save my id of character.
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Depends on your use. You can save it to a playerpref, you can set a static variable, you can save it to a file, you can save it to a player account online...

    Depends on your use case of how secure you need the data and if you need to back it up.
     
  3. Azux

    Azux

    Joined:
    Mar 3, 2015
    Posts:
    19
    I dont really have any idea how important is to secure a hero chose. The game is simple tower defense where You as a player can attack monster with one of few heroes. Before level chose you can take one of unlocked heroes so if i will make a list of heroes a need to spawn a chosed one but if somehow is possible to change an id of chosed hero then someone can change id to locked hero. So is important to do not allow that. Which one you advice in that case?
     
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Really, the decision is yours. If it's something you're still thinking on, just use a playerpref or a static variable for now. (Just make note to change it later if you need to) Playerprefs are easier to access, but there are also secure playerprefs.
     
  5. Azux

    Azux

    Joined:
    Mar 3, 2015
    Posts:
    19
    For now i just made an object with script which contains my data. Thanks.