I have this timer script to let an object disappear.
By giving sec a value I can adjust the time.
But now I want to access and change this value from Button > OnClick so I started function SecVideo.
How do I let this function make adjusting the float sec possible with a button click event?
using UnityEngine;
using System.Collections;
public class timer : MonoBehaviour {
public float sec;
public void SecVideo(float sec)
{}
void Start()
{ StartCoroutine(LateCall());
}
IEnumerator LateCall()
{
yield return new WaitForSeconds(sec);
gameObject.SetActive(false);
//Do Function here...
}
// Update is called once per frame
void Update () {
}
}