Question by
leonelosuna80 · Aug 03, 2020 at 07:27 AM ·
ui2d gametextplayerprefsunityads
saving a text into a player pref
hello everyone. i am having a issue saving a text into a player pref. i am making a character selection, i am using Unity ads, when an ad finish, the user will obtain a point and i want that these points get save in a player pref, but it doesn't save the text.
in one script i have
private int stressedPoint;
public Text texto;
void Start()
{
PlayerPrefs.GetInt("points").ToString();
}
void points()
{
Points.scoreValue += 1;
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
switch (showResult)
{
case ShowResult.Failed:
break;
case ShowResult.Finished:
if (placementId == rewardedVideoAd)
{
points();
PlayerPrefs.SetInt("points", stressedPoint);
}
break;
}
}
}
in another script i have
public static int scoreValue = 0;
Text points;
// Start is called before the first frame update
void Start()
{
points = GetComponent<Text>();
}
// Update is called once per frame
void Update()
{
points.text = "Points: " + scoreValue;
}
public void adPoints()
{
Points.scoreValue += 1;
}
Comment