Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

Screenshots android

Iniciado por leocub58, Octubre 02, 2015, 10:32:51 PM

Tema anterior - Siguiente tema
Octubre 02, 2015, 10:32:51 PM Ultima modificación: Octubre 02, 2015, 10:33:25 PM por leocub58
Ya postee algo parecido, pero no encuentro el post. Llevo buscando esto un par de horas y me he rendido. Quiero sacar una screenshot en android y encuentro muchos post, webs tutoriales todo que te enseñan pero ami no me deja. mi script es un botón que ejecuta:Application.CaptureScreenshot(Application.persistentDataPath+"/prueba.jpg"); Tengo el Write Acess en la SD pero aun así nada. En el pc me va bien. He probado ya haciendo directorios con System.IO y me crea las carpetas pero nunca me crea la imagen.

yo use este y me sirvio
 
#pragma strict

var creatingFile : boolean = false;
var fileName :String = "Screenshot.png";

function Update() {
    if(Input.GetMouseButtonDown(0)) {
        Application.CaptureScreenshot(fileName);
        creatingFile = true;
    }
    if (creatingFile) {
        var origin : String = System.IO.Path.Combine(Application.persistentDataPath, fileName);
        var destination : String = "/sdcard/ScreenCapture/" + fileName; // could be anything
        if (System.IO.File.Exists(origin)) {
            System.IO.File.Move(origin, destination);
            creatingFile = false;
        }
    }
}
 

Octubre 03, 2015, 03:14:20 PM #2 Ultima modificación: Octubre 03, 2015, 04:03:57 PM por leocub58
[quote author=jeico008" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="28218" data-ipsquote-contentcommentid="115678">yo use este y me sirvio
 
#pragmavar creatingFile : boolean = false;
var fileName :String = "Screenshot.png";

function Update() {
    if(Input.GetMouseButtonDown(0)) {
        Application.CaptureScreenshot(fileName);
        creatingFile = true;
    }
    if (creatingFile) {
        var origin : String = System.IO.Path.Combine(Application.persistentDataPath, fileName);
        var destination : String = "/sdcard/ScreenCapture/" + fileName; // could be anything
        if (System.IO.File.Exists(origin)) {
            System.IO.File.Move(origin, destination);
            creatingFile = false;
        }
    }
}
 [/quote]Gracias, yo al final me descargué un plugin de la asset store... Soy tonto jajaja. Te aconsejo el plugin, es gratis y tiene muchísimas opciones.  https://www.assetstore.unity3d.com/en/#!/content/43374">https://www.assetstore.unity3d.com/en/#!/content/43374 por cierto, tengo un problemita más, la cosa es que me guarda las imágenes pero no me salen en la galería del móvil. Ni poniendo las imágenes en DCIM. Solo me salen en la galería cuando elimino la app, ¿sabes por qué?

Etiquetas: