Search Unity

Saved Variable, how to manage it?

Discussion in 'Visual Scripting' started by unity_-fu_9nA3E-Z1ZA, Aug 24, 2022.

  1. unity_-fu_9nA3E-Z1ZA

    unity_-fu_9nA3E-Z1ZA

    Joined:
    Jul 13, 2019
    Posts:
    24
    Hi dears, I'm new to the Unity forum!
    I want to ask about the saved variables used by Visual Scripting, and I want to know where they are really saved: I read that these are saved directly in the playerprefs but when I call the "DeleteAll" function they are not really deleted. I opened the registry and calling the specific function this deletes the "ludiqSavedVariable" file but the data related to the saved variable remain.
    I noticed that the saved variables are reset by manually deleting the "Unity_player_session" files in the same root as the playerprefs.
    How can these variables be handled correctly?
     
    Canley likes this.
  2. Canley

    Canley

    Joined:
    Jun 17, 2022
    Posts:
    37
    Will follow this with interest :)
     
  3. unity_-fu_9nA3E-Z1ZA

    unity_-fu_9nA3E-Z1ZA

    Joined:
    Jul 13, 2019
    Posts:
    24
    no one have the right sol...XD
     
  4. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    398
    Code (CSharp):
    1. // Should show current saved data
    2. Debug.Log(PlayerPrefs.GetString("LudiqSavedVariables"));
    3.  
    4. // Set data to none and save
    5. PlayerPrefs.SetString("LudiqSavedVariables", "");
    6. PlayerPrefs.Save();
    7.  
    8. // Should show current saved data as none
    9. Debug.Log(PlayerPrefs.GetString("LudiqSavedVariables"));
    10.  
     
  5. Hudecek

    Hudecek

    Joined:
    Apr 9, 2018
    Posts:
    2

    This thing just broke my project:



    ArgumentNullException: Value cannot be null.
    Parameter name: source
    System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) (at <aaefe8c59ae740868836d2ee0aa0340a>:0)
    Unity.VisualScripting.SavedVariables.MergeInitialAndSavedDeclarations () (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Variables/SavedVariables.cs:135)
    Unity.VisualScripting.SavedVariables.OnEnterPlayMode () (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Variables/SavedVariables.cs:54)
    Unity.VisualScripting.RuntimeVSUsageUtility.RuntimeInitializeOnLoadBeforeSceneLoad () (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Utilities/RuntimeVSUsageUtility.cs:18)
     
  6. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,079
    Hudecek likes this.
  7. Hudecek

    Hudecek

    Joined:
    Apr 9, 2018
    Posts:
    2
    For future victims: It said the registry cannot be null so I just edited the registry and added number 10. It's not null now so the project runs seemingly smoothly. I'll watch for future troubles this may bring.
     
  8. S2NX7

    S2NX7

    Joined:
    Aug 17, 2021
    Posts:
    40
    yea i am also working on a node to clear a single variable and i might add it like in the current state it works you just dont see it visually until you end the game and start it again since it clears all variables and Re adds them excluding the set variable so i just want to fix that