Skip to content

Instantly share code, notes, and snippets.

@naojitaniguchi
Created September 30, 2015 07:50
Show Gist options
  • Save naojitaniguchi/77b6469650a1e57a7475 to your computer and use it in GitHub Desktop.
Save naojitaniguchi/77b6469650a1e57a7475 to your computer and use it in GitHub Desktop.
Scren Capture in UI Button in Unity
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CaptureScreen : MonoBehaviour {
public string fileName;
// Use this for initialization
void Start () {
Button button = this.GetComponent<Button>();
button.onClick.AddListener(onClicked);
}
// Update is called once per frame
void Update () {
}
protected virtual void onClicked()
{
Application.CaptureScreenshot(fileName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment