Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Video;
- using System;
- using System.IO;
- public class StressTest : MonoBehaviour
- {
- string path1;
- string path2;
- public VideoPlayer v1;
- public VideoPlayer v2;
- float count = 0;
- int stato = 0;
- public Text t;
- FileInfo f;
- // Start is called before the first frame update
- void Start()
- {
- // f = new FileInfo(Application.persistentDataPath + "\\" + "myFile.txt");
- path1 = PlayerPrefs.GetString("url1", "");
- path2 = PlayerPrefs.GetString("url2", "");
- v1.url = path1;
- v2.url = path2;
- v1.Play();
- t.text = Application.persistentDataPath;
- Save("messaggio");
- }
- void Riparti()
- {
- try// android crash!
- {
- Save("riparti" + stato);
- count = 0;
- v1.Stop();
- v2.Stop();
- Resources.UnloadUnusedAssets();
- // Indice = 0;
- bool success = Caching.ClearCache();
- if (!success)
- {
- Debug.Log("Unable to clear cache");
- }
- else
- {
- Debug.Log("pulita");
- }
- if (stato == 1)
- {
- stato = 0;
- v1.Play();
- }
- else
- {
- stato = 1;
- v2.Play();
- }
- }
- catch(Exception ex)//- no difference
- {
- Save("messaggio");
- Save(ex.Message);
- Save("InnerException");
- Save(ex.InnerException.ToString());
- Save("ex");
- Save(ex.ToString());
- Save("finelog");
- Debug.Log("HAAAAALP!!");
- }
- }
- // Update is called once per frame
- void Update()
- {
- count += Time.deltaTime;
- if (count >= 2)
- Riparti();
- }
- void Save(string messaggio)
- {
- File.AppendAllText(Application.persistentDataPath + "\\" + "myFile.txt",
- messaggio + Environment.NewLine);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement