Exemplo n.º 1
0
    public void writeStuffToFile()
    {
        MyClass myObject = new MyClass();

        myObject.Firstname    = Textboxes[0].text;
        myObject.Surname      = Textboxes[1].text;
        myObject.PhoneNumber  = Textboxes[2].text;
        myObject.EmailAddress = Textboxes[3].text;
        myObject.Day          = Textboxes[4].text;
        myObject.Month        = Textboxes[5].text;
        myObject.Year         = Textboxes[6].text;
        myObject.Country      = GameObject.Find("Country").GetComponent <Dropdown>().captionText.text;
        string            json = JsonUtility.ToJson(myObject) + "\r\n";
        PersistentManager pm   = GameObject.Find("PersistentManager").GetComponent <PersistentManager>();

        File.AppendAllText(pm.FolderPath() + "data.json", json);
    }
Exemplo n.º 2
0
    private void SaveImage(int i)
    {
        //Create a Texture2D with the size of the rendered image on the screen.
        Texture2D texture = new Texture2D(otherTex.width, otherTex.height, TextureFormat.ARGB32, false);

        //Save the image to the Texture2D
        texture.SetPixels(otherTex.GetPixels());
        texture.Apply();

        //Encode it as a PNG.
        byte[] bytes = texture.EncodeToPNG();

        //Save it in a file.
        //change to save gif as video
        PersistentManager pm        = GameObject.Find("PersistentManager").GetComponent <PersistentManager>();
        string            extension = "00" + i.ToString() + ".png";

        File.WriteAllBytes(pm.FolderPath() + extension, bytes); //Change save location here.
    }