So my question is, how do I make unity display the correct code I made in Visual studio in the inspector, since it would be nice to quickly see what code the different scripts contain, instead of opening each one.
It may not be formatted correctly (whitespace seems to have been lost somehow) but it looks to me like the actual contents of the script show up fine.
I wouldn’t get too concerned with that preview of the script anyway, because as your script grows to a longer length, the inspector cuts off a certain amount and only shows a snippet of it, so you are better off just keeping in mind which script does what, and view them usually in your IDE rather than in the inspector preview.
The inspector preview is meant to just be a quick idea what the script contains.
One thing that might help the whitespace problem is to format your script (in visual studio ctrl-D does this) and that might help with the offset of whitespace.
I tried what you suggested with ctrl-D but that didn’t work, but what you wrote made me think and I kinda found out whats wrong.
Somehow when my scripts are made the white space is not made probably so, I need to somehow work with what I got.
Also If I copy, remove, and then paste the code again the scrip in the inspector is fine.