Im creating a button in my game where the player is able to subscribe my YouTube channel and earn coins. So when i click on the the subscribe button and i earn coins but when i restart the scene, The subscribe button in the game appears again. The subscribe button is supposed to be clicked once because the player can only subscribe my channel once. So basically i want to call a function and say the object should destroy permantly and must save.
I would recommend you to check if the guy is subscribed to your channel and only if not enable the gameobject.
Or another method could be that you save in the PlayerPrefs a bool when the button has been pressed. When this bool is true the button is not there.
You can just hide the button by adding a script to it which checks OnEnable if the bool is true and then set the Gameobject Inactive
PlayerPrefs will be the easiest, you can find example code on the unity forums like this one^
Hey, I really appreciate your work, But things dont seem to be good. I have attached my code below ( Load URL CODE). Currently im having a button and when i click the button the url opens successfully. Please combine your code with mine and reply. Thanks!
using UnityEngine;
namespace Zigzag
{
public class ZIRLoadLevel : MonoBehaviour
{
public void LoadURL(string urlName)
{
Application.OpenURL(urlName);
}
}
}