Created
September 30, 2015 07:50
-
-
Save naojitaniguchi/77b6469650a1e57a7475 to your computer and use it in GitHub Desktop.
Scren Capture in UI Button in Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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