Save Choose character and name on a slot list

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
21be
Posts: 3
Joined: Sat Mar 11, 2017 1:01 am

Save Choose character and name on a slot list

Post by 21be »

Hello i have buyed Easy Save yestersday and i have a little problem.

"Choose character" is my 4 scene i woulde save the prefab of the character who is selectet and the name when i pressed my select button an go back to my 3 scene "Character selection" here is a list and i would save here the character would i choose from scene 4 with some informations LvL character class and when i select the save slot and press play the character must loade in my gameworld


http://imgur.com/a/WZ9ZH

here example similar to this here https://www.youtube.com/watch?v=DXPXVtdC9MQ from 0 to 30 sec.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Choose character and name on a slot list

Post by Joel »

Hi there,

Unfortunately I'm not allowed to help with specific implementations. However, I discuss a way of doing save slots in this thread, and someone has kindly put their implementation of save slots.

Do be aware that this is only included as an example to give you an idea of how to incorporate save slots into your project, and you would need to write your own implementation.

You can also find many guides on the basic usage of Easy Save, including code examples in our Guide section.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
21be
Posts: 3
Joined: Sat Mar 11, 2017 1:01 am

Re: Save Choose character and name on a slot list

Post by 21be »

this help me not realy
How can I start with a simple step to save a player name who is typein a input field
Last edited by 21be on Sun Mar 12, 2017 8:17 pm, edited 2 times in total.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Choose character and name on a slot list

Post by Joel »

Hi there,

An example of a script which would save and load the value of an input field might look like this:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class SaveInputField : MonoBehaviour
{
    // Assign your InputField to this in the Editor.
    public InputField inputField;
   // This uniquely identifies this input field.
   public string tag;

    // Save the input field before this script is destroyed.
    public void OnDestroy()
    {
        ES2.Save(inputField, tag);
    }

    // Load the input field's value when the scene loads.
    public void Start()
    {
         // If there's data to load, load it.
         if(ES2.Exists(tag))
             inputField.text = ES2.Load<string>(tag);
    }
}
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
21be
Posts: 3
Joined: Sat Mar 11, 2017 1:01 am

Re: Save Choose character and name on a slot list

Post by 21be »

sry you are two fast :D

i have start with this but i do not know if it brings something

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChooseCharacterSave : MonoBehaviour
{
        
    public string player;
    public Text userNameInput;
    public string playerName = "player.txt";



    public void selectButton()
    {
        player = userNameInput.ToString();
       
    }

      public void StartLoading()
      {
        playerName = ES2.Load<string>("file.txt?tag=player.txt");
      }

      public void OnSave()
      {
        ES2.Save(player, playerName);
      }


}
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save Choose character and name on a slot list

Post by Joel »

I've made a few modifications to your script and left comments describing what I've changed and why.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChooseCharacterSave : MonoBehaviour
{
        
    public string player;
    public Text userNameInput;
    public string playerName = "player.txt";



    public void selectButton()
    {
        player = userNameInput.ToString();
       
    }

      public void StartLoading()
      {
        // Use the playerName as the filename, and then the 
        playerName = ES2.Load<string>(playerName + "?tag=player");
      }

      public void OnSave()
      {
        // Use the exact same filename and tag as we use when we load.
        ES2.Save(player, playerName + "?tag=player");
      }


}
It's almost 9pm on a Sunday here so my next response won't be quite so quick, but I'll reply to any queries you have first thing in the morning :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked