- Home /
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 :/
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 :) sincerely Best Regards :)
thanks for your answer, glad somebody we're just replied :)
i'll try...
Thank You very much Sergio7888 ! im using Coroutine with WaitForSecondRealtime and now it works fine :)
Thank You!
Answer by YesNoKonrad · Oct 17, 2016 at 07:49 AM
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.
thanks for your advice xD more like i need to follow the Official Unity tutorial because before this i never do, im always start from open Scripting reference and try my own experiment....
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
About timescale and invoke 0 Answers
Dramatic Camera effect with all physical gameobjects paused? 0 Answers