How do you format scripts in UnityAnswers?
I pressed the "101 010" button and its says place code here. I cut and paste right where it says "enter code here", but my code is never formatted correctly. Would someone please explain how to format my code in a little more detail? Thanx
I'm wondering, are you guys also experiencing problems with line spacing when copy-pasting from $$anonymous$$onoDevelop? For me, and some others, between each line a blank line gets inserted.
Any way to prevent this?
@Joshua I see random empty lines inserted when pasting from Visual Studio as well...
That sounds like newline format mismatch to me. What browser are you guys using? http://en.wikipedia.org/wiki/Newline
for asking a question all posters can benefit from. :) (Correctly formatted code == getting yelled at less && receive more help) = true
Answer by Statement · Jul 28, 2011 at 11:54 AM
I usually just paste some code, select it all, and press the 101 010 button.
So, make sure you have selected your code before pressing 101 010 button.
Actually, I just format it in my editor before sending it out, it's easier imo. Just make sure you got 4 spaces before each line of code. I select all text, press tab to indent them with 4 spaces, then I copy & paste it here.
Anyone else read the binary for 101010
and realize that it is 42?
Answer by Chris D · Jul 28, 2011 at 05:00 PM
As an addition to the other answers here, all the formatting rules apply in the comments space as well as in the Q&A forms, there's just no handy formatting feature for it.
In the case I want to put code into a comment, I either add 4 spaces (if it's a short snippet) or compose the comment in the answer box first, ensure it's formatted correctly, then cut/paste it into the comment field.
The formatting is based on Markdown Syntax and you can use many of the features listed in the syntax reference here.
for me, the 101 010 button wasn't there and your answer just saved my day. thanks <3
Answer by dibonaj · Jul 28, 2011 at 12:12 PM
All I do is press that button, copy my code, highlight where is says "enter code here" and then just paste. And I have also noticed that if you don't indent between curly braces it tends to not format correctly.
Actually, that's the wrong way (at least in Chrome). It'll only indent the first line of code. Paste the code, select the code, then press the 101 010 button.
Good thing I don't use Chrome then. Works every time in Firefox.
I should also note that I am insanely picky when it comes to formatting my code inside of $$anonymous$$onoDevelop (or anything I may be using to do my coding in). So I don't know if you have "poor" formatting techniques if that'll translate over to how it gets pasted here.
Thanx Guys. Well my code is nice and then ends up scrambled. Thanx again guys.
dibonaj, are you sure about that? I don't mean to go into a crusade or anything but I picked the first answer from you that I could find some code in, and it's wrong. http://answers.unity3d.com/questions/147225/infinitely-repeating-sound-when-$$anonymous$$imizing-web-pla.html The first line is indented, the second line is not. It's a flurry of indented and non-indented.