Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Everplay Restart Time

Discussion in 'Unity Everyplay' started by skillbow, Jan 26, 2017.

  1. skillbow

    skillbow

    Joined:
    Dec 2, 2014
    Posts:
    7
    I've noticed that stopping and starting Everyplay too quickly keeps the old recording, even when Everyplay.StopRecording() and then Everyplay.StartRecording() is called on a new session. Is there a way to check whether the previous recording has stopped? I've tried registering for the Everyplay.ReadyForRecording event but it never seems to be called.

    This is a big problem for me as my game allows players to restart a level very quickly. If they then go on to win the level on their next try, the previous failed try is the recording that shows.
     
  2. skillbow

    skillbow

    Joined:
    Dec 2, 2014
    Posts:
    7
    If anyone is interested, I've solved this problem. You simply need to make a small delay before starting Everyplay recording after stopping. Something like this:

    Code (CSharp):
    1.  
    2.     public void startEveryplayRecording ()
    3.     {
    4.         if(Everyplay.IsReadyForRecording()) {
    5.             StartCoroutine(startEveryplayDelayed());
    6.         } else {
    7.             Everyplay.ReadyForRecording += startEveryplayRecordingAfterEvent;
    8.         }
    9.     }
    10.  
    11.     IEnumerator startEveryplayDelayed ()
    12.     {
    13.         float pauseEndTime = Time.realtimeSinceStartup + 1.2f;
    14.         while (Time.realtimeSinceStartup < pauseEndTime) {
    15.             yield return 0;
    16.         }
    17.  
    18.         Everyplay.StartRecording();
    19.  
    20.         yield return null;
    21.     }
    22. ...
    23.  
     
  3. pmjo

    pmjo

    Unity Technologies

    Joined:
    Sep 17, 2013
    Posts:
    245
    Everyplay should take this internally into account however it is best that you don't start a new recording before you have received RecordingStopped event.
     
    skillbow likes this.
  4. skillbow

    skillbow

    Joined:
    Dec 2, 2014
    Posts:
    7
    Thanks pmjo - don't know why I've only just spotted this but thanks for the response.