Search Unity

How to save data of monster to my playermonsterList ?

Discussion in 'Scripting' started by MrSretthaNayak, Oct 20, 2019.

  1. MrSretthaNayak

    MrSretthaNayak

    Joined:
    Oct 15, 2019
    Posts:
    9
    I need to make Jrpg tamer game that you can be friend with wildmonster but I have no idea how to save data
    of monster like prefap and level of this monster I being friend with them
    my script of PlayerpartyList is
    Code (CSharp):
    1. public List<BaseMonster>  PlayerpartyList = new List<BaseMonster>();
    I need to save the monster name status and level but right now I dont have any
    idea to do this at all.
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    You need to start a bit smaller: find out how you save data in general (look at PlayerPrefs). Then move on to how to save data in a more general way. After that, investigate how to save lists of objects. You may also want to look up the subject of 'serialization'. Unless you are asking ow to create a prefab - that you'll find in Unity's Manual, which I'm sure you already looked into.

    Once you have put together a script that you feel should work, but doesn't, you can the post that script here, and ask specific questions, and you'll get specific answers. Right now, your question is too vague, and I'm not sure anyone fully understands what your Monstar is, how it's become your friend and why that would involve a PlayerpartyList. Usually, many of the real Problems resolve themselves when you take the time to describe them to other people :)
     
  3. MrSretthaNayak

    MrSretthaNayak

    Joined:
    Oct 15, 2019
    Posts:
    9
    Ty, PlayerpartyList is my list to contain the game object in monster list and monster list is list to contain monster script, monster script I made enum name type stats for them and I think I understand about PlayerPrefs and I dont need to save them and make the file contain them, I mean I just wanna add them to list.
     
  4. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Hmm.

    Code (CSharp):
    1. BaseMonster theMonster = ... // get the mosnter somehow
    2. PlayerPartyList.Add(theMonster)
    Something like this? This may also help.
     
    MrSretthaNayak likes this.