Search Unity

Need help with json keybind saving.

Discussion in '2D' started by Nivbot, Oct 5, 2019.

  1. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    I've already asked this in Answers but no one has responded and I usually come here to post or answer things so I'm posting here too. I'm just trying to save keybinings to json file and allow the user to change and save them.

    It works totally fine in the editor but not when the game is built. Yes, I am using persistantDataPath. I'll post my scripts and maybe someone can see something I'm missing. I've been struggling with this since last night. I will say it does load the file just fine in the build, it just won't save changes like it does in the editor.

    here's the code:
    (Sorry for the commented out stuff. I've just been trying everything and leaving things there so I know I've tried them)

    Code (CSharp):
    1. using UnityEngine;
    2. using System.IO;
    3. using System.Text;
    4.  
    5. public class JsonFileUtility
    6. {
    7.     public static string LoadJsonFromFile(string path, bool isResource)
    8.     {
    9.         if (isResource)
    10.         {
    11.             return LoadJsonAsResource(path);
    12.         }
    13.         else
    14.         {
    15.             return LoadJsonAsExternalResource(path);
    16.         }
    17.     }
    18.  
    19.     public static string LoadJsonAsResource(string path)
    20.     {
    21.         string JsonFilePath = path.Replace(".json", "");
    22.         TextAsset loadedJsonFile = Resources.Load<TextAsset>(JsonFilePath);
    23.         return loadedJsonFile.text;
    24.     }
    25.  
    26.  
    27.     public static string LoadJsonAsExternalResource(string path)
    28.     {
    29.         path = Application.persistentDataPath + "/" + path;
    30.    
    31.         if (!File.Exists(path))
    32.         {
    33.             return string.Empty;
    34.         }
    35.  
    36.         StreamReader reader = new StreamReader(path);
    37.         string response = "";
    38.         while (!reader.EndOfStream)
    39.         {
    40.             response += reader.ReadLine();
    41.         }
    42.  
    43.         reader.Close();
    44.         return response;
    45.     }
    46.  
    47.  
    48.     public static void WriteJsontoExternalResource(string path, string content)
    49.     {
    50.         path = Application.persistentDataPath + "/" + path;
    51.      
    52.         //using (FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
    53.         //{
    54.            // byte[] contentBytes = new UTF8Encoding(true).GetBytes(content);
    55.             //stream.Write(contentBytes, 0, contentBytes.Length);
    56.         //}
    57.         //File.Delete(path);
    58.         if (!File.Exists(path))
    59.         {
    60.          FileStream stream = File.Create(path);
    61.            byte[] contentBytes = new UTF8Encoding(true).GetBytes(content);
    62.  
    63.           // **********  File.WriteAllBytes(path, contentBytes);
    64.            
    65.             stream.Write(contentBytes, 0, contentBytes.Length);
    66.             stream.Close();
    67.         }
    68.         else
    69.          {
    70.             File.Delete(path);
    71.             byte[] contentBytes = new UTF8Encoding(true).GetBytes(content);
    72.             FileStream stream = File.OpenWrite(path);
    73.             stream.Write(contentBytes, 0, contentBytes.Length);
    74.             stream.Close();
    75.          }
    76.     }
    77.  
    78. }
    79.  
    80. using System.Collections.Generic;
    81. using UnityEngine;
    82. using TMPro;
    83. using UnityEngine.UI;
    84. using System.Reflection;
    85. using System.IO;
    86.  
    87. public class PlayerKeys : MonoBehaviour
    88. {
    89.    // private Dictionary<string, KeyCode> tokens = new Dictionary<string, KeyCode>();
    90.     [HideInInspector]
    91.     public TextMeshProUGUI up, down, left, right, jump, attack1, attack2, cast1, cast2, cast3, block, toggle_run, health_pot, mana_pot, target, untarget, settings, inv, spellbook, journal;
    92.     [HideInInspector]
    93.     public GameObject currentKey;
    94.  
    95.     private Color normal = Color.black;
    96.     private Color selectedColor = Color.blue;
    97.     private KeyCode playerKeyCode;
    98.     private string EntryString;
    99.  
    100.     [System.Serializable]
    101.     public struct Token
    102.     {
    103.         public string varName;
    104.         public KeyCode keyCode;
    105.     }
    106.  
    107.     [System.Serializable]
    108.     public struct TokenCollection
    109.     {
    110.         public List<Token> tokens;
    111.     }
    112.  
    113.     public Dictionary<string, Token> tokens;
    114.  
    115.     private void Start() {
    116.  
    117.         up = GameObject.Find("bindings_up").GetComponent<TextMeshProUGUI>();
    118.         down = GameObject.Find("bindings_down").GetComponent<TextMeshProUGUI>();
    119.         left = GameObject.Find("bindings_left").GetComponent<TextMeshProUGUI>();
    120.         right = GameObject.Find("bindings_right").GetComponent<TextMeshProUGUI>();
    121.         jump = GameObject.Find("bindings_jump").GetComponent<TextMeshProUGUI>();
    122.         attack1 = GameObject.Find("bindings_attack1").GetComponent<TextMeshProUGUI>();
    123.         attack2 = GameObject.Find("bindings_attack2").GetComponent<TextMeshProUGUI>();
    124.         cast1 = GameObject.Find("bindings_cast1").GetComponent<TextMeshProUGUI>();
    125.         cast2 = GameObject.Find("bindings_cast2").GetComponent<TextMeshProUGUI>();
    126.         cast3 = GameObject.Find("bindings_cast3").GetComponent<TextMeshProUGUI>();
    127.         block = GameObject.Find("bindings_block").GetComponent<TextMeshProUGUI>();
    128.         toggle_run = GameObject.Find("bindings_run_toggle").GetComponent<TextMeshProUGUI>();
    129.         health_pot = GameObject.Find("bindings_health_pot").GetComponent<TextMeshProUGUI>();
    130.         mana_pot = GameObject.Find("bindings_mana_pot").GetComponent<TextMeshProUGUI>();
    131.         target = GameObject.Find("bindings_target").GetComponent<TextMeshProUGUI>();
    132.         untarget = GameObject.Find("bindings_untarget").GetComponent<TextMeshProUGUI>();
    133.         settings = GameObject.Find("bindings_settings").GetComponent<TextMeshProUGUI>();
    134.         inv = GameObject.Find("bindings_inventory").GetComponent<TextMeshProUGUI>();
    135.         spellbook = GameObject.Find("bindings_spellbook").GetComponent<TextMeshProUGUI>();
    136.         journal = GameObject.Find("bindings_journal").GetComponent<TextMeshProUGUI>();
    137.  
    138.  
    139.         tokens = new Dictionary<string, Token>();
    140.  
    141.         ManagerSupp.instance.playerKeys = this;
    142.  
    143.         LoadToken();
    144.  
    145.         List<string> tokenKeys = new List<string>(tokens.Keys);
    146.  
    147.         if (tokenKeys.Count > 0)
    148.         {
    149.             foreach (string key in tokenKeys)
    150.             {
    151.                 SetKeyBind(key);
    152.             }
    153.         }
    154.         else
    155.         {
    156.             tokens.Add("K_Up", new Token() { varName = "K_Up", keyCode = KeyCode.UpArrow }); //0 (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Down", KeyCode.DownArrow.ToString()))); //KeyCode.DownArrow);
    157.             tokens.Add("K_Down", new Token() { varName = "K_Down", keyCode = KeyCode.DownArrow }); //1 (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Down", KeyCode.DownArrow.ToString()))); //KeyCode.DownArrow);
    158.             tokens.Add("K_Left", new Token() { varName = "K_Left", keyCode = KeyCode.LeftArrow });   //2(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Left", KeyCode.LeftArrow.ToString()))); //KeyCode.LeftArrow);
    159.             tokens.Add("K_Right", new Token() { varName = "K_Right", keyCode = KeyCode.RightArrow }); //3(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Right", KeyCode.RightArrow.ToString()))); //KeyCode.RightArrow);
    160.             tokens.Add("K_Jump", new Token() { varName = "K_Jump", keyCode = KeyCode.Space });  //4 (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Jump", KeyCode.Space.ToString()))); //KeyCode.Space);
    161.             tokens.Add("K_Attack1", new Token() { varName = "K_Attack1", keyCode = KeyCode.F}); //5(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Attack1", KeyCode.F.ToString())));
    162.             tokens.Add("K_Attack2", new Token() { varName = "K_Attack2", keyCode = KeyCode.G }); //6(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Attack2", "G"))); //KeyCode.G);
    163.             tokens.Add("K_Cast1", new Token() { varName = "K_Cast1", keyCode = KeyCode.Alpha1 });  //7(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Cast1", KeyCode.Alpha1.ToString())));
    164.             tokens.Add("K_Cast2", new Token() { varName = "K_Cast2", keyCode = KeyCode.Alpha2 });  //8(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Cast2", KeyCode.Alpha2.ToString()))); //KeyCode.Alpha2);
    165.             tokens.Add("K_Cast3", new Token() { varName = "K_Cast3", keyCode = KeyCode.Alpha3 }); //9(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Cast3", KeyCode.Alpha3.ToString()))); //KeyCode.Alpha3);
    166.             tokens.Add("K_Block", new Token() { varName = "K_Block", keyCode = KeyCode.B });  //10(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Block", "V")));//KeyCode.V);
    167.             tokens.Add("K_ToggleRun", new Token() { varName = "K_ToggleRun", keyCode = KeyCode.R }); //11(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_ToggleRun", "R"))); //KeyCode.R);
    168.             tokens.Add("K_HealthPot", new Token() { varName = "K_HealthPot", keyCode = KeyCode.N });  //12(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_HealthPot", "N")));//KeyCode.N);
    169.             tokens.Add("K_ManaPot", new Token() { varName = "K_ManaPot", keyCode = KeyCode.M}); //13(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_ManaPot", "M"))); //KeyCode.M);
    170.             tokens.Add("K_Target", new Token() { varName = "K_Target", keyCode = KeyCode.T });  //14(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Target", "T"))); //KeyCode.T);
    171.             tokens.Add("K_Untarget", new Token() { varName = "K_Untarget", keyCode = KeyCode.U }); //15(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Untarget", "U"))); //KeyCode.U);
    172.             tokens.Add("K_Settings", new Token() { varName = "K_Settings", keyCode = KeyCode.O }); //16(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Settings", "H")));  //KeyCode.H);
    173.             tokens.Add("K_Inventory", new Token() { varName = "K_Inventory", keyCode = KeyCode.I });  //17(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Inventory", "I"))); //KeyCode.I);
    174.             tokens.Add("K_Spellbook", new Token() { varName = "K_Spellbook", keyCode = KeyCode.K}); //18(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Spellbook", "K"))); //KeyCode.K);
    175.             tokens.Add("K_Journal", new Token() { varName = "K_Journal", keyCode = KeyCode.J });   //19 (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("K_Journal", "J"))); //KeyCode.J);
    176.          
    177.             SaveKeys();
    178.  
    179.             SetKeyBind("K_Up");
    180.             SetKeyBind("K_Down");
    181.             SetKeyBind("K_Left");
    182.             SetKeyBind("K_Right");
    183.             SetKeyBind("K_Jump");
    184.             SetKeyBind("K_Attack1");
    185.             SetKeyBind("K_Attack2");
    186.             SetKeyBind("K_Cast1");
    187.             SetKeyBind("K_Cast2");
    188.             SetKeyBind("K_Cast3");
    189.             SetKeyBind("K_Block");
    190.             SetKeyBind("K_ToggleRun");
    191.             SetKeyBind("K_HealthPot");
    192.             SetKeyBind("K_ManaPot");
    193.             SetKeyBind("K_Target");
    194.             SetKeyBind("K_Untarget");
    195.             SetKeyBind("K_Settings");
    196.             SetKeyBind("K_Inventory");
    197.             SetKeyBind("K_Spellbook");
    198.             SetKeyBind("K_Journal");
    199.         }
    200.  
    201.         up.text = GetEntry("K_Up"); //keys["K_Up"].ToString();
    202.         down.text = GetEntry("K_Down"); //keys["K_Down"].ToString();
    203.         left.text = GetEntry("K_Left");  //keys["K_Left"].ToString();
    204.         right.text = GetEntry("K_Right"); //keys["K_Right"].ToString();
    205.         jump.text = GetEntry("K_Jump"); //keys["K_Jump"].ToString();
    206.         attack1.text = GetEntry("K_Attack1"); //keys["K_Attack1"].ToString();
    207.         attack2.text = GetEntry("K_Attack2"); //keys["K_Attack2"].ToString();
    208.         cast1.text = GetEntry("K_Cast1"); //keys["K_Cast1"].ToString();
    209.         cast2.text = GetEntry("K_Cast2"); //keys["K_Cast2"].ToString();
    210.         cast3.text = GetEntry("K_Cast3"); //keys["K_Cast3"].ToString();
    211.         block.text = GetEntry("K_Block"); //keys["K_Block"].ToString();
    212.         toggle_run.text = GetEntry("K_ToggleRun"); //keys["K_ToggleRun"].ToString();
    213.         health_pot.text = GetEntry("K_HealthPot"); //keys["K_HealthPot"].ToString();
    214.         mana_pot.text = GetEntry("K_ManaPot"); //keys["K_ManaPot"].ToString();
    215.         target.text = GetEntry("K_Target"); //keys["K_Target"].ToString();
    216.         untarget.text = GetEntry("K_Untarget");  //keys["K_Untarget"].ToString();
    217.         settings.text = GetEntry("K_Settings"); //keys["K_"].ToString();
    218.         inv.text = GetEntry("K_Inventory"); //  keys["K_Inventory"].ToString();
    219.         spellbook.text = GetEntry("K_Spellbook"); //keys["K_Spellbook"].ToString();
    220.         journal.text = GetEntry("K_Journal"); //keys["K_Journal"].ToString();
    221.     }
    222.  
    223.     private void OnGUI()
    224.     {
    225.        if(currentKey != null)
    226.         {
    227.             Event e = Event.current;
    228.             if (e.isKey)
    229.             {
    230.                 Token tmp = new Token() { varName = currentKey.name, keyCode = e.keyCode };
    231.                 tokens[currentKey.name] = tmp; //new Token() { varName = currentKey.name, keyCode =  e.keyCode };
    232.                 currentKey.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = GetEntry(currentKey.name); //e.keyCode.ToString();
    233.                 currentKey.GetComponent<Image>().color = normal;
    234.                 FieldInfo tmpKey = (FieldInfo)Manager.instance.playerContoller.GetType().GetField(currentKey.name);
    235.                 Component comp = Manager.instance.playerContoller;
    236.                 tmpKey.SetValue(comp, tokens[currentKey.name].keyCode);
    237.                 //SaveKey(currentKey.name);
    238.                 currentKey = null;
    239.             }
    240.         }
    241.     }
    242.  
    243.     private string GetEntry(string key)
    244.     {
    245.         EntryString = tokens[key].keyCode.ToString();
    246.  
    247.         for(int i = 0; i < 10; i++)
    248.         {
    249.             if(EntryString == "Alpha" + i.ToString())
    250.             {
    251.                 EntryString = i.ToString();
    252.             }
    253.         }
    254.  
    255.         return EntryString;
    256.     }
    257.  
    258.     public void ChangeKey(GameObject clicked)
    259.     {
    260.         if(currentKey != null)
    261.         {
    262.             currentKey.GetComponent<Image>().color = normal;
    263.         }
    264.         currentKey = clicked;
    265.         currentKey.GetComponent<Image>().color = selectedColor;
    266.     }
    267.  
    268.     public void SetKeyBind(string key)
    269.     {
    270.         FieldInfo tmpKey = (FieldInfo)Manager.instance.playerContoller.GetType().GetField(key);
    271.         Component comp = Manager.instance.playerContoller;
    272.         tmpKey.SetValue(comp, tokens[key].keyCode);
    273.     }
    274.  
    275.     public void ClosePlayerKeys()
    276.     {
    277.         SaveKeys();
    278.  
    279.         if (currentKey != null)
    280.         {
    281.             currentKey.GetComponent<Image>().color = normal;
    282.             currentKey = null;
    283.         }
    284.     }
    285.  
    286.     public void SaveKeys()
    287.     {
    288.         SaveToken();
    289.     }
    290.  
    291.    // public void SaveKey(string key)
    292.     //{
    293.        // PlayerPrefs.SetString(key, tokens[key].ToString());
    294.         //PlayerPrefs.Save();
    295.     //}
    296.  
    297.     public void LoadToken()
    298.     {
    299.         if (!File.Exists(Application.persistentDataPath + "/tokenCollection.json")) return;
    300.  
    301.         tokens.Clear();
    302.  
    303.         TokenCollection tmpCollection = JsonUtility.FromJson<TokenCollection>(JsonFileUtility.LoadJsonFromFile("tokenCollection.json", false));
    304.        // JsonUtility.FromJsonOverwrite(JsonFileUtility.LoadJsonFromFile("tokenCollection.json", false), tmpCollection);
    305.         foreach (Token tok in tmpCollection.tokens)
    306.                {
    307.                  tokens.Add(tok.varName, tok);
    308.                }
    309.     }
    310.  
    311.     public void SaveToken()
    312.     {
    313.         List<string> tokenKeys = new List<string>(tokens.Keys);
    314.         List<Token> toSaveCollection = new List<Token>();
    315.  
    316.         foreach (string key in tokenKeys)
    317.         {
    318.             toSaveCollection.Add(tokens[key]);
    319.         }
    320.         TokenCollection saveCollection = new TokenCollection() { tokens = toSaveCollection };
    321.         string jsonString = JsonUtility.ToJson(saveCollection);
    322.         JsonFileUtility.WriteJsontoExternalResource("tokenCollection.json", jsonString);
    323.     }
    324.  
    325. }
    326.  
    327.  
     
  2. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    i have used this for json:
    saveJson = JsonUtility.ToJson(gameSave);
    File.WriteAllText(Directory.GetCurrentDirectory() + "/save.txt", saveJson);

    saveJson = File.ReadAllText(Directory.GetCurrentDirectory() + "/save.txt");
    gameSave = JsonUtility.FromJson<GameSave>(saveJson);
     
    Last edited: Oct 5, 2019
    Nivbot likes this.
  3. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    doesn't hurt to try I guess.
     
  4. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    maybe this
    string patch = Directory.GetCurrentDirectory() + "/something.txt";
    sorry, I am just useless with C# InputOutput :)
     
    Nivbot likes this.
  5. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    Unfortunately, that's not even saving in the editor. Which really doesn't make sense. However, I can still save it as bytes[] into a text file. Using your way gives me a file with nothing but "{ }" I dunno. This is one of those frustrating situations we all get.
     
  6. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    did you replace the line: 322 JsonFileUtility.WriteJsontoExternalResource("tokenCollection.json", jsonString);
    with
    File.WriteAllText(Directory.GetCurrentDirectory() + "/save.txt", jsonString);
    the line should create txt file in the game folder
     
    Nivbot likes this.
  7. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    I honestly don't remember now, but I might be within a breakthrough. Building to test now.
     
  8. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    mmmmmmmm, nope. Guess not.
     
  9. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    oh, yes. I replaced all of the file strings.
     
  10. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    maybe you can try with dataPath
    https://docs.unity3d.com/ScriptReference/Application-dataPath.html
    and I hope someone other can help here :)

    I think, this is the half way. Nothing just means that the string was empty.

    And did you tried to build the game and start it from its folder and not over the button "Build and Play" ?
     
    Last edited: Oct 5, 2019
    Nivbot likes this.
  11. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    Yes, that's how I normally do it. I added a UI window to get some debug info. Since, I have since added a File.Delete before saving I know that it is actually saving the file with my method. But it is not saving the changed the keys in build mode. They get saved as the original. That sounds to me like there is some reason that the changes are taking effect in the editor but not in build. Like the variables are not being fully changed. I'm going to do a few tests and see what they tell me about why my KeyCode changes are only being saved in the inspector. It's a weird sort of bug that must be from something I have coded wrong that I can't figure out.
     
  12. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    I've narrowed it down to something. When I change a key bind in game the panel shows that the dictionary contains the updated key. When I close the settings window (which also saves) the key reverts back to the old one. So something is going on there.
     
  13. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    where are you calling the function public void ClosePlayerKeys() (try to Debug.Log("saved"); its execution)?
     
    Last edited: Oct 5, 2019
    Nivbot likes this.
  14. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    I'd have to search for where I'm calling it when I close the window. I likely put it in the close window button. But it's the same function that's called from the save button so it's nothing to do with the close button calling it.
    ie. it's doing nothing more than the save button in the keybings menu is doing.
     
  15. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    OK, looking at the json file. I can see that it is indeed saving the keycode when I click save, but reverts back to the original when I close the window. How in the world does that make any sense? It should be saving the exact same thing again...
     
  16. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    but you know what. If it saves them from the save button I'm fine with that.
     
  17. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    well, it's working now without the saving automatically, but it doesn't make sense to me. There's something somewhere that is causing it to do so, but there's no need for a save button if it's automatic or vice versa. Therefore, I will keep the save button and move on and hope it doesn't bite me in the deriere later.
     
  18. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    Thanks for tagging along with me and giving me the idea to look at the close button. Whatever the reason I'm putting it behind me and moving on unless it becomes an issue later.
     
    vakabaka likes this.
  19. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    Lol, I have no idea what is going on here, still it is good if it works in some way and you have found where to look later :rolleyes:
     
    Nivbot likes this.
  20. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    working beautifully now. I must say, I'm completely dumbfounded. It makes no sense to me, like I said many times already but now my blood pressure will go down and I can enjoy football tomorrow knowing it's working : )
     
  21. Nivbot

    Nivbot

    Joined:
    Mar 21, 2015
    Posts:
    65
    OMG Vakabaka! I just discovered what the issue was. When I first started making this I for some reason put a copy of the script on my player and forgot about it. This whole time the script was updating from the player and the UI window. When the UI window closed it overwrote what the player script had done with the default setting from the UI window script.... God I hate when I do stupid crap like that. Cheese and Rice. 2 days work for being a bonehead. I'm laughing outside but crying inside. o_O
     
    vakabaka likes this.
  22. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    You have made a problem and solved it by yourself. Well done :eek:
    Ah, something like this was happened to me too