Search Unity

[Depreciated] Ultimate Replay - Complete state based replay system

Discussion in 'Assets and Asset Store' started by scottyboy805, Jun 28, 2017.

  1. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Thanks for the information. We will look into the problem again and hopefully fix the issue as soon as possible. I have PM'ed you a version of the trial package that has shortcut keys for the replay controls so you will be able to use it with your mouse lock. The source code is not included in the trial version for obvious reasons, I hope you understand.
     
  2. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Yes I get that, cheers man. Starting to give up hope on having a proper mecanim guy walking around in a replay, but hopefully it is possible :) I went back EZ Replay but its not handling the animation of the guy properly. Thanks for modified package will give it a go, I discovered the right way to stop ufps stealing the mouse clicks too but its still very handy, thanks.
     
  3. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    Hi,
    I tried your free version of Ultimate Replay. 10s of the replay took about 13KB which is quite high taking to account that our game data content isn't full yet. So, It could be much bigger if we add more game content.
    Is this an expected behavior? Is there any way to reduce it?
    For more information, our game is an asynchronous multiplayer game.
     
  4. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    13KB for 10 seconds worth of recording does sound a little high but then it depends upon the amount of objects you are recording. I recommend that you adjust the record rate that you are using so that it is as low as possible but still gives good playback results. You can adjust this value in the inspector of the ReplayManager component. We have had good results with record rates of less than 5fps using interpolation but your results may vary. You can also adjust the data recorded for each objects transform. Each ReplayTransform component has a low precision mode which uses half the data capacity of full precision buy storing each data element in a 16 bit format. It may be worth trying this on less noticeable recorded objects as long as you are not too far from the world origin.

    We will also be adding compression support to the ReplayFileTarget component in the near future so that the file size of a replay file can be reduced.

    I hope this helps you.
     
  5. Fantikor12

    Fantikor12

    Joined:
    May 21, 2018
    Posts:
    1
    Hi,

    I just want to share some problems we've encountered with the full version of plugin. First of all, ReplayIdentity is still pretty bugged, and multiple objects sharing the same "unique" id was a common issue in our case. We've made several modifications to Your code, trying to address this problem. We've removed ReplayIdentity serialization and forced generating new id in every awake (there is no need to serialize it in our case, as we want to record and replay game only during single session). I belive there is also problem with IsUnique method in ReplayIdentity.cs: it returns true if there is 1 or none registered id's on the list. It will return true for random generated number in GenerateUnique method when that number is in fact already used once.

    There was also much more complicated problem with playback and replayObjects collection inside ReplayScene.cs. We've enountered an edge case where setting frame to start the playback resulted in modifing hashset of replayObjects while iterating over it.

    InvalidOperationException: HashSet have been modified while it was iterated over
    System.Collections.Generic.HashSet`1+Enumerator[UltimateReplay.ReplayObject].CheckState ()
    System.Collections.Generic.HashSet`1+Enumerator[UltimateReplay.ReplayObject].MoveNext ()
    UltimateReplay.Core.ReplayScene.RestoreSnapshot (UltimateReplay.Storage.ReplaySnapshot snapshot) (at Assets/UltimateReplay/Scripts/Core/ReplayScene.cs:181)
    UltimateReplay.ReplayManager.SetPlaybackFrameNormalized (Single normalizedOffset, PlaybackOrigin origin) (at Assets/UltimateReplay/Scripts/ReplayManager.cs:744)

    We fixed this by adding special PlaybackState enum called Playback_Starting which is set before restoring snapshot. ReplayObjects are now checking for this state before calling "ReplayManager.Scene.RegisterReplayObject(this);" so this won't happen anymore.

    Still Your plugin is pretty useful for us :) Thanks!
     
  6. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Thanks for your feedback.
    Yes we recently discovered that there are still issues with the replay identity generation and are currently trying to fix it. We may have to rethink the way it is implemented though as we are finding it difficult with the events that Unity provides.
    The second issue we are not aware of so we will look into that. Would it be possible for you to send us the changes you made to info(at)trivialinteractive.co.uk and we will look at integrating them into the next update.

    Thanks again and I am glad our plugin is useful to you :)
     
  7. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Ultimate Replay version 1.1.1 has been submitted to the asset store for review.

    As some of you may know there was a bug that allows multiple replay objects to have the same replay identity which causes many issues during playback. We believe we have now fixed this issue and duplicate ids should not be an issue anymore.
    This version also adds a feature that allows you to end playback while keeping the state of the scene. Normally Ultimate Replay would revert the scene to its original state before playback began but now you are able to pass 'false' to the method 'ReplayManager.StopPlayback(bool)' which will cause the replay system to not revert the scene to its previous state.
     
  8. Rumbleboxer

    Rumbleboxer

    Joined:
    Dec 26, 2012
    Posts:
    27
    Hi potentially curious buyer here, would like to ask does your version currently support unity 2018 and also can it record events in Chronos when time is being rewinded? To better illustrate, I mean for example a bomb drops on a bridge and it explodes and via Chronos i rewind this incident and then shoot the bomb before it drops. Would the replay system be able to capture the rewinding itself and replay the incident in correct order?
     
  9. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    Yes our asset supports all Unity versions after 5.3.5 including 2018 versions. I am not familiar with chronos but if you just need to serialize basic event data such as a time stamp and some primitive event data then this can be done fairly easily by inheriting from ReplayBehaviour. You will be able to override the serialize/deserialize methods or generate replay events in order to store this data.

    Do you mean that you want to be able to record the rewinding of a recording? If so then this is not supported as our system cannot record and replay at the same time.

    I hope this helps you. Let me know if anything is unclear.
     
  10. kodagames

    kodagames

    Joined:
    Jul 8, 2009
    Posts:
    548
    What kind of video output will this create?
    Will it work with a WebGL game?
    Will it work with the 2017 version of Unity?

    Can I record all actions of a scene but disregard player inputs (like a user typing in a text box) but replay with values entered?

    Apologize for all the questions just want to see if it will meet my needs :D
     
  11. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Our system does not record the screen so it does not have any visual output. Instead our asset will take samples of object data like position and rotation a fixed interval and then this data is used during playback to restore the scene to the recorded state.

    We have not tested on web gl but I see no reason why it will not work. The only issue I can see is that you will not be able to create replay files as file system access is not allowed but you should still be able to record in memory.

    Yes all unity versions since 5.3.5 are supported.

    Our asset will only record data that you explicitly mark as recorded. Take a look at the documentation to see how this is done.

    We have a trial version of Ultimate Replay on the asset store which can be downloaded for free which will allow you to better understand how the asset works and what it is capable of. I would recommend you give it a try to ensure that it fits your requirements. It can be downloaded here.

    No need to appolagize. We are happy to answer your questions :)
     
  12. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Hi, I am using the latest version 1.1.1.

    When I called ReplayManager.BeginPlayback(), all components under the ReplayObject are disabled which makes sense. (That is a prefab) However after I called ReplayManager.StopPlayback(), the components were not enabled. Do I need to enable them by myself? Any thoughts? Thanks.
     
    Last edited: Jun 26, 2018
  13. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    HI,
    Ultimate Replay should automatically re-enable scripts when you go back to live mode. Are you getting any errors or anything in the console? Also have you implemented a custom replay preparer as this could affect how certain components are enabled/disabled.
     
  14. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Thanks for quick reply.

    I noticed something when I tried to reply you. My object is a bit complicated nested prefab. I accidentally added 2 ReplayObject in different transforms and components under the second ReplayObject cannot be re-enabled. I removed one of them and now it works fine. Thanks.
     
    scottyboy805 likes this.
  15. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Another question: Is there any way to record Active state of components like SkinMeshRenderer? For example the SkinMeshRenderer turns on and off during replay. It sounds like only ReplayTransform does not make it work during playback.
     
  16. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Yeah that would do it. You should only have one ReplayObject component on the hierarchy of an object which should be at attached to the same object as your highest level replay recorder component such as a ReplayTransform. Glad its sorted. Let me know if you have anymore issues.
     
  17. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    I am not sure what you mean. Do you want to keep the SkinnedMeshRendered enabled throughout playback or have I got the wrong idea. We don't have anything to record a skinned mesh renderer but we do have an experimental component to record an Animator component which will capture animation.
     
  18. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    My case is I have SkinnedMeshRenderer enabled and disabled during recording (It was disabled at the beginning). During playback, it is now enabled at the beginning.
     
  19. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    I see. Give me a bit of time to do some testing but we should be able to fix that fairly easily because other components such as rigid body and scripts remember their states before and after playback. it is just a case of extending this support to SkinnedMeshRenderers.

    Alternatively for a quick fix you could modify the source code of 'UltimateReplay/Scripts/Core/DefaultReplayPreparer.cs' to add 'typeof(SkinnedMeshRenderer)' to the 'skipTypes' array which will cause the replay system to ignore the skinned mesh renderer all together.
     
  20. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    I have done some quick testing and I cannot get the skinned mesh renderer to change its enabled state. I have tried with it both enabled and disabled and once playback is over it is not changed from its initial value. How is your hierarchy setup so I can get a better understanding of what might be the problem. Also is it possible that one of your scripts could be changing the enabled state of the renderer? perhaps in OnEnable or OnDisable which will be called when the replay system disables and re-enables some of your scripts
     
  21. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    In my case, imagine we have a zombie character which has a ragdoll setup. I have another set of same ragdoll which is inactive by default. Let's say now someone shoot the arm of the zombie and it is broken and fly away. What I am doing is to disable the original arm skinned mesh renderer, enable the hidden arm the skinned mesh renderer and let it fly away with physics. It involved enabling and disabling skinned mesh renderer during recording.
     
  22. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Ok I know what you mean now.
    you will need to serialize the state of the renderer in this case so that the replay system is able to replay when they are enabled and disabled. It is fairly simple to do. You will need to create a script that inherits from ReplayBehaviour and override the 'OnReplaySerialize' and 'OnReplayDeserialize' methods. In these methods you should read and write the boolean state of your renderer using the 'ReplayState' object passed to the methods just as you would with a binary writer/reader. Below is a quick example:

    Code (CSharp):
    1. using UltimateReplay;
    2.  
    3. class Example : ReplayBehaviour
    4. {
    5.     public SkinnedMeshRenderer visual;
    6.    
    7.     public override void OnReplaySerialize(ReplayState state)
    8.     {
    9.         state.Write(visual.enabled);
    10.     }
    11.    
    12.     public override void OnReplayDeserialize(ReplayState state)
    13.     {
    14.         visual.enabled = state.ReadBool();
    15.     }
    16. }
    One thing to note is that scripts deriving from ReplayBehaviour are treated specially and do not get disabled during playback. You should just take this into account when creating the script so that it will not manipulate replay objects during playback. You can use the property 'IsReplaying' to only manipulate the object during gameplay.
     
  23. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    It works very well. Thanks for the help!
     
    scottyboy805 likes this.
  24. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    No problem. Happy to help :)
     
  25. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Since I am using FinalIK, I have changed the execution order of scripts in FinalIK beyond 10000. So now the ragdoll joints return to T-pose during playback. I then tried to put UltimateReplay scripts to even lower execution order so they can run after FinalIK. I put ReplayManager, ReplayObject, ReplayTransform, ReplayBehaviour, Storage.ReplayTarget, Storage.ReplayMemoryTarget but no luck. Probably things in FinalIK are done in LateUpdate. Any advice?
     
    Last edited: Jun 27, 2018
  26. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    if you want a script to run after then shouldn't it have a higher script execution order? I might be wrong because I had not used it much but that was my initial thought. Is the problem caused by final IK running during playback and overwriting the replayed positions? Is so then this is a problem that can be fixed with replay preparers which will disable the component during playback so that it cannot interfere with the replay.
     
  27. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    You are right, I had FinalIK with order starting from 9996 and UltimateReplay starting from 11050. But probably only changing the execution order is not enough as some of the functions in FinalIK working in LateUpdate().

    Looks like the problem is that UltimateReplay recorded T-pose positions. Playback part should be fine because the FinalIK scripts were disabled by UltimateReplay during playback. I tried to change the Update() in ReplayManager to LateUpdate() but no luck.

    I tried to set breakpoints to LateUpdate() in FinalIK and LateUpdate() in ReplayManager and can confirm the one in ReplayManager run after FinalIK one.

    What function you think would possibly delay the recording part so it can run after FinalIK? Thanks.
     
    Last edited: Jun 27, 2018
  28. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    One strange thing, I have added ReplayTransform to every joints in the ragdoll so the list of observedComponents is long in Editor. However when I tried to break OnReplaySerialize() in ReplayObject (I suppose this is the one which records data?), I found that only 2 members are in observedComponents.
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      103.4 KB
      Views:
      679
    • 2.jpg
      2.jpg
      File size:
      115.9 KB
      Views:
      1,063
  29. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    I have turned some child gameobjects under the one with ReplayObject on and off and then observedComponents went back to full list and the recording works fine now. Since I can only find observedComponents being assigned in RebuildComponentList() which is a function only run with Editor. I have no idea how it works. Any thought why the observedComponents list was gone?
     
  30. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    I don't know much about how final IK works but Ultimate Replay does all of its sampling in the Update method of the ReplayManager class. If you get this update to run after all of final IK code then it should correctly record the pose. I don't know how this can be achieved though if final IK is using Late update. perhaps you can change the source of Ultimate Replay to run in late update also and then use the script execution order to run after final IK.

    This looks like a bug because that list should be the same as what is displayed in editor. I will have to look into it further.

    Disabling and re-enabling the components will cause the editor to call the built in Reset method which will force the observed components list to be updated so it makes sense that the issue is resolved after you did that. There is still a bug though as that list should always be up to date when the game starts.
     
  31. Dankann

    Dankann

    Joined:
    Oct 25, 2016
    Posts:
    3
    Hi, did you fixed the issue where different objects would have the same Replay Identity? Im having this issue and using "GetComponent<ReplayObject>().ReplayIdentity.Generate();" does not work, some times two objects are in the exact same position when replaying...
     
  32. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    Are you using the latest version of Ultimate Replay (v1.1.1 released a few days ago) as this version should have fixed that bug.
     
  33. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Regarding this issue, I think I know why the observedComponents list goes wrong.

    Here is my situation:
    I have a prefab A instantiating in runtime, for which I have some scripts like VRIK attached to it, then I have another prefab B instantiating in runtime later, is a ragdoll character, and is the child of prefab A.

    In 1st case, I added ReplayObject in both prefab A and prefab B to record the transforms, and you told me I can't have 2 ReplayObject in one hierarchy, so I try 2nd case.

    In 2nd case, I then removed ReplayObject from prefab B and only leave ReplayTransform there, so only prefab A has ReplayObject. As a result the observedComponents list goes wrong, only observedComponents in prefab A left, so I try 3rd case.

    In 3rd case, I removed ReplayObject from prefab A, as a result VRIK script keeps enable during playback and overrides the values in prefab B.

    In this case, how should I place the ReplayObject?
     
  34. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    It sounds like the observed components list does not get updated when you destroyed the extra Replay Object component causing it to become out of sync. Am i right in thinking that you instantiate prefab B after prefab A and then attach it as a child? If this is the case then I can see that it would be a problem getting the replay components of prefab B to be registered with prefab A. Would it be possible for you to make prefab B a child of prefab A in the editor but have prefab B disabled. You can then re-enable it in game when needed and this should sort out the un-observed components issue. The only other alternative would be to call the 'RebuildComponentList' method for the ReplayObject but at the minute this is an editor only method and will be compiled out when the project is built.
     
  35. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    You are right.

    The reason why we need to make prefab B as a prefab because we can switch different ragdoll models. This is a kind of roleplay, the player can choose different characters in runtime, then we will remove the prefab B and instantiate another one.

    So basically the player logic scripts are in prefab A and there are almost no script in prefab B. There are many prefab B in fact.
     
    Last edited: Jun 28, 2018
  36. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    In that case then I would try to call 'ReplayObject.RebuildComponentList' for the replay object on prefab A after you attach prefab B to the hierarchy which should update observed components list. If this works for you then we will look to make changes to allow the observed components list to be updated at runtime because at the minute it is editor only.
     
  37. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Looks like it works!

    How should we do to make it work on build?
     
  38. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Great to hear that it works for you.

    If you open the source file at 'UltimateReplay/Scripts/ReplayObject.cs' and scroll to line 228 you should see the 'RebuildComponentList' method which is enclosed in preprocessor directives to allow it to only exist in the editor. If you comment out (or remove) line 223 (#if UNITY_EDITOR) and line 247 (#endif) then you should be good to go once Unity re-compiles the scripts. We will make these changes in the next update also.
     
  39. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    It works perfectly, thanks!

    Another question, do we have white list feature that makes some components not to be disabled during playback? For custom made scripts, I inherited them from ReplayBehaviour and it works, but for things like Canvas, Canvas Scaler, Graphics Raycaster, Image, etc, I cannot do so.
     
  40. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Glad its working.

    We use something called a replay preparer which is responsible for preparing replay objects either for playback or live mode. These preparers are responsible for enabling and disabling certain components to ensure that they do not interfere with playback. You can either make your own replay preparer by implementing 'IReplayPreparer' and then registering it with the active replay manager or you can modify the default implementation to cause other components to not be affected. I would recommend that you change the source code of 'UltimateReplay/Scripts/Core/DefaultReplayPreparer.cs' as it contains an array of types called 'skipTypes'. If you add all component types that you want to ignore to this array then they will be ignored by the replay system.

    I hope this helps you.
     
  41. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Definitely work. Thanks!
     
    scottyboy805 likes this.
  42. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    @scottyboy805
    See if you see it fit to include this in your future update

    Code (CSharp):
    1.         // Private
    2.         private static readonly string[] skipTypes =
    3.         {
    4.             "ReplayBehaviour",
    5.             "Camera",
    6.             "AudioSource",
    7.             "ParticleSystem",
    8.             "UnityEngine.UI", //my custom namespace example
    9.         };
    Code (CSharp):
    1.                 // Check if the component should be prepared or skipped
    2.                 foreach (string skipType in skipTypes)
    3.                 {
    4.                     // Check if the component is a skip type or child of
    5.                     if (string.Equals(component.GetType().Name, skipType) || string.Equals(component.GetType().BaseType.Name, skipType) || string.Equals(component.GetType().Namespace, skipType))
    6.                     {
    7.                         // Set the skip flag
    8.                         skip = true;
    9.                         break;
    10.                     }
    11.                 }
     
  43. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    We will look into implementing this however it looks like it would be quite slow to me. It may be better performance wise to have a separate array for namespace exclusions but we will do some testing to confirm. We need good performance here because this method is called on every replay component on an object when switching between live and playback modes.
     
    stevenwanhk likes this.
  44. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Sometimes we have this error:
    InvalidOperationException: There is no data in the object state|UltimateReplay.ReplayState.ReadByte ()
    UltimateReplay.ReplayState.ReadBytes (System.Byte[] buffer, Int32 offset, Int32 amount)
    UltimateReplay.ReplayState.ReadBool ()
    UltimateReplay.Core.StatePreparer.BehaviourPreparer.PrepareForGameplay (UnityEngine.Behaviour component, UltimateReplay.ReplayState additionalData)
    UltimateReplay.Core.StatePreparer.ComponentPreparer`1[T].InvokePrepareForGameplay (UnityEngine.Component component)
    UltimateReplay.Core.DefaultReplayPreparer.PrepareForGameplay (UltimateReplay.ReplayObject replayObject)
    UltimateReplay.Core.ReplayScene.PrepareForGameplay ()
    UltimateReplay.Core.ReplayScene.set_ReplayEnabled (Boolean value)
    UltimateReplay.ReplayManager.StopPlayback (Boolean restorePreviousSceneState)

    It does not happen all the time with the exact same game flow. Any idea when this will happen?
     
    Last edited: Jul 10, 2018
  45. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    This looks like a bug with Ultimate Replay but we can't think of anything that would cause it. It looks like the replay system cannot find the initial state data of a behavior component that is recorded just before switching into playback mode. This means that when you switch back to live mode it has to create an empty state because one could not be found and as a result we end up reading too much data. Would it be possible for you to send us a repro project that has this behavior to info(at)trivialinteractive.co.uk. Since it is an intermittent bug it would be very difficult to debug without. Alternatively if you want to try debugging it yourself I would start with the methods 'InvokePrepareForGameplay' and 'InvokePrepareForPlayback' in file 'Assets/UltimateReplay/Core/StatePreparation/ComponentPreparer.cs'. You will see that the instance id of the component is used to store a replay state in a dictionary. This is the code that appears to be failing.
     
  46. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    The class runs in edit mode so that it can cache some variables and more importantly generate a unique Replay Identity. We found that it was very difficult if not impossible to rely on the editor functions that Unity provides such as 'OnValidate' or 'Reset' to do this because they are not called in some conditions and as a result it would often cause duplicated replay identities which would cause our system to produce playback errors. As a result we rely on the 'Awake' method which is called in editor when 'ExecuteInEditMode' is used but I know it is not ideal.

    You can comment out the attribute but you may start seeing duplicate replay identities which in turn may cause undefined playback behavior. Instead I would recommend using 'Application.isPlaying' in scripts that inherit from ReplayBehaviour to make sure that the game is actually playing before running your code. As far as I am aware it is only 'Awake' and 'Update' methods which run in the editor so you would only need to guard those methods (although I am not 100% sure).
     
  47. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Haha thanks. Your support is lightning fast. I decided to delete my question 2 minutes after posting since i had an idea i wanted to try out. But you managed to catch my post anyway :)

    Thanks for the suggestion. Will try it out. I have a pretty interesting use case. I am simulating a physical object that takes more than hundred inputs and i am storing these input values in replaymanager so i could play out a scenario and store it for later tutorial scenes. Bought your plugin yesterday and today i have most critical things set up already. Thanks for the great plugin and support.
     
  48. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    We try to respond as soon as possible :)

    Glad you are liking our asset so far. let me know if you need help with anything.
     
  49. Noa3

    Noa3

    Joined:
    May 29, 2012
    Posts:
    84
    i have the paid version of your ultimate replay and get an confilict with the asset pack from https://vehiclephysics.com/. especialy the VP Device Input Script.
    i found out, if i dont activate the script,the Ultimate Replay works fine and so all nice work what is wanted, but if the script activated before i start to record a Replay, i get later all controls and inputs blocked if i go to the Playback mode.

    So i decided to record a File over the Replay File Target and reload the scene and start the Playback mode, without the script activated. but my problem is now, on the reload of the scene, the file get deleted and i cant Play the record.


    what is the best way to save and load the replay?
    or maybe even bether, record, stop record and reload the scene in Playbackmode?
     
  50. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    I am not entirely sure I understand what the problem is. Are you saying that the input script stops running during playback? This is intended behavior and Ultimate Replay will disable any scripts that do not inherit from 'ReplayBehaviour' during playback so that they cannot interfere with the replay.

    With regards to the replay file issue: There is an option on the 'ReplayFileTarget' component called 'Overwrite Files' If you disable this then you should be able to load the file without the data being cleared.

    Could you possibly elaborate a bit on the issues and hopefully I can be more helpful.