Canot convert void to string- HUH?

Updated on May 13, 2019 in Answers
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on May 13, 2019

I’m trying to create a define a local variable on a prefab after a user clicks on the instantiated data. I’m putting this variable in an onClick function. Only it’s giving me this error-

string savedate = PlayerPrefs.SetString (“DateofService”, OilServiceDate);

The function doesn’t return anything…

Any idea why?

  • Liked by
Reply
1 on May 13, 2019

Because the function doesn’t return anything…

PlayerPrefs.SetString sets a string that you’re saving, and as such, doesn’t return anything. If you want to get the string you’ve previously saved, then you need to use PlayerPrefs.GetString

on May 13, 2019

Thanks!

 

Show more replies
  • Liked by
Reply
Cancel