Page 1 of 1

Save Choose character and name on a slot list

Posted: Sat Mar 11, 2017 1:02 pm
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.

Re: Save Choose character and name on a slot list

Posted: Sat Mar 11, 2017 2:17 pm
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

Re: Save Choose character and name on a slot list

Posted: Sun Mar 12, 2017 7:52 pm
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

Re: Save Choose character and name on a slot list

Posted: Sun Mar 12, 2017 8:11 pm
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

Re: Save Choose character and name on a slot list

Posted: Sun Mar 12, 2017 8:18 pm
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);
      }


}

Re: Save Choose character and name on a slot list

Posted: Sun Mar 12, 2017 8:48 pm
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