Search Unity

How to get an assembly file type in c#

Discussion in 'Code Editors & IDEs' started by LeonWD, Mar 22, 2020.

  1. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
    I started learning to use unity today, so sorry if this is a dumb question. But all of the tutorials i see use the 'assembly-CSharp' file type in visual studio, but mine keeps going to 'miscellaneous file' and it seems that the language is subtly different as the commands in the tutorials don't work in this file type. The first command i noticed this with was 'getcomponent', which i was unable to use. My visual studio.png tutorial image.png
     
  2. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Hmmm, it seems your MonoBehavior isn't even loaded correctly. A quick fix might be to simply reload your solution.

    Step 1) Close your solution
    upload_2020-3-22_22-45-44.png

    Step 2) Open your solution from within Visual Studio. Look for a .sln file in your project directory.

    This is just a simple thing but it usually works. Let me know if it doesn't.
     
  3. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
    Thanks, I gave it a try but i cant find how to get to the code window now. I've got it up in the solution explorer but i can't figure out how to view it properly. How do i view the code window?
     
  4. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Your scripts are located in the solution explorer on the right. If you don't see it for some reason, go to View -> Solution explorer or use a shortcut Ctrl+Alt+L
     
  5. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
    help.png
    Right, i found that i was opening just the sln file instead of the whole project, but it hasn't fixed the issue, it still comes up as a 'miscellaneous file'. I might be doing something wrong; do you have discord so i can screen share?
     
  6. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
  7. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
  8. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
    I've got to go for a bit, I've not been able to fix it yet.
     
  9. LeonWD

    LeonWD

    Joined:
    Mar 22, 2020
    Posts:
    6
    so I looked on there and attempted a few of their answers, but quite a few contain things i don't understand or processes that they don't explain. Heres a link to the top answer: https://stackoverflow.com/a/35467486. This says to right click on the issue file and select exclude from project, but i dont get that option, even a grey-ed out one. I might not be selecting the right file, which is the .cs file in my unity project, is this the wrong file? Or is it due to them using a different version?
     
  10. Nnja13

    Nnja13

    Joined:
    Nov 13, 2022
    Posts:
    2
    Please go to Edit > Preferences > External tools . Then Click External Script Editor and choose your editor of Microsoft visual studio 2022.
    After that click appeard button "Regenerate project files" .
     
    jonpeterhoward and Brexmod like this.
  11. Brexmod

    Brexmod

    Joined:
    Nov 25, 2022
    Posts:
    1
    Thank you so much dude.. its really work
     
    jonpeterhoward likes this.