Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • META /
avatar image
8
Question by DFiable · Jul 28, 2011 at 11:25 AM · metaunityanswers-site-specific

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

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joshua · Jul 28, 2011 at 12:35 PM 0
Share

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?

avatar image Herman-Tulleken · Jul 28, 2011 at 05:01 PM 0
Share

@Joshua I see random empty lines inserted when pasting from Visual Studio as well...

avatar image Statement · Jul 29, 2011 at 10:48 AM 0
Share

That sounds like newline format mismatch to me. What browser are you guys using? http://en.wikipedia.org/wiki/Newline

avatar image CHPedersen · Jul 29, 2011 at 11:20 AM 1
Share
  • for asking a question all posters can benefit from. :) (Correctly formatted code == getting yelled at less && receive more help) = true

avatar image biohazard · Jul 29, 2011 at 11:27 AM 0
Share

@Christian H Pedersen :

$$anonymous$$ identifier :P

4 Replies

· Add your reply
  • Sort: 
avatar image
14
Best Answer

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CHPedersen · Jul 29, 2011 at 11:19 AM 0
Share

(Upvoted and selected this as the right answer)

avatar image shadoath · Sep 20, 2020 at 02:40 PM 1
Share

Anyone else read the binary for 101010 and realize that it is 42?

avatar image
2

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mehrdad995 · Feb 03, 2018 at 02:01 PM 0
Share

for me, the 101 010 button wasn't there and your answer just saved my day. thanks <3

avatar image
2

Answer by SisterKy · Jul 31, 2011 at 03:09 AM

if you format your code with the 101010-button and work on it afterwards, sometimes that breaks the formating again.

so personally I prefer formating-tags:
< pre> < code>

This is Code
< /code> < /pre>
(you have to remove the space after the ' · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Statement · Jul 28, 2011 at 12:40 PM 2
Share

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.

avatar image dibonaj · Jul 28, 2011 at 12:49 PM 0
Share

Good thing I don't use Chrome then. Works every time in Firefox.

avatar image dibonaj · Jul 28, 2011 at 12:57 PM 0
Share

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.

avatar image DFiable · Jul 28, 2011 at 04:49 PM 0
Share

Thanx Guys. Well my code is nice and then ends up scrambled. Thanx again guys.

avatar image Statement · Jul 28, 2011 at 05:14 PM 1
Share

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.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can we as users get the most out of UnityAnswers? 6 Answers

Unity Answers WIKI Option. Is it appropriate for Unity Answers? 2 Answers

Can no longer see comments? 4 Answers

Make This Site a Community Again! 2 Answers

[Meta] UA bug? "refine search" not working. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges