Hello, I have a score manager script that is attached to my score text in my hierarchy.
In my first scene the score works fine by killing enemies. how to i send the score from the first scene to the second scene to continue to increase my score. i tried DontDestroyOnLoad but didn’t work. How do i use it to update my score.
here is my score script.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ScoreManager : MonoBehaviour
{
public static int score;
Text text;
void Awake ()
{
text = GetComponent <Text> ();
score = 0;
}
void Update ()
{
text.text = "Score: " + score;
}
}
Making it static should make it persist through scenes. PlayerPrefs is a usual method but it is insecure.
– meat5000how do i add PlayerPrefs method to the script? Can you assist me with some bonding. Thanks
– felsy@meat5000 sir why PlayerPrefs is insecure. i use it all the time ? :|
– 0mr_ashutosh0When i add the deletekey it's giving me an error
– ahileasan_24where did you add the deletekey
– felsy