Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Using code tags properly

Discussion in 'Scripting' started by Adam-Buckner, Jul 16, 2012.

  1. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    1,967
    Ah, okay, it's my browser's fault now. All right, I'm stupid, you are not. I guess carrying on here;is useless, you don't want to listen and the issue will never be fixed and people will keep posting code without using tags, as they do, and their scripts will be incomprehensible and they'll get little help.

    I'll never post any link to this thread from now on.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,084
    Yeah, talk about missing the point. (Which was only that formatting isn't deliberately stripped, it's still there even if it doesn't help.) Maybe if you read the entire post? There were a bunch of words after that, which contained the relevant stuff. I'm not in a position to do anything about it, so I offered some suggestions based on what appears to be a higher success rate of formatted code on UnityAnswers. But hey, just ignore all that and write a put-upon post, since that really makes everything better.

    --Eric
     
  3. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,453
    That escalated quickly....
     
  4. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    961
    I don't think anyone was really disagreeing with you, just establishing the current behavior and why it is what it is, but I guess maybe it felt like people were piling on. It would actually be awesome to have some sort of automated code detection and formatting. Is there any place that actually does that? Some sort of machine learning thing would probably be helpful there.

    I think it would be helpful to change things over to use a form of Markdown like Answers and Stack Overflow where 4 character indents are interpreted as code. The first 2 or 3 lines are often not intended like that so those are missed, but much of the rest of the code gets formatted as such. Better than nothing.
     
  5. Indie_Dev

    Indie_Dev

    Joined:
    Dec 29, 2017
    Posts:
    35
    Is there any shortcut method that will allow me to indent code when entering directly into the browser?
    I'm a bit (O_C_D * 1000) when it comes to that. I will take the time to manually "spacebar" it out, but if I could not have to hit 60 spaces every time I write a 4 line if statement, it would be quite lovely ^_^
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,714
    I wish lol. It's also sad for me when I test write code and paste it here, only to see several lines of indentation from my VS, but the snippet here requires less :) I usually update it myself, but not always. :)
     
  7. MAYALS18

    MAYALS18

    Joined:
    Jan 10, 2018
    Posts:
    1
    Code (CSharp):
    1. // Code
     
  8. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,714
    I do not know if this "Inline code" button was always present on the forums, or if it is new. I only ever used the Insert-> code when I first began, and now I just type it..

    However, I have seen a lot of posts using it lately, and it's not very good. I think it's great that the button is not "hidden" under insert for a very common code insertion, but perhaps it could be changed to be the proper code tags, rather than those inline ones. :) Please.. lol
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,084
    Agreed, it should be removed, or better yet changed to use CODE rather than ICODE. I can't see any purpose for ICODE. It's not even inline. If it was actually inline, it would at least make some sense.

    --Eric
     
  10. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    968
    Ugh, so that's where all those weird looking code posts came from. They actually do more harm than good because some long lines would get cut off, and I'd lose critical context when trying to read the code.

    Having a more visible button rather than being buried inside Insert is a good start. Now let's change it to CODE and drop this ICODE mess.

    sigh.
     
    Last edited: Mar 8, 2018
  11. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    Cleaned this up a bit - 'Insert Code' is now on the toolbar.
     
  12. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,714
    It's cool that there's a message about not using the other one. lol

    edited: ... will wait a while & try the new tags.
     
    Last edited: Mar 27, 2018
  13. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    @methos5k, probably a cache problem, can you try to clear it?
     
  14. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,714
    I will try later, as I have to leave atm. :)

    Edit: Now gives me the popup to insert code.
     
    Last edited: Mar 28, 2018
    and-poulsen likes this.
  15. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,714
    This thread is for "how to use code tags properly", and not remotely related to your post.
    Try maybe general discussion?
     
    TheMeeroslav likes this.
  16. CubicCBridger

    CubicCBridger

    Joined:
    Apr 19, 2017
    Posts:
    44
    Another thing (loosely and) tangentially related to code tags is errors. I've been noticing many posts asking for help debugging code which isn't either compiling or failing at run-time, with the error as the post title or mentioned in the body. Too many times users have had to request the OP for the original error as it was not included anywhere in the thread.
    Maybe this requires a separate sticky for how to create threads for debugging errors but I thought I would initially raise it here.
    • Step 1 - Include error
    • Step 2 - Include code with code tags
    • Step 3 - Provide context
    • Step 4 - Provide attempted solutions
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,336
    ^ That's a good point. With runtime errors in the Unity editor, please click on the error in the Console window, press Ctrl+C (or Command+C) to copy it to the clipboard, and then paste it into the post. This will include the stack trace, which provides valuable information.
     
  18. eneroth3

    eneroth3

    Joined:
    Oct 22, 2018
    Posts:
    63
    My feature request would be to clean up the forum UI in general, and not make this arbitrary distinction between quick reply and whatever the other kind of reply is called. Preferably even switching to Discourse which has a friendly and functional UI, where you for instance can easily see when a post was written, rather than going "nope, that's the join date... that's the number of posts... *scroll* *scroll* ... that's a signature... that's the edit date... that date there that has no label, that has to be it!". I can see if that is unlikely to happen any time soon though.
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,084
    The post you're replying to is from 2012, when the forums used vBulletin, rather than Xenforo. The issue discussed at the time is not relevant anymore; there's only one kind of reply now.

    Anyway it seems like a rather drastic overreaction to simply moving the post date around; it's not hard-coded or anything. Most other Xenforo-based forums have it at the top.

    --Eric
     
    eneroth3 likes this.