Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FlashCam : MonoBehaviour {
- public GameObject flashImage;
- // Use this for initialization
- void Start () {
- flashImage = GameObject.Find("Flash Image");
- flashImage.SetActive(false);
- }
- // Update is called once per frame
- void Update () {
- }
- IEnumerator flash()
- {
- for (int i = 0; i < 24; i++)
- {
- if(flashImage.activeSelf)
- {
- flashImage.SetActive(false);
- }else
- {
- flashImage.SetActive(true);
- }
- yield return null;
- }
- }
- void OnGUI() {
- if (GUI.Button(new Rect(10, 70, 50, 30), "Flash"))
- StartCoroutine("flash");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement