Steps
- Create script Delay.cs
using UnityEngine;
public class Delay : MonoBehaviour
{
[SerializeField] private int _delay;
private void Start()
{
Debug.Log("Start");
Invoke(nameof(SayHello), _delay); // Invokes the method 'methodName' in 'time' seconds.
}
private void SayHello()
{
Debug.Log("Hello!");
}
}
- Create empty object.
- Add script to object
- Press Play and check debug console.