Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- public class GDPRChecker : MonoBehaviour
- {
- public GDPRChecker Instance;
- public bool ConsentRequired = false;
- void Awake()
- {
- Instance = this;
- }
- void Start()
- {
- StartCoroutine(CheckGDPR());
- }
- IEnumerator CheckGDPR()
- {
- using (UnityWebRequest www = UnityWebRequest.Get("http://adservice.google.com/getconfig/pubvendors"))
- {
- yield return www.SendWebRequest();
- if (www.isNetworkError || www.isHttpError)
- {
- Debug.Log(www.error);
- }
- else
- {
- string requestResult = www.downloadHandler.text;
- Debug.Log(requestResult);
- ConsentRequired = requestResult.Contains("true");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement