I try to use the Input Recorder with openxr. The results are very inconsistent when the recordings will be played and when not. Is it in a buggy state or is there a (not documented) way how to use it properly? Thanks in advance! Edit: I tried it with quest 2 on oculus link and rift s in Unity 2020.3.14.
I haven't used InputRecorder with XR, but I have used InputEventTrace successfully which InputRecorder is based on. Recording example (to byte array): Code (CSharp): // declare locals private InputEventTrace inputEventTrace = new InputEventTrace(); // later... enable recording inputEventTrace.Enable() // later... save to byte array MemoryStream ms = new MemoryStream(); inputEventTrace.WriteTo(ms); var inputSystemBytes = ms.ToArray(); inputEventTrace.Clear(); Playback example (from byte array): Code (CSharp): // declare locals public InputEventTrace inputEventTrace = new InputEventTrace(); public InputEventTrace.ReplayController replay = null; // later... load from byte array and play back var ms = new MemoryStream(message.Value.Bytes, offset, msg.ByteCount); inputEventTrace.ReadFrom(ms); if (replay == null) { replay = inputEventTrace.Replay().WithAllDevicesMappedToNewInstances(); } replay.Rewind(); replay.PlayAllEvents(); inputEventTrace.Clear();
Hello thep3000, thank your for your response. Recording is working and replay during the same Playmode. But if i return to editor and go to playmode again. Then Replay is not working anymore. I save it to a file and load it... and it plays.. but controllers are standing still. The Sample is pretty much identical to your code but uses Code (CSharp): // Start replay. if (m_SimulateOriginalTimingOnReplay) m_ReplayController.PlayAllEventsAccordingToTimestamps(); else m_ReplayController.PlayAllFramesOneByOne(); m_ChangeEvent?.Invoke(Change.ReplayStarted); instead of PlayAllEvents but I guess it should work the same way, right?
Check the input debugger (Window -> Analysis -> Input Debugger) .. check that there aren't duplicated devices during the playback. Double click on a device and see if data is coming through. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Debugging.html
Here it implies the same code is still part of the new InputSystem package from version 1.6.3. https://docs.unity3d.com/Packages/com.unity.inputsystem@1.6/manual/Debugging.html#other-tips And from the API: https://docs.unity3d.com/Packages/c...vel_InputEventTrace_WriteTo_System_IO_Stream_ https://docs.unity3d.com/Packages/c...owLevel.InputEventTrace.ReplayController.html
Anyone fixed this issue? I'm testing with a XR device trying to record the Headset + controller position. Record and replay works within the same play session. But if I stop the session and go to restart it via editor, it doesn't work any more. Suspect it's something to do with instance ID? Any help is appreciated.