Question by
Faysal-010 · Jan 29, 2017 at 07:25 PM ·
componentfalsetruesave gameinteractable
How to save Component
Hello everyone,
Hello everyone,
I like to save the interactable to be false after clicked. Now when the game restart or shutdown the interactable is clickable it needs to be false. So later i want reward the player after showing a video and then the button interactable will be true. Only I can't find a solution to this.
public void BtnOnClick()
{
gameObject.GetComponent<Button>().interactable = false;
}
Comment
Answer by ComradeVanti · Jan 29, 2017 at 08:19 PM
Use Playerprefs to save simple variables (int, float, string).
Look them up, if you dont know how to use them.
You could save "interacteable" into an int. 0 = not interacteable, 1 = interacteable
Good luck :D
private string inter;
public void BtnOnClick()
{
gameObject.GetComponent<Button>().interactable = false;
PlayerPrefs.SetInt(inter, 0);
}
Its not assigned I am new to this :-P how do is set the playerprefs up for this component