- Home /
After Paste, how do you realign script?
After pasting codes, how do you realign the scripts, I keep having to go and press return, move up delete empty space, next line press return, move up, and delete empty space, unless I feel comfortable and I can just use the backspace key to align. It is easier to read if its properly aligned. Using Unity's MonoDevelop. I like to select all and there should be some command that says realign or something.
you mean auto-formatting the whole script? How about Edit | Format | Format Document?
Answer by Huacanacha · Oct 29, 2013 at 06:14 PM
In MonoDevelop there is a menu option (you can also add a key binding in the preferences):
Edit->Format->Format document
Unfortunately this will also change things like line spacing, where the opening parenthesis goes etc. But it will indent all of your code correctly.
Another option could be to copy the text to another editor, format, then copy back.
Thx, it works, but format selection does not work. I highlighted what I selected and then selected the format selection command and it did nothing.
You're right, "Format selection" doesn't do anything for me either. Huh.
There will be a new version of $$anonymous$$onoDevelop released with Unity 4.3, so hopefully this will be fixed then.
Answer by IT_Criminal · Oct 24, 2013 at 04:41 PM
Select code that needs to be aligned, then press tab to indent to the right and shift+tab to indent to the left.
That still does not tell me where the correct indent position is, I already knew about the tab. I still have to press return first to make sure this is the correct position before I can tab the others and start over to check the others. I use this method to check for errors incase I did a type or forgot to add something, shift indent does not help with the indent errors.