Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
1
Question by mononull · Aug 07, 2012 at 09:56 PM · buttonmetapost

[meta] Cannot post code - gets cut off

I'm trying to post some example code, but every time I try the text gets cut off. I can paste regular sentences fine. But whenever I copy and paste my code example....it will show up in the preview window fine....but then after clicking save it all gets cut off at the '<' expression. I paste the code, select all the code text, click the code sample button, and this doesn't work either. Same effect where everything gets cut off.....

for(int i=0;i

for(int i=0;i

UPDATE: Used the markdown manually and same effect....gets cut off...

Comment
Add comment · Show 2
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 Bunny83 · Aug 07, 2012 at 11:12 PM 0
Share

Your first for-loop is just indented by 1 space... 1 space is not 4.

avatar image Eric5h5 · Aug 08, 2012 at 12:01 AM 0
Share

I'd suggest trying a different web browser. I've never seen the code button not work personally, but to be fair the code parsing on this site is kinda messed up and has been for a while.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Aug 07, 2012 at 10:08 PM

That's because you didn't marked your code as code. Just highlight all text that is code and press the "101 010" button above the edit field.

This button just do this:

  • It will insert an empty line before and after your code to seperate it from the normal text.

  • It will indent each line with 4 spaces. This will cause the editor to recognise the lines as code.

Just click the "?" at the right side of the editor which shows the basic markdown. At the end of that page there's a like to a more detailed documentation. Alternatively you can also take a look at the documentation of the StackOverflow which is quite similar to the markdown used here on UA.

As final note: don't try to put a code block right below a bullet-list. It won't work ;) instert at least one normal line in between.

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 mononull · Aug 07, 2012 at 10:11 PM 0
Share

yeah i did that...im not that clueless....it doesnt work thats why im posting about it

avatar image Bunny83 · Aug 07, 2012 at 11:09 PM 0
Share

It always works pretty well as long as you don't forget any of the two points. It even works here in comments. There is no button, but you can still indent it manually like this:

 This is a code block
     This line was originally indented by 4 and now it's indented by 8
         12 indents

The first 4 spaces will not be shown in your code block. They are used to recognise code. Each other character will be displayed as it is:

 // code
     GetComponent<FooBar>()
avatar image
0

Answer by aldonaletto · Aug 08, 2012 at 12:19 AM

This is happening because this site "thinks" that a < signal followed by any character but a space is a tag, and swallows the whole text after it until a > signal closes the imaginary tag. Place a blank space after < and the code will magically reappear (unless there's another < in your text).

I usually format code using the tag <pre>: skip a blank line, place the tag <pre>, the code and a closing </pre> - always skip a blank line before the <pre> tag, or this will not work. This kind of formatting also suffers from the < syndrome, thus be sure to insert a blank space after every <

I don't know how much the browser or OS influences this - I'm using a PC with Google Chrome, and always have this same problem.

EDITED: The <pre> tag ended being a big headache - @Bunny83's suggestion is what works fine: select the text and click the 101010 button (or press Ctrl-K).

Comment
Add comment · Show 3 · 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 mononull · Aug 08, 2012 at 03:23 PM 0
Share

i tried and , and couldnt get it to work, and i also tried putting a space after the initial '<' in my code....but it still treated it like a tag

i thought maybe i couldnt see some characters in the text field because of my color scheme but even changing that i still cannot tell whats going on with the tags

avatar image mononull · Aug 08, 2012 at 03:23 PM 0
Share

seem to work fine on that last comment though....okaaay

avatar image aldonaletto · Aug 09, 2012 at 12:56 AM 0
Share

That's how the text looks for me while editing:

<pre>
  var someVar: boolean;


  function Update(){
    someVar = !someVar;
  }
</pre>
Notice that there's a blank line before the <pre> tag, but it's not necessary to place a blank line before or after the closing </pre> tag.


The text above shows in UA like this:

var someVar: boolean;

function Update(){ someVar = !someVar; } The pre tag keeps the code exactly like you write or paste, except for the damned < character, which needs a blank after it in order to not be considered a tag.

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

10 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

Related Questions

change between two values (If /Else) 2 Answers

Changing the code from collision to button 5 Answers

multiple inputs 2 Answers

How can I make a gui with buttons pop up in javasript? 1 Answer

How do I trigger an animation using a button? 3 Answers


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