Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
1
Question by carlqwe · Apr 19, 2016 at 10:55 AM · ifif statement

C# autocorrects my if statements

hello i recently changed from javascript to c# and it all works great, just one problem. it autocorrects my if statements. Dont really know how to explain more in detail, but take a look at these pictures instead:

How i want it: alt text

How it autocorrects: alt text

Thanks (:

code-1.png (1.9 kB)
code-2.png (1.9 kB)
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 Owen-Reynolds · Apr 19, 2016 at 02:58 PM 1
Share

Just curious, why pictures? Text is better for computer code, and what you have should be cut and pastable. Are you having trouble with the code-formatting? Either highlight and click the 00101 button, or simply add 4 spaces in front of each code line.

avatar image carlqwe Owen-Reynolds · Apr 20, 2016 at 07:08 AM 0
Share

Sometimes slow thinking brings u down. I dont really know why i posted pictures, i just wanted to try to import images, hope you dont $$anonymous$$d, tho it got the job done! :)

2 Replies

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

Answer by Raresh · Apr 19, 2016 at 11:50 AM

If using Monodevelop: For the current project go to Project -> Solution Options -> Source Code -> Code Formatting -> C# Source Code -> C# Format -> Edit -> Braces. Then play around with the settings until you find the right setup for you. For your specific question you should set them to Next Line.

If you want the settings for new projects you might make, do the same thing, but this time go to Tools -> Options -> Source Code -> ...(like before). It will only apply these settings for new projects.

Also you might want to set up a keybind in order to force the whole document to format. To do that go to Tools -> Options -> Hotkeys and search for "Document Format" or something like that. When you will press the key combination it will format the whole document according to the current formatting settings.

alt text


untitled.png (113.2 kB)
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 JigneshKoradiya · Apr 19, 2016 at 12:51 PM 2
Share

perfect answer thanks,i am going to upvote it

avatar image
3

Answer by Rumor · Apr 19, 2016 at 12:13 PM

Hope this helps:

  1. In MonoDevelop menu bar click on "Project" > "Solution Options" .

  2. In the new window that appears, Open the Source Code arrow.

  3. Open the "Code Formatting" header on the left side.

  4. Click on the C# source code header

  5. On the right of the window, click on the C# format tab.

  6. Click the edit button

  7. Open the drop down "Catergory" and change it to Braces.

  8. You will now see a list of setting to alter, these will. I would suggest if you always want the bracket on the next line to set most of them to "Next Line".

alt text


untitled.jpg (213.9 kB)
Comment
Add comment · 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

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

44 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Unity Update is ignoring the GetKey part of my statement!? 2 Answers

SqrMagnitude intermittently doesn't work for if statement on prefab. (C sharp) 1 Answer

My "if" statement doesn't work? 2 Answers

If statement for direction the character is facing 0 Answers

If/ElseIf never reaches elseif 0 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