Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Why when i open a new script in visual studio the MonoBehaviour is not in light blue ?

Discussion in 'Scripting' started by Chocolade, Nov 2, 2017.

  1. RealDerpCore

    RealDerpCore

    Joined:
    Jan 14, 2020
    Posts:
    13
    SOLLUTION:

     
    Kbarrettoh, duke2go and matejsabo7 like this.
  2. amoraleite

    amoraleite

    Joined:
    Oct 16, 2014
    Posts:
    41
    This solution worked for me! Unity 2020 and TY!
     
  3. chemitron

    chemitron

    Joined:
    Mar 16, 2021
    Posts:
    2
    I started with this problem after I completely removed Unity from my Mac. After installing Unity, the red text started appearing in visual studio. I closed Visual Studio. In Unity, I checked the external scrip editor under "Unity/Preferences" and it showed "Visual Studio for Mac [8.10.14]". I clicked on the drop-down menu and navigated to the applications folder and selected "Visual Studio" and clicked "open". The text on the external editor remained as "Visual Studio for Mac [8.10.14]" but when I opened the scripts (by double-clicking on them from Unity) they did not have red text.
     
  4. OlivierMorland

    OlivierMorland

    Joined:
    Sep 24, 2021
    Posts:
    8
    I tried opening and closing Visual Studio several times as well as doing the same for Unity. What worked for me was the following:
    - Unity > Preferences > External Tools > External Script Editor
    - There I found Visual Studio had been unset for some reason. After resetting it as the external script editor the whole solution loaded.
     
  5. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    and if the visual studio is already linked correctly,

    you can do this:
    1. go to Unity > Edit > Preferences > External Tools
    2. under Generate .csproj files for, mark all checkboxes.
    3. click button Regenerate project files
    4. restart unity and visual studio
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874
     
  7. beasis

    beasis

    Joined:
    Nov 20, 2019
    Posts:
    1
    Same problem on me today.

    I solved by

    step 1. in Unity studio go to edit -> preferences -> external Tools

    step 2. change external script editor to visual studio (in my case this value was 'open by file extention' )

    step 3. be happy
     
  8. nidhirawat

    nidhirawat

    Joined:
    Jun 12, 2022
    Posts:
    1
    It worked. Thanks
     
  9. marartb1

    marartb1

    Joined:
    Mar 4, 2021
    Posts:
    5
    Hello i resolved this, create new sript in the same namespace and open.
    The old script take monobehavior.
     
  10. amsachin

    amsachin

    Joined:
    Mar 5, 2021
    Posts:
    1
    Thank You,
    This one worked
     
  11. marru101

    marru101

    Joined:
    Jan 29, 2023
    Posts:
    1

    Thank youuuu
     
  12. duke2go

    duke2go

    Joined:
    Nov 1, 2018
    Posts:
    15
    THIS!!!!! THIS RIGHT HERE!!!!!!!!!! This completely fixed the issue. You just have to be patient and let it finish getting over its virtual stroke and right itself. That was literally all I needed. Why the F can't the devs fix this???
     
  13. juwolf

    juwolf

    Joined:
    Apr 15, 2023
    Posts:
    1
    For me helped installing the extra features on the right side. The pop up was yellow with an Install button.
    idk hope it helped :)