using Invoke when TimeScale is 0 ?

so, i wanna made a game that once Player use one of their ability, the entire scene is paused and the Ability-Sequence is playing.

now the real problem is when the Sequence is finished, the game did not continue because it’s still Paused…

here is my Script, it says no error but, the script is actually not work :confused:

using UnityEngine;
using System.Collections;

public class AbilityAnimation : MonoBehaviour {

public GameObject OtherAbility;
public float timeNow;

void OnEnable()
{
    timeNow = Time.unscaledDeltaTime; 
    OtherAbility.gameObject.SetActive(false);
   
    Invoke("PlayAbility", timeNow);
}

void PlayAbility ()
{
    GameObject.FindGameObjectWithTag("GameController").SendMessage("AbilityUnpause");
    Debug.Log("is it works?");

}

i’ve already tried unscaledTime, unscaledDeltaTime, & realtimeSinceStartup
none of this is work for me…

is there any other method i could use ?
or my script is just wrong?

im sorry if my english was bad, english is not my native languange :slight_smile:
sincerely Best Regards :slight_smile:

Coroutine usage and material

As Sergio7888 mentioned in the comment to this question, Invoke is used normally on Coroutines. Unity provides very helpful and easy tutorials in the scripting section on how to use them. Look under intermediate, tutorial number 14.

I generally recommend going through the whole bunch since all topics are frequently of use and knowing about them helps you a ton with decision making.