Author Topic: Directly editing player save file results in old version being loaded...  (Read 3380 times)

acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
If I directly edit a playersave file on the tnet server hosted online (through ftp for example).... When I run my game, rather than the edited file being read, tnet reads the old version of the file....

Why is this?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Directly editing player save file results in old version being loaded...
« Reply #1 on: January 02, 2018, 10:40:57 PM »
I'm not able to replicate this.
  1. using UnityEngine;
  2. using TNet;
  3.  
  4. public class EditPlayerSaveTest : TNBehaviour
  5. {
  6.     private void OnEnable()
  7.     {
  8.         TNManager.onSetPlayerData += OnSetPlayerData;
  9.         transform.name = TNManager.player.Get<string>("Name", "<null>");
  10.     }
  11.  
  12.     private void OnDisable()
  13.     {
  14.         TNManager.onSetPlayerData -= OnSetPlayerData;
  15.     }
  16.  
  17.     private void Update()
  18.     {
  19.         if (Input.GetKeyDown(KeyCode.S))
  20.         {
  21.             TNManager.SetPlayerData("Name", "testing");
  22.         }
  23.     }
  24.  
  25.     void OnSetPlayerData(Player p, string path, DataNode node)
  26.     {
  27.         Debug.Log(name + " Saw OnSetPlayerData");
  28.         if (p != TNManager.player) return;
  29.         transform.name = p.Get<string>("Name", "<null>");
  30.     }
  31. }
  32.  
In TNManager's OnConnect callback I do as the tutorial specifies: TNManager.SetPlayerSave(SystemInfo.deviceUniqueIdentifier + "/Player.dat", DataNode.SaveType.Text);
If I load up the file and manually change name to 'nottesting' and run the game again it'll have the name 'nottesting' as expected. Pressing 'S' then changes it to 'testing'.

acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: Directly editing player save file results in old version being loaded...
« Reply #2 on: January 04, 2018, 09:35:44 AM »
Sorry, I was referring to editing the player data file through an ftp software (like filezilla).

I managed to find a work around however..... I decided to use "TNManager.SetPlayerData" in a part of my code that I would just use during development, then remove it when building...

Thanks for the response...


cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Directly editing player save file results in old version being loaded...
« Reply #3 on: January 04, 2018, 08:45:49 PM »
Sorry I wasn't clear. That's exactly what I did when testing and I wasn't able to reproduce your problem.