Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.Video;
  6. using System;
  7. using System.IO;
  8.  
  9. public class StressTest : MonoBehaviour
  10. {
  11.     string path1;
  12.     string path2;
  13.     public VideoPlayer v1;
  14.     public VideoPlayer v2;
  15.  
  16.     float count = 0;
  17.     int stato = 0;
  18.     public Text t;
  19.  
  20.     FileInfo f;
  21.     // Start is called before the first frame update
  22.     void Start()
  23.     {
  24.      //   f = new FileInfo(Application.persistentDataPath + "\\" + "myFile.txt");
  25.         path1 = PlayerPrefs.GetString("url1", "");
  26.         path2 = PlayerPrefs.GetString("url2", "");
  27.  
  28.         v1.url = path1;
  29.         v2.url = path2;
  30.  
  31.         v1.Play();
  32.         t.text = Application.persistentDataPath;
  33.         Save("messaggio");
  34.  
  35.     }
  36.     void Riparti()
  37.     {
  38.         try// android crash!
  39.         {
  40.             Save("riparti" + stato);
  41.             count = 0;
  42.             v1.Stop();
  43.             v2.Stop();
  44.  
  45.             Resources.UnloadUnusedAssets();
  46.             //  Indice = 0;
  47.             bool success = Caching.ClearCache();
  48.  
  49.             if (!success)
  50.             {
  51.                 Debug.Log("Unable to clear cache");
  52.             }
  53.             else
  54.             {
  55.                 Debug.Log("pulita");
  56.  
  57.             }
  58.  
  59.  
  60.             if (stato == 1)
  61.             {
  62.                 stato = 0;
  63.                 v1.Play();
  64.  
  65.             }
  66.             else
  67.             {
  68.                 stato = 1;
  69.                 v2.Play();
  70.  
  71.             }
  72.         }
  73.        catch(Exception ex)//- no difference
  74.         {
  75.             Save("messaggio");
  76.             Save(ex.Message);
  77.  
  78.             Save("InnerException");
  79.             Save(ex.InnerException.ToString());
  80.  
  81.             Save("ex");
  82.             Save(ex.ToString());
  83.  
  84.             Save("finelog");
  85.             Debug.Log("HAAAAALP!!");
  86.         }
  87.  
  88.    
  89.  
  90.    
  91.     }
  92.     // Update is called once per frame
  93.     void Update()
  94.     {
  95.         count += Time.deltaTime;
  96.         if (count >= 2)
  97.             Riparti();
  98.     }
  99.     void Save(string messaggio)
  100.     {
  101.  
  102.         File.AppendAllText(Application.persistentDataPath + "\\" + "myFile.txt",
  103.                    messaggio + Environment.NewLine);
  104.  
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement