- Home /
How to record key pressed into text file
I want to detect if a letter key is pressed and save in notepad file.
Answer by Nerull22 · Jul 14, 2016 at 02:31 PM
Not exactly sure what you're looking for. You should look into FileSystemWatcher class from C#. It will raise events whenever a specific file is modified.
https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx
However, this will pretty much only look at when a file is saved down, then it will raise the changed event. You're going to have to get something much trickier going if you need it to be live. Probably a constant check against the contents of the file.
Answer by RageKit · Jul 14, 2016 at 04:36 PM
Check Input.inputstring in the doc to get any input key pressed
and to save : http://answers.unity3d.com/questions/279650/create-text-file-in-c.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612084813im_/https://answers.unity.com/themes/thub/images/avi.jpg)