Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Text;
- public class UpdateTimer : MonoBehaviour
- {
- private StringBuilder output;
- public float PauseForTime = 1.0f;
- public bool Record = false;
- public float RecordForTime = 2;
- private float hasRunFor = 0;
- void Start()
- {
- output = new StringBuilder ( );
- }
- void Update()
- {
- if ( hasRunFor == 0 )
- if ( Time.time > PauseForTime ) Record = true;
- if ( Record )
- {
- output.AppendLine ( $"Update() at Time.time {Time.time}" );
- hasRunFor += Time.deltaTime;
- if ( hasRunFor >= RecordForTime )
- {
- Record = false;
- Debug.Log ( output.ToString() );
- }
- }
- }
- private void FixedUpdate ( )
- {
- if ( Record )
- output.AppendLine ( $"FixedUpdate() at Time.time {Time.time}" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment