- Home /
This question was
closed Aug 27, 2015 at 06:40 AM by
fafase for the following reason:
The question is answered, right answer was accepted
Question by
Wolfshadow · Aug 27, 2015 at 01:01 AM ·
c#iosplayerprefsintstatus
How to tell if an int is even
I am using playerprefs to check toggle input for an options menu. I want to tell if an int is even or odd. How would I do that? My script is:
using System.Collections;
public class test1 : MonoBehaviour {
public int pp1;
void Start ()
{
//PlayerPrefs.DeleteAll ();
PlayerPrefs.GetInt ("pplPref");
pp1 = PlayerPrefs.GetInt ("pplPref");
}
void OnMouseDown()
{
{
PlayerPrefs.SetInt ("pplPref", pp1 += 1);
PlayerPrefs.GetInt ("pplPref");
pp1 = PlayerPrefs.GetInt ("pplPref");
}
}
}
Thanks!
Comment
Answer by 14ercooper · Aug 27, 2015 at 01:14 AM
If the following line outputs true, then the number is even
Integer % 2 == 0;
With Integer being the int you want to see if it is even
Follow this Question
Related Questions
PlayerPrefs / RegEdit 1 Answer
How to sync the PlayerPrefs from my unity game for iOS to iCloud 0 Answers
How to sync the PlayerPrefs from my unity game for iOS to iCloud 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers