How can I programmatically add comments with the current author, modify date, version after each C# file I change gets saved?

Hi,

I’d like to create (or use an existing one) a system to automatically change the first lines of every script I save with my personal data in the form of a comment. (eg: name, license, last change date, email address, number of revision of the file, etc.). Think of it as a dynamic template.

Now, I have a few ideas on how to store and parse the text result, but, since I also am using third party script editors, would like to know if there is some sort of callback or event I can hook to.

I’m using Unity’s C#

I recommend you consider using a version control system. Not only will they potentially save your bacon next time you accidentally delete or corrupt your project, but they also typically store all this kind of metadata every time you commit a change to a file that’s in the repository.

Here’s a guide to get you started: Unity Cloud Build - Unity Learn