How to create fake input events to simulate mouse/touch for a "replayer" component ?

hi

I made a learning game wherein children move objects by drag’n drop. I would like to record the touches + time in a file in order to “replay” the played scene.

I then have to create fake input events to fool the scripts and the eventsystem. Unfortunately I found nothing about that. Only people who wished the same API.

My project is for now built for the Unity 2019.2.18f1 version. I can upgrade to newest if solutions exist with the new input system API.

Does somebody know how to create such fake low-level input events? Is there another way to achieve my objective?

thks in advance

Pierre

Simulating mouse movements is not going to work - I know from experience. There are far too many issues with it - for example, if your framerate varies even slightly from what you recorded at, it could get out of sync and everything will break. If you skip a frame where the user clicked on something and then moved the mouse, then in the replay it might miss the object they clicked on, and suddenly you’re out of sync.

You’d be better off recording the results of the mouse clicks: record the objects as they move. That will not get wildly out of sync as time goes on. If you must show mouse movement and clicks for whatever reason, you can create objects that record those things to display them, but DO NOT use that data to control other objects, that way lies madness.

thank you four your answer. I was also thinking about recording effects instead of causes as a plan B but rejected it because of the complexity of my game. Now I understand that’s the only way. thx