What I have tried: I’ve tried version history, but I don’t think my file has that. I’ve searched for how to de-compile a unity project (I have a recent build) to retrieve my script, but none of that has worked yet.
If you have a recent build, then you can decompile it. Here’s a short info how to do it on Windows.
After building a project, you have an exe file, let’s name it MyGame.exe, and folder MyGame_Data. Inside this folder there’s subfolder Managed, containing the compiled Unity assemblies. Those interesting you are:
Your code is most probably inside an assembly without firstpass in its name.
To decompile, download any .NET decompiler. I suggest free ILSpy or trial version of .NET Reflector. After opening decompiler, drag the assembly and just browse to desired file. If your class was contained within namespace, then it will be accessible under this namespace. In other case, it should be under empty namespace (minus sign). Clicking the class should open it in disassembled form, though if I remember, in .NET Reflector you have to double click it or right click and select Disassemble.